Skip to content

Commit 088addf

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Fix max cpu topologies with numa affinity" into stable/wallaby
2 parents bbaa68a + c9826ca commit 088addf

File tree

6 files changed

+59
-306
lines changed

6 files changed

+59
-306
lines changed

nova/objects/instance_numa.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ def obj_make_compatible(self, primitive, target_version):
7979
'memory': obj_fields.IntegerField(),
8080
'pagesize': obj_fields.IntegerField(nullable=True,
8181
default=None),
82+
# TODO(sean-k-mooney): This is no longer used and should be
83+
# removed in v2
8284
'cpu_topology': obj_fields.ObjectField('VirtCPUTopology',
8385
nullable=True),
8486
'cpu_pinning_raw': obj_fields.DictOfIntegersField(nullable=True,

nova/tests/functional/libvirt/test_numa_servers.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -138,22 +138,16 @@ def test_create_server_with_numa_topology_and_cpu_topology_and_pinning(
138138
'hw:cpu_max_sockets': '2',
139139
'hw:cpu_max_cores': '2',
140140
'hw:cpu_max_threads': '8',
141-
'hw:cpu_policy': 'dedicated',
142-
'hw:mem_page_size': 'any'
143-
}
141+
'hw:cpu_policy': 'dedicated'}
144142
flavor_id = self._create_flavor(vcpu=8, extra_spec=extra_spec)
145-
self._run_build_test(flavor_id, end_status='ERROR')
143+
server = self._run_build_test(flavor_id)
146144

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)
145+
ctx = nova_context.get_admin_context()
146+
inst = objects.Instance.get_by_uuid(ctx, server['id'])
147+
self.assertEqual(2, len(inst.numa_topology.cells))
148+
self.assertLessEqual(inst.vcpu_model.topology.sockets, 2)
149+
self.assertLessEqual(inst.vcpu_model.topology.cores, 2)
150+
self.assertLessEqual(inst.vcpu_model.topology.threads, 8)
157151

158152
def test_create_server_with_numa_fails(self):
159153
"""Create a two NUMA node instance on a host with only one node.
@@ -252,7 +246,7 @@ def test_create_server_with_dedicated_policy(self):
252246

253247
inst = objects.Instance.get_by_uuid(self.ctxt, server['id'])
254248
self.assertEqual(1, len(inst.numa_topology.cells))
255-
self.assertEqual(5, inst.numa_topology.cells[0].cpu_topology.cores)
249+
self.assertEqual(5, inst.vcpu_model.topology.sockets)
256250

257251
def test_create_server_with_mixed_policy(self):
258252
"""Create a server using the 'hw:cpu_policy=mixed' extra spec.
@@ -302,7 +296,6 @@ def test_create_server_with_mixed_policy(self):
302296
# sanity check the instance topology
303297
inst = objects.Instance.get_by_uuid(self.ctxt, server['id'])
304298
self.assertEqual(1, len(inst.numa_topology.cells))
305-
self.assertEqual(4, inst.numa_topology.cells[0].cpu_topology.cores)
306299
self.assertEqual({0}, inst.numa_topology.cells[0].cpuset)
307300
self.assertEqual({1, 2, 3}, inst.numa_topology.cells[0].pcpuset)
308301
self.assertEqual(
@@ -511,8 +504,6 @@ def test_create_server_with_pcpu(self):
511504
ctx = nova_context.get_admin_context()
512505
inst = objects.Instance.get_by_uuid(ctx, server['id'])
513506
self.assertEqual(1, len(inst.numa_topology.cells))
514-
self.assertEqual(1, inst.numa_topology.cells[0].cpu_topology.cores)
515-
self.assertEqual(2, inst.numa_topology.cells[0].cpu_topology.threads)
516507

517508
def test_create_server_with_pcpu_fails(self):
518509
"""Create a pinned instance on a host with no PCPUs.

0 commit comments

Comments
 (0)