summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nova/compute/manager.py7
-rw-r--r--nova/scheduler/client/report.py4
-rw-r--r--nova/tests/functional/test_servers.py16
3 files changed, 23 insertions, 4 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index a78bbdfc45..0beedeea9d 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -7602,6 +7602,13 @@ class ComputeManager(manager.Manager):
if not request_groups:
return None, None
+ # NOTE(gibi): we assume a single RequestGroup here as:
+ # 1) there can only be a single port per interface attach request
+ # 2) a single port can only request resources in a single RequestGroup
+ # as per the current neutron API.
+ # #2) might change in the future so both
+ # nova.network.neutron.API.create_resource_requests() and this function
+ # takes a list of groups
request_group = request_groups[0]
# restrict the resource request to the current compute node. The
diff --git a/nova/scheduler/client/report.py b/nova/scheduler/client/report.py
index da195bdc11..95682e2d20 100644
--- a/nova/scheduler/client/report.py
+++ b/nova/scheduler/client/report.py
@@ -1755,7 +1755,9 @@ class SchedulerReportClient(object):
context, consumer_uuid, resources):
error_reason = _("Cannot remove resources %s from the allocation "
"due to multiple successive generation conflicts "
- "in placement.")
+ "in placement. To clean up the leaked resource "
+ "allocation you can use nova-manage placement "
+ "audit.")
raise exception.AllocationUpdateFailed(
consumer_uuid=consumer_uuid,
error=error_reason % resources)
diff --git a/nova/tests/functional/test_servers.py b/nova/tests/functional/test_servers.py
index 2371af771a..b3b155ff34 100644
--- a/nova/tests/functional/test_servers.py
+++ b/nova/tests/functional/test_servers.py
@@ -6406,13 +6406,23 @@ class PortResourceRequestBasedSchedulingTest(
self.assertComputeAllocationMatchesFlavor(
allocations, self.compute1_rp_uuid, self.flavor)
- sriov_allocations = allocations[
- self.sriov_dev_rp_per_host[
- self.compute1_rp_uuid][self.PF2]]['resources']
+ sriov_dev_rp = self.sriov_dev_rp_per_host[
+ self.compute1_rp_uuid][self.PF2]
+ sriov_allocations = allocations[sriov_dev_rp]['resources']
# this is the leaked allocation in placement
self.assertPortMatchesAllocation(sriov_port, sriov_allocations)
+ allocations[sriov_dev_rp].pop('generation')
+ leaked_allocation = {sriov_dev_rp: allocations[sriov_dev_rp]}
+ self.assertIn(
+ f'Failed to update allocations for consumer {server["id"]}. '
+ f'Error: Cannot remove resources {leaked_allocation} from the '
+ f'allocation due to multiple successive generation conflicts in '
+ f'placement. To clean up the leaked resource allocation you can '
+ f'use nova-manage placement audit.',
+ self.stdlog.logger.output)
+
# We expect that the port binding is not updated with any RP uuid as
# the attach failed.
sriov_binding = sriov_port['binding:profile']