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
This commit is contained in:
Breno Leitao 2016-08-26 18:36:00 -03:00
parent a5cc0be5c6
commit abc24acfa1
3 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -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,

View File

@ -0,0 +1,3 @@
---
features:
- Added hugepage support for POWER architectures.