Skip to content

Commit 00740b0

Browse files
committed
Remove 'nova.virt.libvirt.compat'
This contained a single wrapper for 'domain.info()' that worked around a race in libvirt 1.2.11. We haven't supported this version for quite some time [1] so the module itself can go. [1] http://git.openstack.org/cgit/openstack/nova/commit/?id=28d337b -- Pick next minimum libvirt / QEMU versions for "Stein" Change-Id: I690d64c01accb10afc2ff20844e2d51bfa68e635 Signed-off-by: Stephen Finucane <[email protected]>
1 parent 1fdbe88 commit 00740b0

File tree

5 files changed

+6
-114
lines changed

5 files changed

+6
-114
lines changed

nova/tests/unit/virt/libvirt/test_compat.py

Lines changed: 0 additions & 66 deletions
This file was deleted.

nova/virt/libvirt/compat.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

nova/virt/libvirt/driver.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9273,8 +9273,7 @@ def get_instance_diagnostics(self, instance):
92739273
# TODO(sahid): Needs to use get_info but more changes have to
92749274
# be done since a mapping STATE_MAP LIBVIRT_POWER_STATE is
92759275
# needed.
9276-
(state, max_mem, mem, num_cpu, cpu_time) = \
9277-
guest._get_domain_info(self._host)
9276+
state, max_mem, mem, num_cpu, cpu_time = guest._get_domain_info()
92789277
config_drive = configdrive.required_by(instance)
92799278
launched_at = timeutils.normalize_time(instance.launched_at)
92809279
uptime = timeutils.delta_seconds(launched_at,

nova/virt/libvirt/guest.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
from nova.i18n import _
4343
import nova.privsep.libvirt
4444
from nova.virt import hardware
45-
from nova.virt.libvirt import compat
4645
from nova.virt.libvirt import config as vconfig
4746

4847
libvirt = None
@@ -513,16 +512,12 @@ def set_user_password(self, user, new_pass):
513512
"""Configures a new user password."""
514513
self._domain.setUserPassword(user, new_pass, 0)
515514

516-
def _get_domain_info(self, host):
517-
"""Returns information on Guest
518-
519-
:param host: a host.Host object with current
520-
connection. Unfortunately we need to pass it
521-
because of a workaround with < version 1.2..11
515+
def _get_domain_info(self):
516+
"""Returns information on Guest.
522517
523518
:returns list: [state, maxMem, memory, nrVirtCpu, cpuTime]
524519
"""
525-
return compat.get_domain_info(libvirt, host, self._domain)
520+
return self._domain.info()
526521

527522
def get_info(self, host):
528523
"""Retrieve information from libvirt for a specific instance name.
@@ -534,7 +529,7 @@ def get_info(self, host):
534529
:returns hardware.InstanceInfo:
535530
"""
536531
try:
537-
dom_info = self._get_domain_info(host)
532+
dom_info = self._get_domain_info()
538533
except libvirt.libvirtError as ex:
539534
error_code = ex.get_error_code()
540535
if error_code == libvirt.VIR_ERR_NO_DOMAIN:

nova/virt/libvirt/host.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ def _sum_domain_memory_mb(self, include_host=True):
909909
for guest in self.list_guests(only_guests=False):
910910
try:
911911
# TODO(sahid): Use get_info...
912-
dom_mem = int(guest._get_domain_info(self)[2])
912+
dom_mem = int(guest._get_domain_info()[2])
913913
except libvirt.libvirtError as e:
914914
LOG.warning("couldn't obtain the memory from domain:"
915915
" %(uuid)s, exception: %(ex)s",

0 commit comments

Comments
 (0)