summaryrefslogtreecommitdiffstats
path: root/nova/virt
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-12-13 16:48:05 -0500
committerJesse Andrews <anotherjesse@gmail.com>2011-12-16 19:47:16 -0800
commitf4368e5cdf286d065742e0da1977a3e48c091123 (patch)
tree77bef5c6b586e6157138472524438b211dbc7a1b /nova/virt
parent106ea5eda8458b44846207a3df69cf1837789828 (diff)
avoid error and trace on dom.vcpus() in lxc
This fixes bug 903943. If you used lxc, you'd eventually see stack traces in nova-compute due to use of dom.vcpus(). Change-Id: I8ff4e973d33eef3df116feb237b2febc8e6a59b5
Diffstat (limited to 'nova/virt')
-rw-r--r--nova/virt/libvirt/connection.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py
index bbd45ee13..864707f20 100644
--- a/nova/virt/libvirt/connection.py
+++ b/nova/virt/libvirt/connection.py
@@ -1384,7 +1384,13 @@ class LibvirtConnection(driver.ComputeDriver):
total = 0
for dom_id in self._conn.listDomainsID():
dom = self._conn.lookupByID(dom_id)
- total += len(dom.vcpus()[1])
+ vcpus = dom.vcpus()
+ if vcpus is None:
+ # dom.vcpus is not implemented for lxc, but returning 0 for
+ # a used count is hardly useful for something measuring usage
+ total += 1
+ else:
+ total += len(vcpus[1])
return total
def get_memory_mb_used(self):