Browse Source

Merge "Make PCI claim NUMA aware during live migration"

changes/16/766816/8
Zuul 6 months ago
committed by Gerrit Code Review
parent
commit
9b7247deb0
  1. 10
      nova/compute/manager.py
  2. 4
      nova/compute/resource_tracker.py
  3. 7
      nova/tests/unit/compute/test_compute_mgr.py

10
nova/compute/manager.py

@ -10541,9 +10541,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

4
nova/compute/resource_tracker.py

@ -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

7
nova/tests/unit/compute/test_compute_mgr.py

@ -10711,6 +10711,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,
@ -10725,7 +10727,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()

Loading…
Cancel
Save