Merge "Follow up for QoS interface attach"

This commit is contained in:
Zuul 2021-03-11 05:54:02 +00:00 committed by Gerrit Code Review
commit c172377a00
3 changed files with 23 additions and 4 deletions

View File

@ -7599,6 +7599,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

View File

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

View File

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