Follow up for Ib50b6b02208f5bd2972de8a6f8f685c19745514c
* Extract out the provider mapping code from finish_revert_resize * Fix nits in the code comments Change-Id: If48134a87aaedcd1c7cfef0229a7e0af05514910 blueprint: support-move-ops-with-qos-ports
This commit is contained in:
parent
7113ac42b6
commit
47bfc46fb5
|
@ -3463,9 +3463,9 @@ class API(base.Base):
|
|||
# RequestSpec.requested_resources as others like cyborg might added
|
||||
# to things there already
|
||||
# NOTE(gibi): We need to collect the requested resource again as it is
|
||||
# intentionally not persisted in nova. Note that this is needs to be
|
||||
# done here as the nova REST API code directly calls revert on the
|
||||
# compute_api skipping the conductor.
|
||||
# intentionally not persisted in nova. Note that this needs to be
|
||||
# done here as the nova API code directly calls revert on the
|
||||
# dest compute service skipping the conductor.
|
||||
port_res_req = self.network_api.get_requested_resource_for_instance(
|
||||
context, instance.uuid)
|
||||
reqspec.requested_resources = port_res_req
|
||||
|
|
|
@ -4295,23 +4295,8 @@ class ComputeManager(manager.Manager):
|
|||
'migration_uuid': migration.uuid})
|
||||
raise
|
||||
|
||||
if request_spec:
|
||||
# NOTE(gibi): We need to re-calculate the resource provider -
|
||||
# port mapping as we have to have the neutron ports allocate
|
||||
# from the source compute after revert.
|
||||
scheduler_utils.fill_provider_mapping_based_on_allocation(
|
||||
context, self.reportclient, request_spec,
|
||||
source_allocations)
|
||||
provider_mappings = self._get_request_group_mapping(
|
||||
request_spec)
|
||||
else:
|
||||
# NOTE(gibi): The compute RPC is pinned to be older than 5.2
|
||||
# and therefore request_spec is not sent. We cannot calculate
|
||||
# the provider mappings. If the instance has ports with
|
||||
# resource request then the port update will fail in
|
||||
# _update_port_binding_for_instance() called via
|
||||
# _finish_revert_resize_network_migrate_finish() below.
|
||||
provider_mappings = None
|
||||
provider_mappings = self._fill_provider_mapping_based_on_allocs(
|
||||
context, source_allocations, request_spec)
|
||||
|
||||
self.network_api.setup_networks_on_host(context, instance,
|
||||
migration.source_compute)
|
||||
|
@ -4363,6 +4348,39 @@ class ComputeManager(manager.Manager):
|
|||
self.host, action=fields.NotificationAction.RESIZE_REVERT,
|
||||
phase=fields.NotificationPhase.END, bdms=bdms)
|
||||
|
||||
def _fill_provider_mapping_based_on_allocs(
|
||||
self, context, allocations, request_spec):
|
||||
"""Fills and returns the request group - resource provider mapping
|
||||
based on the allocation passed in.
|
||||
|
||||
:param context: The security context
|
||||
:param allocation: allocation dict keyed by RP UUID.
|
||||
:param request_spec: The RequestSpec object associated with the
|
||||
operation
|
||||
:returns: None if the request_spec is None. Otherwise a mapping
|
||||
between RequestGroup requester_id, currently Neutron port_id,
|
||||
and a list of resource provider UUIDs providing resource for
|
||||
that RequestGroup.
|
||||
"""
|
||||
if request_spec:
|
||||
# NOTE(gibi): We need to re-calculate the resource provider -
|
||||
# port mapping as we have to have the neutron ports allocate
|
||||
# from the source compute after revert.
|
||||
scheduler_utils.fill_provider_mapping_based_on_allocation(
|
||||
context, self.reportclient, request_spec, allocations)
|
||||
provider_mappings = self._get_request_group_mapping(
|
||||
request_spec)
|
||||
else:
|
||||
# NOTE(gibi): The compute RPC is pinned to be older than 5.2
|
||||
# and therefore request_spec is not sent. We cannot calculate
|
||||
# the provider mappings. If the instance has ports with
|
||||
# resource request then the port update will fail in
|
||||
# _update_port_binding_for_instance() called via
|
||||
# _finish_revert_resize_network_migrate_finish() in
|
||||
# finish_revert_resize.
|
||||
provider_mappings = None
|
||||
return provider_mappings
|
||||
|
||||
def _revert_allocation(self, context, instance, migration):
|
||||
"""Revert an allocation that is held by migration to our instance."""
|
||||
|
||||
|
|
Loading…
Reference in New Issue