Make PCI claim NUMA aware during live migration

NUMA aware live migration and SRIOV live migration was implemented as
two separate feature. As a consequence the case when both SRIOV and NUMA
is present in the instance was missed. When the PCI device is claimed on
the destination host the NUMA topology of the instance needs to be
passed to the claim call.

Change-Id: If469762b22d687151198468f0291821cebdf26b2
Closes-Bug: #1893221
This commit is contained in:
Balazs Gibizer 2020-08-27 15:12:50 +02:00
parent e26a805d15
commit 1273c5ee0b
3 changed files with 15 additions and 6 deletions

View File

@ -10597,9 +10597,15 @@ class ComputeManager(manager.Manager):
requests=pci_reqs,
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(
ctxt,
vif_pci_requests)
ctxt, vif_pci_requests, dest_topo)
# Update VIFMigrateData profile with the newly claimed PCI
# device

View File

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

View File

@ -10752,6 +10752,8 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase,
get_pci_req_side_effect
self.instance.pci_devices = instance_pci_devs
self.instance.pci_requests = instance_pci_reqs
self.instance.migration_context = objects.MigrationContext(
new_numa_topology=objects.InstanceNUMATopology())
rt_mock.reset()
claimed_pci_dev = objects.PciDevice(request_id=uuids.pci_req,
@ -10766,7 +10768,10 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase,
self.instance)
self.assertEqual(len(nw_vifs),
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)
_test()