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

View File

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

View File

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

View File

@ -506,13 +506,6 @@ class HostInfo(object):
self.numa_topology = numa_topology
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:
topology = NUMATopology(self.cpu_nodes, self.cpu_sockets,
self.cpu_cores, self.cpu_threads,