From 70630fe5ab8f3146e64eef3b9c5818a411b22971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Ribaud?= Date: Wed, 12 Mar 2025 11:37:50 +0100 Subject: [PATCH] FUP Remove unnecessary PCI check This patch removes the _test_pci() method, which is no longer necessary since flavor-based requests can now be live migrated. The related tests have also been removed. This fixes a bug where a user requests a live migration with a flavor-based request and NUMA constraints (e.g., CPU affinity). In this case, the code encounters the _test_pci() method and fails because the check was originally designed to enforce port-based requests only, causing an unnecessary failure. Notes: This issue was discovered through functional tests that involve a mix of port-based and flavor-based requests. The failure in this scenario highlighted the unnecessary constraint. A functional test reproducing this issue in a mixed-mode scenario (port request + flavor-based request) will be provided in a subsequent FUP patch. The _test_pci() check was redundant, as a similar verification is already performed earlier in the migration process. Closes-Bug: 2103636 Implements: blueprint migrate-vfio-devices-using-kernel-variant-drivers Change-Id: Icbeaadd94658ed44917d724446d484f6497f29e5 (cherry picked from commit 4e4262cd3dfc6e2c1b0859882d2bd4dceb8ed7d8) --- nova/compute/claims.py | 26 -------------------------- nova/tests/unit/compute/test_claims.py | 13 ------------- 2 files changed, 39 deletions(-) diff --git a/nova/compute/claims.py b/nova/compute/claims.py index fa93d9ab1852..c405c01f1825 100644 --- a/nova/compute/claims.py +++ b/nova/compute/claims.py @@ -206,32 +206,6 @@ class MoveClaim(Claim): flavor=self.flavor) self.instance.drop_migration_context() - def _test_pci(self): - """Test whether this host can accept this claim's PCI requests. For - live migration, only Neutron SRIOV PCI requests are supported. Any - other type of PCI device would need to be removed and re-added for live - migration to work, and there is currently no support for that. For cold - migration, all types of PCI requests are supported, so we just call up - to normal Claim's _test_pci(). - """ - if not self.migration.is_live_migration: - return super(MoveClaim, self)._test_pci() - - if self._pci_requests.requests: - for pci_request in self._pci_requests.requests: - if (pci_request.source != - objects.InstancePCIRequest.NEUTRON_PORT): - return (_('Non-VIF related PCI requests are not ' - 'supported for live migration.')) - # TODO(artom) At this point, once we've made sure we only have - # NEUTRON_PORT (aka SRIOV) PCI requests, we should check whether - # the host can support them, like Claim._test_pci() does. However, - # SRIOV live migration is currently being handled separately - see - # for example _claim_pci_for_instance_vifs() in the compute - # manager. So we do nothing here to avoid stepping on that code's - # toes, but ideally MoveClaim would be used for all live migration - # resource claims. - def _test_live_migration_page_size(self): """Tests that the current page size and the requested page size are the same. diff --git a/nova/tests/unit/compute/test_claims.py b/nova/tests/unit/compute/test_claims.py index dcdef56fbe5c..4fa0716be29f 100644 --- a/nova/tests/unit/compute/test_claims.py +++ b/nova/tests/unit/compute/test_claims.py @@ -372,19 +372,6 @@ class MoveClaimTestCase(ClaimTestCase): class LiveMigrationClaimTestCase(ClaimTestCase): - def test_live_migration_claim_bad_pci_request(self): - flavor = self._fake_flavor() - instance = self._fake_instance() - instance.numa_topology = None - self.assertRaisesRegex( - exception.ComputeResourcesUnavailable, - 'PCI requests are not supported', - claims.MoveClaim, self.context, instance, _NODENAME, flavor, - {}, self.tracker, self.compute_node, - objects.InstancePCIRequests(requests=[ - objects.InstancePCIRequest(alias_name='fake-alias')]), - objects.Migration(migration_type='live-migration'), None) - def test_live_migration_page_size(self): flavor = self._fake_flavor() instance = self._fake_instance()