Merge "Make PCI claim NUMA aware during live migration"

This commit is contained in:
Zuul 2021-01-20 17:53:50 +00:00 committed by Gerrit Code Review
commit 9b7247deb0
3 changed files with 15 additions and 6 deletions

View File

@ -10541,9 +10541,15 @@ class ComputeManager(manager.Manager):
requests=pci_reqs, requests=pci_reqs,
instance_uuid=instance.uuid) instance_uuid=instance.uuid)
# if we are called during the live migration with NUMA topology
# support the PCI claim needs to consider the destination NUMA
# topology that is then stored in the migration_context
dest_topo = None
if instance.migration_context:
dest_topo = instance.migration_context.new_numa_topology
claimed_pci_devices_objs = self.rt.claim_pci_devices( claimed_pci_devices_objs = self.rt.claim_pci_devices(
ctxt, ctxt, vif_pci_requests, dest_topo)
vif_pci_requests)
# Update VIFMigrateData profile with the newly claimed PCI # Update VIFMigrateData profile with the newly claimed PCI
# device # device

View File

@ -1873,9 +1873,7 @@ class ResourceTracker(object):
self.stats[nodename].build_succeeded() self.stats[nodename].build_succeeded()
@utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, fair=True) @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, fair=True)
def claim_pci_devices( def claim_pci_devices(self, context, pci_requests, instance_numa_topology):
self, context, pci_requests, instance_numa_topology=None
):
"""Claim instance PCI resources """Claim instance PCI resources
:param context: security context :param context: security context

View File

@ -10711,6 +10711,8 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase,
get_pci_req_side_effect get_pci_req_side_effect
self.instance.pci_devices = instance_pci_devs self.instance.pci_devices = instance_pci_devs
self.instance.pci_requests = instance_pci_reqs self.instance.pci_requests = instance_pci_reqs
self.instance.migration_context = objects.MigrationContext(
new_numa_topology=objects.InstanceNUMATopology())
rt_mock.reset() rt_mock.reset()
claimed_pci_dev = objects.PciDevice(request_id=uuids.pci_req, claimed_pci_dev = objects.PciDevice(request_id=uuids.pci_req,
@ -10725,7 +10727,10 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase,
self.instance) self.instance)
self.assertEqual(len(nw_vifs), self.assertEqual(len(nw_vifs),
mock_get_instance_pci_request_from_vif.call_count) mock_get_instance_pci_request_from_vif.call_count)
self.assertTrue(rt_mock.claim_pci_devices.called)
rt_mock.claim_pci_devices.assert_called_once_with(
self.context, test.MatchType(objects.InstancePCIRequests),
self.instance.migration_context.new_numa_topology)
self.assertEqual(len(port_id_to_pci), 1) self.assertEqual(len(port_id_to_pci), 1)
_test() _test()