From abc24acfa1982a0ffccbe08a006ac7c7a9f4ecda Mon Sep 17 00:00:00 2001 From: Breno Leitao Date: Fri, 26 Aug 2016 18:36:00 -0300 Subject: [PATCH] libvirt: add hugepages support for Power Power architectures (arch.PPC64LE and arch.PPC64) support huge pages and transparent huge pages. This patch just enables it on nova libvirt driver. A reno note was also added to track this new feature. This change also enables the test_does_want_hugepages unit test to run on the architectures that support huge pages. Closes-bug: #1617081 Change-Id: I22bc57a0b244667c716a54ca37c175f26a87a1e9 --- nova/tests/unit/virt/libvirt/test_driver.py | 8 +++++++- nova/virt/libvirt/driver.py | 2 +- ...libvirt_ppc64le_hugepage_support-b9fd39cf20c8e91d.yaml | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/libvirt_ppc64le_hugepage_support-b9fd39cf20c8e91d.yaml diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index aed6404c6256..648a94240034 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -2909,6 +2909,12 @@ class LibvirtConnTestCase(test.NoDBTestCase): return_value=True) @mock.patch.object(host.Host, "get_capabilities") def test_does_want_hugepages(self, mock_caps, mock_hp, mock_numa): + for each_arch in [arch.I686, arch.X86_64, arch.PPC64LE, arch.PPC64]: + self._test_does_want_hugepages( + mock_caps, mock_hp, mock_numa, each_arch) + + def _test_does_want_hugepages(self, mock_caps, mock_hp, mock_numa, + architecture): self.flags(reserved_huge_pages=[ {'node': 0, 'size': 2048, 'count': 128}, {'node': 1, 'size': 2048, 'count': 1}, @@ -2926,7 +2932,7 @@ class LibvirtConnTestCase(test.NoDBTestCase): caps = vconfig.LibvirtConfigCaps() caps.host = vconfig.LibvirtConfigCapsHost() caps.host.cpu = vconfig.LibvirtConfigCPU() - caps.host.cpu.arch = "x86_64" + caps.host.cpu.arch = architecture caps.host.topology = self._fake_caps_numa_topology() mock_caps.return_value = caps diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 2daaabe878d4..53c3292993b5 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -5113,7 +5113,7 @@ class LibvirtDriver(driver.ComputeDriver): def _has_hugepage_support(self): # This means that the host can support multiple values for the size # field in LibvirtConfigGuestMemoryBackingPage - supported_archs = [arch.I686, arch.X86_64] + supported_archs = [arch.I686, arch.X86_64, arch.PPC64LE, arch.PPC64] caps = self._host.get_capabilities() return ((caps.host.cpu.arch in supported_archs) and self._host.has_min_version(MIN_LIBVIRT_HUGEPAGE_VERSION, diff --git a/releasenotes/notes/libvirt_ppc64le_hugepage_support-b9fd39cf20c8e91d.yaml b/releasenotes/notes/libvirt_ppc64le_hugepage_support-b9fd39cf20c8e91d.yaml new file mode 100644 index 000000000000..fb84d83f7d6c --- /dev/null +++ b/releasenotes/notes/libvirt_ppc64le_hugepage_support-b9fd39cf20c8e91d.yaml @@ -0,0 +1,3 @@ +--- +features: + - Added hugepage support for POWER architectures.