diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index 48493ef5e1ff..6b3aaaba3ba7 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -1584,6 +1584,19 @@ class LibvirtConnTestCase(test.NoDBTestCase): exception.NUMATopologyUnsupported, None) + def test_get_guest_config_numa_old_version_libvirt_ppc(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_PPC) - 1, + versionutils.convert_version_to_int( + libvirt_driver.MIN_QEMU_NUMA_HUGEPAGE_VERSION), + host.HV_DRIVER_QEMU, + arch.PPC64LE, + exception.NUMATopologyUnsupported, + None) + def test_get_guest_config_numa_bad_version_libvirt(self): self.flags(virt_type='kvm', group='libvirt') @@ -1633,13 +1646,12 @@ class LibvirtConnTestCase(test.NoDBTestCase): versionutils.convert_version_to_int( libvirt_driver.MIN_QEMU_NUMA_HUGEPAGE_VERSION), host.HV_DRIVER_QEMU, - arch.PPC64, + arch.S390, exception.NUMATopologyUnsupported, None) def test_get_guest_config_numa_xen(self): 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), diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index d551cf242e02..e184cda64bcf 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -381,6 +381,8 @@ MIN_QEMU_DISCARD_VERSION = (1, 6, 0) # 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 # See bug #1449028 BAD_LIBVIRT_NUMA_VERSIONS = [(1, 2, 9, 2)] @@ -4912,13 +4914,18 @@ class LibvirtDriver(driver.ComputeDriver): self._bad_libvirt_numa_version_warn = True return False - supported_archs = [arch.I686, arch.X86_64] + support_matrix = {(arch.I686, arch.X86_64): MIN_LIBVIRT_NUMA_VERSION, + (arch.PPC64, + arch.PPC64LE): MIN_LIBVIRT_NUMA_VERSION_PPC} caps = self._host.get_capabilities() - - return ((caps.host.cpu.arch in supported_archs) and - self._host.has_min_version(MIN_LIBVIRT_NUMA_VERSION, - MIN_QEMU_NUMA_HUGEPAGE_VERSION, - host.HV_DRIVER_QEMU)) + 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, + MIN_QEMU_NUMA_HUGEPAGE_VERSION, + host.HV_DRIVER_QEMU)): + is_supported = True + return is_supported def _has_hugepage_support(self): # This means that the host can support multiple values for the size diff --git a/releasenotes/notes/1516578-628b417b372f4f0f.yaml b/releasenotes/notes/1516578-628b417b372f4f0f.yaml new file mode 100644 index 000000000000..0568cef6de34 --- /dev/null +++ b/releasenotes/notes/1516578-628b417b372f4f0f.yaml @@ -0,0 +1,14 @@ +--- +features: + - | + Enables NUMA topology reporting on PowerPC architecture + from the libvirt driver in Nova but with a caveat as mentioned below. + NUMA cell affinity and dedicated cpu pinning + code assumes that the host operating system is exposed to threads. + PowerPC based hosts use core based scheduling for processes. + Due to this, the cores on the PowerPC architecture are treated as + threads. Since cores are always less than or equal + to the threads on a system, this leads to non-optimal resource usage + while pinning. This feature is supported from libvirt version 1.2.19 + for PowerPC. +