Skip to content

Commit 5f994a1

Browse files
SeanMooneystephenfin
authored andcommitted
Test numa and vcpu topologies bug: #1910466
This change reproduces bug #1910466 When hw:cpu_max_[sockets|cores|threads] is configured in addition to an explict numa topologies and cpu pinning nova is currently incapable of generating the correct virtual CPU topology resulting in an index out of range error as we attempt to retrieve the first topology from an empty list. This change reproduces the error via a new functional test. Related-Bug: #1910466 Change-Id: I333b3d85deed971678141307dd06545e308cf989 (cherry picked from commit fe25fa1)
1 parent 97c3517 commit 5f994a1

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

nova/tests/functional/libvirt/test_numa_servers.py

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ def test_create_server_with_numa_topology(self):
104104
nodes.
105105
"""
106106

107-
host_info = fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
108-
cpu_cores=2, cpu_threads=2)
107+
host_info = fakelibvirt.HostInfo(
108+
cpu_nodes=2, cpu_sockets=1, cpu_cores=2, cpu_threads=2)
109109
self.start_compute(host_info=host_info, hostname='compute1')
110110

111111
extra_spec = {'hw:numa_nodes': '2'}
@@ -120,6 +120,41 @@ def test_create_server_with_numa_topology(self):
120120
self.assertNotIn('cpu_topology', inst.numa_topology.cells[0])
121121
self.assertNotIn('cpu_topology', inst.numa_topology.cells[1])
122122

123+
def test_create_server_with_numa_topology_and_cpu_topology_and_pinning(
124+
self):
125+
"""Create a server with two NUMA nodes.
126+
127+
This should pass and result in a guest NUMA topology with two NUMA
128+
nodes, pinned cpus and numa affined memory.
129+
"""
130+
131+
host_info = fakelibvirt.HostInfo(
132+
cpu_nodes=2, cpu_sockets=1, cpu_cores=4, cpu_threads=1,
133+
kB_mem=(1024 * 1024 * 16)) # 16 GB
134+
self.start_compute(host_info=host_info, hostname='compute1')
135+
136+
extra_spec = {
137+
'hw:numa_nodes': '2',
138+
'hw:cpu_max_sockets': '2',
139+
'hw:cpu_max_cores': '2',
140+
'hw:cpu_max_threads': '8',
141+
'hw:cpu_policy': 'dedicated',
142+
'hw:mem_page_size': 'any'
143+
}
144+
flavor_id = self._create_flavor(vcpu=8, extra_spec=extra_spec)
145+
self._run_build_test(flavor_id, end_status='ERROR')
146+
147+
# FIXME(sean-k-mooney): The instance should boot but
148+
# it fails due to https://bugs.launchpad.net/nova/+bug/1910466
149+
msg = "IndexError: list index out of range"
150+
self.assertIn(msg, self.stdlog.logger.output)
151+
# ctx = nova_context.get_admin_context()
152+
# inst = objects.Instance.get_by_uuid(ctx, server['id'])
153+
# self.assertEqual(2, len(inst.numa_topology.cells))
154+
# self.assertLessEqual(inst.vcpu_model.topology.sockets, 2)
155+
# self.assertLessEqual(inst.vcpu_model.topology.cores, 2)
156+
# self.assertLessEqual(inst.vcpu_model.topology.threads, 8)
157+
123158
def test_create_server_with_numa_fails(self):
124159
"""Create a two NUMA node instance on a host with only one node.
125160

0 commit comments

Comments
 (0)