Reproducer for not powering on isolated emulator threads cores

Related-bug: 2056612
Change-Id: Icd586cdd015143b2e113fd14904f40410809d247
This commit is contained in:
Artom Lifshitz 2024-02-23 10:19:44 -05:00
parent 8dbfecd663
commit 521af26209

View File

@ -61,6 +61,10 @@ class PowerManagementTestsBase(base.ServersTestBase):
}
self.pcpu_flavor_id = self._create_flavor(
vcpu=4, extra_spec=self.extra_spec)
self.isolate_flavor_id = self._create_flavor(
vcpu=4, extra_spec={'hw:cpu_policy': 'dedicated',
'hw:cpu_thread_policy': 'prefer',
'hw:emulator_threads_policy': 'isolate'})
def _assert_server_cpus_state(self, server, expected='online'):
inst = objects.Instance.get_by_uuid(self.ctxt, server['id'])
@ -130,6 +134,23 @@ class PowerManagementTests(PowerManagementTestsBase):
unused_cpus = cpu_dedicated_set - instance_pcpus
self._assert_cpu_set_state(unused_cpus, expected='offline')
def test_create_server_with_emulator_threads_isolate(self):
server = self._create_server(
flavor_id=self.isolate_flavor_id,
expected_state='ACTIVE')
# Let's verify that the pinned CPUs are now online
self._assert_server_cpus_state(server, expected='online')
instance = objects.Instance.get_by_uuid(self.ctxt, server['id'])
numa_topology = instance.numa_topology
# Make sure we've pinned the emulator threads to a separate core
self.assertTrue(numa_topology.cpuset_reserved)
self.assertTrue(
numa_topology.cpu_pinning.isdisjoint(
numa_topology.cpuset_reserved))
# FIXME(artom) We've not actually powered on the emulator threads core
self._assert_cpu_set_state(numa_topology.cpuset_reserved,
expected='offline')
def test_stop_start_server(self):
server = self._create_server(
flavor_id=self.pcpu_flavor_id,