Skip to content

Commit

Permalink
libvirt: add hugepages support for Power
Browse files Browse the repository at this point in the history
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
  • Loading branch information
leitao committed Sep 2, 2016
1 parent a5cc0be commit abc24ac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion nova/tests/unit/virt/libvirt/test_driver.py
Expand Up @@ -2909,6 +2909,12 @@ def test_does_not_want_hugepages(self, mock_caps, mock_hp, mock_numa):
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},
Expand All @@ -2926,7 +2932,7 @@ def test_does_want_hugepages(self, mock_caps, mock_hp, mock_numa):
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
Expand Down
2 changes: 1 addition & 1 deletion nova/virt/libvirt/driver.py
Expand Up @@ -5113,7 +5113,7 @@ def _has_numa_support(self):
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,
Expand Down
@@ -0,0 +1,3 @@
---
features:
- Added hugepage support for POWER architectures.

0 comments on commit abc24ac

Please sign in to comment.