Merge "libvirt: drop MIN_LIBVIRT_NUMA_VERSION"

This commit is contained in:
Jenkins 2017-04-25 13:03:33 +00:00 committed by Gerrit Code Review
commit 5822a29b87
2 changed files with 16 additions and 50 deletions
nova
tests/unit/virt/libvirt
virt/libvirt

@ -2304,19 +2304,6 @@ class LibvirtConnTestCase(test.NoDBTestCase):
instance_ref, [],
image_meta, disk_info)
def test_get_guest_config_numa_old_version_libvirt(self):
self.flags(virt_type='kvm', group='libvirt')
self._test_get_guest_config_numa_unsupported(
versionutils.convert_version_to_int(
libvirt_driver.MIN_LIBVIRT_NUMA_VERSION) - 1,
versionutils.convert_version_to_int(
libvirt_driver.MIN_QEMU_VERSION),
host.HV_DRIVER_QEMU,
fields.Architecture.X86_64,
exception.NUMATopologyUnsupported,
None)
def test_get_guest_config_numa_old_version_libvirt_ppc(self):
self.flags(virt_type='kvm', group='libvirt')
@ -2362,7 +2349,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
self._test_get_guest_config_numa_unsupported(
versionutils.convert_version_to_int(
libvirt_driver.MIN_LIBVIRT_NUMA_VERSION),
libvirt_driver.MIN_LIBVIRT_VERSION),
versionutils.convert_version_to_int(
libvirt_driver.MIN_QEMU_VERSION),
host.HV_DRIVER_QEMU,
@ -2374,7 +2361,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
self.flags(virt_type='xen', group='libvirt')
self._test_get_guest_config_numa_unsupported(
versionutils.convert_version_to_int(
libvirt_driver.MIN_LIBVIRT_NUMA_VERSION),
libvirt_driver.MIN_LIBVIRT_VERSION),
versionutils.convert_version_to_int((4, 5, 0)),
'XEN',
fields.Architecture.X86_64,
@ -12945,21 +12932,6 @@ class LibvirtConnTestCase(test.NoDBTestCase):
self.assertIsNone(drvr._get_host_numa_topology())
self.assertEqual(2, get_caps.call_count)
@mock.patch.object(fakelibvirt.Connection, 'getType')
@mock.patch.object(fakelibvirt.Connection, 'getVersion')
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion')
def test_get_host_numa_topology_old_version(self, mock_lib_version,
mock_version, mock_type):
self.flags(virt_type='kvm', group='libvirt')
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
mock_lib_version.return_value = versionutils.convert_version_to_int(
libvirt_driver.MIN_LIBVIRT_NUMA_VERSION) - 1
mock_version.return_value = versionutils.convert_version_to_int(
libvirt_driver.MIN_QEMU_VERSION)
mock_type.return_value = host.HV_DRIVER_QEMU
self.assertIsNone(drvr._get_host_numa_topology())
@mock.patch.object(fakelibvirt.Connection, 'getType')
@mock.patch.object(fakelibvirt.Connection, 'getVersion')
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion')
@ -12969,7 +12941,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
mock_lib_version.return_value = versionutils.convert_version_to_int(
libvirt_driver.MIN_LIBVIRT_NUMA_VERSION)
libvirt_driver.MIN_LIBVIRT_VERSION)
mock_version.return_value = versionutils.convert_version_to_int(
libvirt_driver.MIN_QEMU_VERSION)
mock_type.return_value = host.HV_DRIVER_XEN

@ -212,12 +212,6 @@ NEXT_MIN_QEMU_VERSION = (2, 5, 0)
# Libvirt version 1.2.17 is required for successful block live migration
# of vm booted from image with attached devices
MIN_LIBVIRT_BLOCK_LM_WITH_VOLUMES_VERSION = (1, 2, 17)
# While earlier versions could support NUMA reporting and
# NUMA placement, not until 1.2.7 was there the ability
# to pin guest nodes to host nodes, so mandate that. Without
# this the scheduler cannot make guaranteed decisions, as the
# guest placement may not match what was requested
MIN_LIBVIRT_NUMA_VERSION = (1, 2, 7)
# PowerPC based hosts that support NUMA using libvirt
MIN_LIBVIRT_NUMA_VERSION_PPC = (1, 2, 19)
# Versions of libvirt with known NUMA topology issues
@ -5421,20 +5415,20 @@ class LibvirtDriver(driver.ComputeDriver):
self._bad_libvirt_numa_version_warn = True
return False
support_matrix = {
(fields.Architecture.I686,
fields.Architecture.X86_64,
fields.Architecture.AARCH64): MIN_LIBVIRT_NUMA_VERSION,
(fields.Architecture.PPC64,
fields.Architecture.PPC64LE): MIN_LIBVIRT_NUMA_VERSION_PPC}
caps = self._host.get_capabilities()
is_supported = False
for archs, libvirt_ver in support_matrix.items():
if ((caps.host.cpu.arch in archs) and
self._host.has_min_version(libvirt_ver,
hv_type=host.HV_DRIVER_QEMU)):
is_supported = True
return is_supported
if (caps.host.cpu.arch in (fields.Architecture.I686,
fields.Architecture.X86_64,
fields.Architecture.AARCH64) and
self._host.has_min_version(hv_type=host.HV_DRIVER_QEMU)):
return True
elif (caps.host.cpu.arch in (fields.Architecture.PPC64,
fields.Architecture.PPC64LE) and
self._host.has_min_version(MIN_LIBVIRT_NUMA_VERSION_PPC,
hv_type=host.HV_DRIVER_QEMU)):
return True
return False
def _has_hugepage_support(self):
# This means that the host can support multiple values for the size