Merge "libvirt: drop MIN_LIBVIRT_HUGEPAGE_VERSION"

This commit is contained in:
Jenkins 2017-04-25 13:04:01 +00:00 committed by Gerrit Code Review
commit 23923134c1
2 changed files with 13 additions and 66 deletions
nova
tests/unit/virt/libvirt
virt/libvirt

@ -2368,19 +2368,6 @@ class LibvirtConnTestCase(test.NoDBTestCase):
exception.NUMATopologyUnsupported,
None)
def test_get_guest_config_numa_old_pages_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_HUGEPAGE_VERSION) - 1,
versionutils.convert_version_to_int(
libvirt_driver.MIN_QEMU_VERSION),
host.HV_DRIVER_QEMU,
fields.Architecture.X86_64,
exception.MemoryPagesUnsupported,
2048)
@mock.patch.object(
host.Host, "is_cpu_control_policy_capable", return_value=True)
def test_get_guest_config_numa_host_instance_fit_w_cpu_pinset(
@ -2984,10 +2971,8 @@ class LibvirtConnTestCase(test.NoDBTestCase):
@mock.patch.object(libvirt_driver.LibvirtDriver, "_has_numa_support",
return_value=True)
@mock.patch.object(libvirt_driver.LibvirtDriver, "_has_hugepage_support",
return_value=True)
@mock.patch.object(host.Host, "get_capabilities")
def test_does_not_want_hugepages(self, mock_caps, mock_hp, mock_numa):
def test_does_not_want_hugepages(self, mock_caps, mock_numa):
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
instance_topology = objects.InstanceNUMATopology(
cells=[
@ -3016,20 +3001,16 @@ class LibvirtConnTestCase(test.NoDBTestCase):
@mock.patch.object(libvirt_driver.LibvirtDriver, "_has_numa_support",
return_value=True)
@mock.patch.object(libvirt_driver.LibvirtDriver, "_has_hugepage_support",
return_value=True)
@mock.patch.object(host.Host, "get_capabilities")
def test_does_want_hugepages(self, mock_caps, mock_hp, mock_numa):
def test_does_want_hugepages(self, mock_caps, mock_numa):
for arch in [fields.Architecture.I686,
fields.Architecture.X86_64,
fields.Architecture.AARCH64,
fields.Architecture.PPC64LE,
fields.Architecture.PPC64]:
self._test_does_want_hugepages(
mock_caps, mock_hp, mock_numa, arch)
self._test_does_want_hugepages(mock_caps, mock_numa, arch)
def _test_does_want_hugepages(self, mock_caps, mock_hp, mock_numa,
architecture):
def _test_does_want_hugepages(self, mock_caps, mock_numa, architecture):
self.flags(reserved_huge_pages=[
{'node': 0, 'size': 2048, 'count': 128},
{'node': 1, 'size': 2048, 'count': 1},
@ -12903,19 +12884,6 @@ class LibvirtConnTestCase(test.NoDBTestCase):
def test_get_host_numa_topology(self, mock_version):
self._test_get_host_numa_topology(mempages=True)
@mock.patch.object(fakelibvirt.Connection, 'getType')
@mock.patch.object(fakelibvirt.Connection, 'getVersion')
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion')
def test_get_host_numa_topology_no_mempages(self, mock_lib_version,
mock_version, mock_type):
self.flags(virt_type='kvm', group='libvirt')
mock_lib_version.return_value = versionutils.convert_version_to_int(
libvirt_driver.MIN_LIBVIRT_HUGEPAGE_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._test_get_host_numa_topology(mempages=False)
def test_get_host_numa_topology_empty(self):
caps = vconfig.LibvirtConfigCaps()
caps.host = vconfig.LibvirtConfigCapsHost()

@ -217,12 +217,6 @@ 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)]
# While earlier versions could support hugepage backed
# guests, not until 1.2.8 was there the ability to request
# a particular huge page size. Without this the scheduler
# cannot make guaranteed decisions, as the huge page size
# used by the guest may not match what was requested
MIN_LIBVIRT_HUGEPAGE_VERSION = (1, 2, 8)
# Versions of libvirt with broken cpu pinning support. This excludes
# versions of libvirt with broken NUMA support since pinning needs
# NUMA
@ -4290,7 +4284,7 @@ class LibvirtDriver(driver.ComputeDriver):
return membacking
def _get_memory_backing_hugepages_support(self, inst_topology, numatune):
if not self._has_hugepage_support():
if not self._has_numa_support():
# We should not get here, since we should have avoided
# reporting NUMA topology from _get_host_numa_topology
# in the first place. Just in case of a scheduler
@ -5430,19 +5424,6 @@ class LibvirtDriver(driver.ComputeDriver):
return False
def _has_hugepage_support(self):
# This means that the host can support multiple values for the size
# field in LibvirtConfigGuestMemoryBackingPage
supported_archs = [fields.Architecture.I686,
fields.Architecture.X86_64,
fields.Architecture.AARCH64,
fields.Architecture.PPC64LE,
fields.Architecture.PPC64]
caps = self._host.get_capabilities()
return ((caps.host.cpu.arch in supported_archs) and
self._host.has_min_version(MIN_LIBVIRT_HUGEPAGE_VERSION,
hv_type=host.HV_DRIVER_QEMU))
def _get_host_numa_topology(self):
if not self._has_numa_support():
return
@ -5477,16 +5458,14 @@ class LibvirtDriver(driver.ComputeDriver):
# Filter out singles and empty sibling sets that may be left
siblings = [sib for sib in siblings if len(sib) > 1]
mempages = []
if self._has_hugepage_support():
mempages = [
objects.NUMAPagesTopology(
size_kb=pages.size,
total=pages.total,
used=0,
reserved=_get_reserved_memory_for_cell(
self, cell.id, pages.size))
for pages in cell.mempages]
mempages = [
objects.NUMAPagesTopology(
size_kb=pages.size,
total=pages.total,
used=0,
reserved=_get_reserved_memory_for_cell(
self, cell.id, pages.size))
for pages in cell.mempages]
cell = objects.NUMACell(id=cell.id, cpuset=cpuset,
memory=cell.memory / units.Ki,