fakelibvirt: Stop distinguishing between NUMA, non-NUMA

Since at least 3.0.0, our current minimum version, libvirt has reported
a NUMA topology for all hosts, even those with non-NUMA (i.e. UMA)
architectures [1]. This means we can rely on things like the
''/capabilities/host/topology' element being present in the output of
'virConnectGetCapabilities'.

Since libvirt itself no longer distinguishes between the different
architectures, there's no reason our tests should either. Stop doing so.

[1] https://github.com/libvirt/libvirt/blob/v3.0.0/src/nodeinfo.c#L352-L355

Change-Id: Ifcda7336d56c9b623720ee018ec5697740986273
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2019-08-09 10:16:45 +01:00
parent 45107fce8d
commit c619c3b584
4 changed files with 47 additions and 54 deletions

View File

@ -92,7 +92,7 @@ class NUMAServersTest(NUMAServersTestBase):
def test_create_server_with_numa_topology(self): def test_create_server_with_numa_topology(self):
host_info = fakelibvirt.NUMAHostInfo(cpu_nodes=2, cpu_sockets=1, host_info = fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
cpu_cores=2, cpu_threads=2, cpu_cores=2, cpu_threads=2,
kB_mem=15740000) kB_mem=15740000)
fake_connection = self._get_connection(host_info=host_info) fake_connection = self._get_connection(host_info=host_info)
@ -106,7 +106,7 @@ class NUMAServersTest(NUMAServersTestBase):
def test_create_server_with_pinning(self): def test_create_server_with_pinning(self):
host_info = fakelibvirt.NUMAHostInfo(cpu_nodes=1, cpu_sockets=1, host_info = fakelibvirt.HostInfo(cpu_nodes=1, cpu_sockets=1,
cpu_cores=5, cpu_threads=2, cpu_cores=5, cpu_threads=2,
kB_mem=15740000) kB_mem=15740000)
fake_connection = self._get_connection(host_info=host_info) fake_connection = self._get_connection(host_info=host_info)
@ -128,7 +128,7 @@ class NUMAServersTest(NUMAServersTestBase):
def test_create_server_with_numa_fails(self): def test_create_server_with_numa_fails(self):
host_info = fakelibvirt.NUMAHostInfo(cpu_nodes=1, cpu_sockets=1, host_info = fakelibvirt.HostInfo(cpu_nodes=1, cpu_sockets=1,
cpu_cores=2, kB_mem=15740000) cpu_cores=2, kB_mem=15740000)
fake_connection = self._get_connection(host_info=host_info) fake_connection = self._get_connection(host_info=host_info)
self.mock_conn.return_value = fake_connection self.mock_conn.return_value = fake_connection
@ -159,7 +159,7 @@ class NUMAServersWithNetworksTest(NUMAServersTestBase):
self.neutron = self.useFixture(base.LibvirtNeutronFixture(self)) self.neutron = self.useFixture(base.LibvirtNeutronFixture(self))
def _test_create_server_with_networks(self, flavor_id, networks): def _test_create_server_with_networks(self, flavor_id, networks):
host_info = fakelibvirt.NUMAHostInfo(cpu_nodes=2, cpu_sockets=1, host_info = fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
cpu_cores=2, cpu_threads=2, cpu_cores=2, cpu_threads=2,
kB_mem=15740000) kB_mem=15740000)
fake_connection = self._get_connection(host_info=host_info) fake_connection = self._get_connection(host_info=host_info)
@ -300,7 +300,7 @@ class NUMAServersWithNetworksTest(NUMAServersTestBase):
self.assertIn('NoValidHost', six.text_type(ex)) self.assertIn('NoValidHost', six.text_type(ex))
def test_cold_migrate_with_physnet(self): def test_cold_migrate_with_physnet(self):
host_info = fakelibvirt.NUMAHostInfo(cpu_nodes=2, cpu_sockets=1, host_info = fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
cpu_cores=2, cpu_threads=2, cpu_cores=2, cpu_threads=2,
kB_mem=15740000) kB_mem=15740000)
@ -366,12 +366,12 @@ class NUMAServersWithNetworksTest(NUMAServersTestBase):
def test_cold_migrate_with_physnet_fails(self): def test_cold_migrate_with_physnet_fails(self):
host_infos = [ host_infos = [
# host 1 has room on both nodes # host 1 has room on both nodes
fakelibvirt.NUMAHostInfo(cpu_nodes=2, cpu_sockets=1, fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
cpu_cores=2, cpu_threads=2, cpu_cores=2, cpu_threads=2,
kB_mem=15740000), kB_mem=15740000),
# host 2 has no second node, where the desired physnet is # host 2 has no second node, where the desired physnet is
# reported to be attached # reported to be attached
fakelibvirt.NUMAHostInfo(cpu_nodes=1, cpu_sockets=1, fakelibvirt.HostInfo(cpu_nodes=1, cpu_sockets=1,
cpu_cores=1, cpu_threads=1, cpu_cores=1, cpu_threads=1,
kB_mem=15740000), kB_mem=15740000),
] ]

View File

@ -128,7 +128,7 @@ class SRIOVServersTest(_PCIServersTestBase):
def test_create_server_with_VF(self): def test_create_server_with_VF(self):
host_info = fakelibvirt.NUMAHostInfo(cpu_nodes=2, cpu_sockets=1, host_info = fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
cpu_cores=2, cpu_threads=2, cpu_cores=2, cpu_threads=2,
kB_mem=15740000) kB_mem=15740000)
pci_info = fakelibvirt.HostPCIDevicesInfo() pci_info = fakelibvirt.HostPCIDevicesInfo()
@ -143,7 +143,7 @@ class SRIOVServersTest(_PCIServersTestBase):
def test_create_server_with_PF(self): def test_create_server_with_PF(self):
host_info = fakelibvirt.NUMAHostInfo(cpu_nodes=2, cpu_sockets=1, host_info = fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
cpu_cores=2, cpu_threads=2, cpu_cores=2, cpu_threads=2,
kB_mem=15740000) kB_mem=15740000)
pci_info = fakelibvirt.HostPCIDevicesInfo() pci_info = fakelibvirt.HostPCIDevicesInfo()
@ -158,7 +158,7 @@ class SRIOVServersTest(_PCIServersTestBase):
def test_create_server_with_PF_no_VF(self): def test_create_server_with_PF_no_VF(self):
host_info = fakelibvirt.NUMAHostInfo(cpu_nodes=2, cpu_sockets=1, host_info = fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
cpu_cores=2, cpu_threads=2, cpu_cores=2, cpu_threads=2,
kB_mem=15740000) kB_mem=15740000)
pci_info = fakelibvirt.HostPCIDevicesInfo(num_pfs=1, num_vfs=4) pci_info = fakelibvirt.HostPCIDevicesInfo(num_pfs=1, num_vfs=4)
@ -178,7 +178,7 @@ class SRIOVServersTest(_PCIServersTestBase):
def test_create_server_with_VF_no_PF(self): def test_create_server_with_VF_no_PF(self):
host_info = fakelibvirt.NUMAHostInfo(cpu_nodes=2, cpu_sockets=1, host_info = fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
cpu_cores=2, cpu_threads=2, cpu_cores=2, cpu_threads=2,
kB_mem=15740000) kB_mem=15740000)
pci_info = fakelibvirt.HostPCIDevicesInfo(num_pfs=1, num_vfs=4) pci_info = fakelibvirt.HostPCIDevicesInfo(num_pfs=1, num_vfs=4)
@ -231,7 +231,7 @@ class GetServerDiagnosticsServerWithVfTestV21(_PCIServersTestBase):
def test_get_server_diagnostics_server_with_VF(self): def test_get_server_diagnostics_server_with_VF(self):
host_info = fakelibvirt.NUMAHostInfo(cpu_nodes=2, cpu_sockets=1, host_info = fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
cpu_cores=2, cpu_threads=2, cpu_cores=2, cpu_threads=2,
kB_mem=15740000) kB_mem=15740000)
pci_info = fakelibvirt.HostPCIDevicesInfo() pci_info = fakelibvirt.HostPCIDevicesInfo()
@ -295,7 +295,7 @@ class PCIServersTest(_PCIServersTestBase):
assigned pci device. assigned pci device.
""" """
host_info = fakelibvirt.NUMAHostInfo(cpu_nodes=2, cpu_sockets=1, host_info = fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
cpu_cores=2, cpu_threads=2, cpu_cores=2, cpu_threads=2,
kB_mem=15740000) kB_mem=15740000)
pci_info = fakelibvirt.HostPCIDevicesInfo(num_pci=1, numa_node=1) pci_info = fakelibvirt.HostPCIDevicesInfo(num_pci=1, numa_node=1)
@ -316,7 +316,7 @@ class PCIServersTest(_PCIServersTestBase):
memory resources from one NUMA node and a PCI device from another. memory resources from one NUMA node and a PCI device from another.
""" """
host_info = fakelibvirt.NUMAHostInfo(cpu_nodes=2, cpu_sockets=1, host_info = fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
cpu_cores=2, cpu_threads=2, cpu_cores=2, cpu_threads=2,
kB_mem=15740000) kB_mem=15740000)
pci_info = fakelibvirt.HostPCIDevicesInfo(num_pci=1, numa_node=0) pci_info = fakelibvirt.HostPCIDevicesInfo(num_pci=1, numa_node=0)
@ -365,7 +365,7 @@ class PCIServersWithNUMAPoliciesTest(_PCIServersTestBase):
NUMA policies are in use. NUMA policies are in use.
""" """
host_info = fakelibvirt.NUMAHostInfo(cpu_nodes=2, cpu_sockets=1, host_info = fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
cpu_cores=2, cpu_threads=2, cpu_cores=2, cpu_threads=2,
kB_mem=15740000) kB_mem=15740000)
pci_info = fakelibvirt.HostPCIDevicesInfo(num_pci=1, numa_node=0) pci_info = fakelibvirt.HostPCIDevicesInfo(num_pci=1, numa_node=0)

View File

@ -44,7 +44,7 @@ class RealTimeServersTest(base.ServersTestBase):
self.api.post_server, {'server': server}) self.api.post_server, {'server': server})
def test_success(self): def test_success(self):
host_info = fakelibvirt.NUMAHostInfo(cpu_nodes=2, cpu_sockets=1, host_info = fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
cpu_cores=2, cpu_threads=2, cpu_cores=2, cpu_threads=2,
kB_mem=15740000) kB_mem=15740000)
fake_connection = self._get_connection(host_info=host_info) fake_connection = self._get_connection(host_info=host_info)

View File

@ -506,13 +506,6 @@ class HostInfo(object):
self.numa_topology = numa_topology self.numa_topology = numa_topology
self.disabled_cpus_list = cpu_disabled or [] self.disabled_cpus_list = cpu_disabled or []
class NUMAHostInfo(HostInfo):
"""A NUMA-by-default variant of HostInfo."""
def __init__(self, **kwargs):
super(NUMAHostInfo, self).__init__(**kwargs)
if not self.numa_topology: if not self.numa_topology:
topology = NUMATopology(self.cpu_nodes, self.cpu_sockets, topology = NUMATopology(self.cpu_nodes, self.cpu_sockets,
self.cpu_cores, self.cpu_threads, self.cpu_cores, self.cpu_threads,