capabilities: Handle broken return value of failed CPUModelNames

This commit is contained in:
Cole Robinson 2014-03-20 13:45:52 -04:00
parent 994b1fa4f4
commit 1f5b07bea8
1 changed files with 7 additions and 5 deletions

View File

@ -86,11 +86,13 @@ class CPUValues(object):
if self._cpus is not None:
return self._cpus
if (conn and
conn.check_support(conn.SUPPORT_CONN_CPU_MODEL_NAMES)):
self._cpus = [CPUValuesModel(i) for i in
conn.getCPUModelNames(arch, 0)]
return self._cpus
if (conn and conn.check_support(conn.SUPPORT_CONN_CPU_MODEL_NAMES)):
names = conn.getCPUModelNames(arch, 0)
# Bindings were broke for a long time, so catch -1
if names != -1:
self._cpus = [CPUValuesModel(i) for i in names]
return self._cpus
return []