Skip to content

Commit 9b7247d

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Make PCI claim NUMA aware during live migration"
2 parents 561183f + 1273c5e commit 9b7247d

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

nova/compute/manager.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10541,9 +10541,15 @@ def _claim_pci_for_instance_vifs(self, ctxt, instance):
1054110541
requests=pci_reqs,
1054210542
instance_uuid=instance.uuid)
1054310543

10544+
# if we are called during the live migration with NUMA topology
10545+
# support the PCI claim needs to consider the destination NUMA
10546+
# topology that is then stored in the migration_context
10547+
dest_topo = None
10548+
if instance.migration_context:
10549+
dest_topo = instance.migration_context.new_numa_topology
10550+
1054410551
claimed_pci_devices_objs = self.rt.claim_pci_devices(
10545-
ctxt,
10546-
vif_pci_requests)
10552+
ctxt, vif_pci_requests, dest_topo)
1054710553

1054810554
# Update VIFMigrateData profile with the newly claimed PCI
1054910555
# device

nova/compute/resource_tracker.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,9 +1873,7 @@ def build_succeeded(self, nodename):
18731873
self.stats[nodename].build_succeeded()
18741874

18751875
@utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, fair=True)
1876-
def claim_pci_devices(
1877-
self, context, pci_requests, instance_numa_topology=None
1878-
):
1876+
def claim_pci_devices(self, context, pci_requests, instance_numa_topology):
18791877
"""Claim instance PCI resources
18801878
18811879
:param context: security context

nova/tests/unit/compute/test_compute_mgr.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10711,6 +10711,8 @@ def get_pci_req_side_effect(context, instance, vif):
1071110711
get_pci_req_side_effect
1071210712
self.instance.pci_devices = instance_pci_devs
1071310713
self.instance.pci_requests = instance_pci_reqs
10714+
self.instance.migration_context = objects.MigrationContext(
10715+
new_numa_topology=objects.InstanceNUMATopology())
1071410716

1071510717
rt_mock.reset()
1071610718
claimed_pci_dev = objects.PciDevice(request_id=uuids.pci_req,
@@ -10725,7 +10727,10 @@ def get_pci_req_side_effect(context, instance, vif):
1072510727
self.instance)
1072610728
self.assertEqual(len(nw_vifs),
1072710729
mock_get_instance_pci_request_from_vif.call_count)
10728-
self.assertTrue(rt_mock.claim_pci_devices.called)
10730+
10731+
rt_mock.claim_pci_devices.assert_called_once_with(
10732+
self.context, test.MatchType(objects.InstancePCIRequests),
10733+
self.instance.migration_context.new_numa_topology)
1072910734
self.assertEqual(len(port_id_to_pci), 1)
1073010735

1073110736
_test()

0 commit comments

Comments
 (0)