diff options
| -rwxr-xr-x | nova/virt/libvirt/driver.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 485f661e5..5f19f0c18 100755 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -2203,18 +2203,15 @@ class LibvirtDriver(driver.ComputeDriver): """ total = 0 + if CONF.libvirt_type == 'lxc': + return total + 1 + dom_ids = self.list_instance_ids() for dom_id in dom_ids: try: dom = self._conn.lookupByID(dom_id) 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]) + total += len(vcpus[1]) except libvirt.libvirtError as err: if err.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN: LOG.debug(_("List of domains returned by libVirt: %s") |
