Skip to content

Commit d7d51e1

Browse files
Balazs Gibizermriedem
authored andcommitted
Support migrating SRIOV port with bandwidth
For normal ports with resource request it is enough to recalculate the provider mapping during cold migrations. But for ports with PCI request (direct, macvtap) the PCI request also needs to be updated to point to the PF that provides the bandwidth on the destiantion host. So that the pci claim on the compute allocates the VF from the same PF that provides the bandwidth resource. blueprint: support-move-ops-with-qos-ports Change-Id: I2f3434f06489d8b6cb80933bcb1ea1e841049ba5
1 parent 36e2635 commit d7d51e1

File tree

3 files changed

+304
-57
lines changed

3 files changed

+304
-57
lines changed

nova/compute/manager.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4428,6 +4428,27 @@ def _prep_resize(self, context, image, instance, instance_type,
44284428
instance.system_metadata['old_vm_state'] = vm_state
44294429
instance.save()
44304430

4431+
if not isinstance(request_spec, objects.RequestSpec):
4432+
# Prior to compute RPC API 5.1 conductor would pass a legacy dict
4433+
# version of the request spec to compute and since Stein compute
4434+
# could be sending that back to conductor on reschedule, so if we
4435+
# got a dict convert it to an object.
4436+
# TODO(mriedem): We can drop this compat code when we only support
4437+
# compute RPC API >=6.0.
4438+
request_spec = objects.RequestSpec.from_primitives(
4439+
context, request_spec, filter_properties)
4440+
# We don't have to set the new flavor on the request spec because
4441+
# if we got here it was due to a reschedule from the compute and
4442+
# the request spec would already have the new flavor in it from the
4443+
# else block below.
4444+
4445+
request_group_resource_providers_mapping = \
4446+
self._get_request_group_mapping(request_spec)
4447+
4448+
if request_group_resource_providers_mapping:
4449+
self._update_pci_request_spec_with_allocated_interface_name(
4450+
context, instance, request_group_resource_providers_mapping)
4451+
44314452
limits = filter_properties.get('limits', {})
44324453
with self.rt.resize_claim(context, instance, instance_type, node,
44334454
migration, image_meta=image,
@@ -4505,6 +4526,13 @@ def prep_resize(self, context, image, instance, instance_type,
45054526
instance_type, filter_properties,
45064527
node, migration, request_spec,
45074528
clean_shutdown)
4529+
except exception.BuildAbortException:
4530+
# NOTE(gibi): We failed
4531+
# _update_pci_request_spec_with_allocated_interface_name so
4532+
# there is no reason to re-schedule. Just revert the allocation
4533+
# and fail the migration.
4534+
with excutils.save_and_reraise_exception():
4535+
self._revert_allocation(context, instance, migration)
45084536
except Exception:
45094537
# Since we hit a failure, we're either rescheduling or dead
45104538
# and either way we need to cleanup any allocations created

0 commit comments

Comments
 (0)