diff options
author | Balazs Gibizer <balazs.gibizer@est.tech> | 2021-07-23 18:23:28 +0200 |
---|---|---|
committer | Balazs Gibizer <balazs.gibizer@est.tech> | 2021-08-27 17:59:18 +0200 |
commit | 191bdf2069086493be2a2e0351afa7f3efad7099 (patch) | |
tree | 5f97addbfd9f3b0bddcc8344ca8a0bfb240e9e41 /nova/conductor | |
parent | c3886c3ca758b32df8a58388d967dc3c0a5aebec (diff) | |
download | nova-191bdf2069086493be2a2e0351afa7f3efad7099.tar.gz |
Support move ops with extended resource request
Nova re-generates the resource request of an instance for each server
move operation (migrate, resize, evacuate, live-migrate, unshelve) to
find (or validate) a target host for the instance move. This patch
extends the this logic to support the extended resource request from
neutron.
As the changes in the neutron interface code is called from nova-compute
service during the port binding the compute service version is bumped.
And a check is added to the compute-api to reject the move operations
with ports having extended resource request if there are old computes
in the cluster.
blueprint: qos-minimum-guaranteed-packet-rate
Change-Id: Ibcf703e254e720b9a6de17527325758676628d48
Diffstat (limited to 'nova/conductor')
-rw-r--r-- | nova/conductor/manager.py | 23 | ||||
-rw-r--r-- | nova/conductor/tasks/live_migrate.py | 20 | ||||
-rw-r--r-- | nova/conductor/tasks/migrate.py | 7 |
3 files changed, 26 insertions, 24 deletions
diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py index d9b1d212ac..12737c9964 100644 --- a/nova/conductor/manager.py +++ b/nova/conductor/manager.py @@ -987,20 +987,21 @@ class ComputeTaskManager: # when populate_filter_properties accepts it filter_properties = request_spec.\ to_legacy_filter_properties_dict() - - external_resources = ( + res_req, req_lvl_params = ( self.network_api.get_requested_resource_for_instance( - context, instance.uuid)) + context, instance.uuid) + ) extra_specs = request_spec.flavor.extra_specs device_profile = extra_specs.get('accel:device_profile') - external_resources.extend( + res_req.extend( cyborg.get_device_profile_request_groups( context, device_profile) if device_profile else []) # NOTE(gibi): When other modules want to handle similar # non-nova resources then here we have to collect all # the external resource requests in a single list and # add them to the RequestSpec. - request_spec.requested_resources = external_resources + request_spec.requested_resources = res_req + request_spec.request_level_params = req_lvl_params # NOTE(cfriesen): Ensure that we restrict the scheduler to # the cell specified by the instance mapping. @@ -1184,14 +1185,13 @@ class ComputeTaskManager: # if we want to make sure that the next destination # is not forced to be the original host request_spec.reset_forced_destinations() - - external_resources = [] - external_resources += ( + res_req, req_lvl_params = ( self.network_api.get_requested_resource_for_instance( - context, instance.uuid)) + context, instance.uuid) + ) extra_specs = request_spec.flavor.extra_specs device_profile = extra_specs.get('accel:device_profile') - external_resources.extend( + res_req.extend( cyborg.get_device_profile_request_groups( context, device_profile) if device_profile else []) @@ -1199,7 +1199,8 @@ class ComputeTaskManager: # non-nova resources then here we have to collect all # the external resource requests in a single list and # add them to the RequestSpec. - request_spec.requested_resources = external_resources + request_spec.requested_resources = res_req + request_spec.request_level_params = req_lvl_params try: # if this is a rebuild of instance on the same host with diff --git a/nova/conductor/tasks/live_migrate.py b/nova/conductor/tasks/live_migrate.py index 9613c136a4..294abfe4e3 100644 --- a/nova/conductor/tasks/live_migrate.py +++ b/nova/conductor/tasks/live_migrate.py @@ -372,16 +372,13 @@ class LiveMigrationTask(base.TaskBase): self._update_migrate_vifs_from_bindings(self.migrate_data.vifs, bindings) - @staticmethod - def _get_port_profile_from_provider_mapping(port_id, provider_mappings): - if port_id in provider_mappings: - # NOTE(gibi): In the resource provider mapping there can be - # more than one RP fulfilling a request group. But resource - # requests of a Neutron port is always mapped to a - # numbered request group that is always fulfilled by one - # resource provider. So we only pass that single RP UUID - # here. - return {'allocation': provider_mappings[port_id][0]} + def _get_port_profile_from_provider_mapping( + self, port_id, provider_mappings + ): + allocation = self.network_api.get_binding_profile_allocation( + self.context, port_id, provider_mappings) + if allocation: + return {'allocation': allocation} else: return {} @@ -476,7 +473,7 @@ class LiveMigrationTask(base.TaskBase): # is not forced to be the original host request_spec.reset_forced_destinations() - port_res_req = ( + port_res_req, req_lvl_params = ( self.network_api.get_requested_resource_for_instance( self.context, self.instance.uuid)) # NOTE(gibi): When cyborg or other module wants to handle @@ -484,6 +481,7 @@ class LiveMigrationTask(base.TaskBase): # all the external resource requests in a single list and # add them to the RequestSpec. request_spec.requested_resources = port_res_req + request_spec.request_level_params = req_lvl_params scheduler_utils.setup_instance_group(self.context, request_spec) diff --git a/nova/conductor/tasks/migrate.py b/nova/conductor/tasks/migrate.py index 38e10ff4cc..6ff6206f65 100644 --- a/nova/conductor/tasks/migrate.py +++ b/nova/conductor/tasks/migrate.py @@ -249,12 +249,15 @@ class MigrationTask(base.TaskBase): scheduler_utils.populate_retry(legacy_props, self.instance.uuid) - port_res_req = self.network_api.get_requested_resource_for_instance( - self.context, self.instance.uuid) + port_res_req, req_lvl_params = ( + self.network_api.get_requested_resource_for_instance( + self.context, self.instance.uuid) + ) # NOTE(gibi): When cyborg or other module wants to handle similar # non-nova resources then here we have to collect all the external # resource requests in a single list and add them to the RequestSpec. self.request_spec.requested_resources = port_res_req + self.request_spec.request_level_params = req_lvl_params self._set_requested_destination_cell(legacy_props) |