From fee98b7147ef59bdc32c077fee42416a8acbc213 Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Thu, 18 Jul 2019 15:44:34 +0200 Subject: [PATCH] Allow migrating server with port resource request Now that the nova code supports such a migration this patch removes the check from the API that rejected the operation. Note that in the spec [1] we agreed not to introduce new microversion for this change but treat it as a bugfix. The current change also makes it possible to accept the migration of these servers with _any_ microversion. [1] https://specs.openstack.org/openstack/nova-specs/specs/train/approved/support-move-ops-with-qos-ports.html#rest-api-impact Change-Id: I4bda569cc7c247e83219276282724c77e760ddcd blueprint: support-move-ops-with-qos-ports --- .../source/port_with_resource_request.rst | 9 ++++-- nova/api/openstack/compute/migrate_server.py | 10 ------ nova/tests/functional/test_servers.py | 32 ------------------- ...ith-resource-request-6d23be654a253625.yaml | 9 ++++++ 4 files changed, 16 insertions(+), 44 deletions(-) create mode 100644 releasenotes/notes/support-cold-migrating-neutron-ports-with-resource-request-6d23be654a253625.yaml diff --git a/api-guide/source/port_with_resource_request.rst b/api-guide/source/port_with_resource_request.rst index d383ea6192ae..3ab019cea9e3 100644 --- a/api-guide/source/port_with_resource_request.rst +++ b/api-guide/source/port_with_resource_request.rst @@ -18,9 +18,14 @@ However the following API operations are still not supported in nova: * Attaching Neutron ports and networks having QoS minimum bandwidth rule is not supported. +Also the following API operations are not supported in the 19.0.0 (Stein) +version of nova: + * Moving (resizing, migrating, live-migrating, evacuating, unshelving after shelve offload) servers with ports having resource request is not yet supported. -See :nova-doc:`the admin guide ` for -administrative details. +As of 20.0.0 (Train), nova supports cold migrating servers with neutron ports +having resource requests if both the source and destination compute services +are upgraded to 20.0.0 (Train) and the ``[upgrade_levels]/compute`` +configuration does not prevent the computes from using the latest RPC version. diff --git a/nova/api/openstack/compute/migrate_server.py b/nova/api/openstack/compute/migrate_server.py index 6d75bdc4ac65..dd5eff8e3a54 100644 --- a/nova/api/openstack/compute/migrate_server.py +++ b/nova/api/openstack/compute/migrate_server.py @@ -58,18 +58,8 @@ class MigrateServerController(wsgi.Controller): instance = common.get_instance(self.compute_api, context, id, expected_attrs=['flavor']) - # We could potentially move this check to conductor and avoid the - # extra API call to neutron when we support move operations with ports - # having resource requests. if common.instance_has_port_with_resource_request( context, instance.uuid, self.network_api): - if not common.supports_port_resource_request_during_move(req): - msg = _("The migrate action on a server with ports having " - "resource requests, like a port with a QoS minimum " - "bandwidth policy, is not supported with this " - "microversion") - raise exc.HTTPBadRequest(explanation=msg) - # TODO(gibi): Remove when nova only supports compute newer than # Train source_service = objects.Service.get_by_host_and_binary( diff --git a/nova/tests/functional/test_servers.py b/nova/tests/functional/test_servers.py index 03c19b967b2b..e70725ad89d9 100644 --- a/nova/tests/functional/test_servers.py +++ b/nova/tests/functional/test_servers.py @@ -5820,26 +5820,6 @@ class UnsupportedPortResourceRequestBasedSchedulingTest( 'The resize action on a server with ports having resource ' 'requests', six.text_type(ex)) - def test_migrate_server_with_port_resource_request_old_microversion(self): - server = self._create_server( - flavor=self.flavor, - networks=[{'port': self.neutron.port_1['id']}]) - self._wait_for_state_change(self.admin_api, server, 'ACTIVE') - - # We need to simulate that the above server has a port that has - # resource request; we cannot boot with such a port but legacy servers - # can exist with such a port. - self._add_resource_request_to_a_bound_port(self.neutron.port_1['id']) - - ex = self.assertRaises( - client.OpenStackApiException, - self.api.post_server_action, server['id'], {'migrate': None}) - - self.assertEqual(400, ex.response.status_code) - self.assertIn( - 'The migrate action on a server with ports having resource ' - 'requests', six.text_type(ex)) - def test_live_migrate_server_with_port_resource_request_old_microversion( self): server = self._create_server( @@ -6362,18 +6342,6 @@ class ServerMoveWithPortResourceRequestTest( self.flags(weight_classes=[__name__ + '.HostNameWeigher'], group='filter_scheduler') super(ServerMoveWithPortResourceRequestTest, self).setUp() - - # The API actively rejecting the move operations with resource - # request so we have to turn off that check. - # TODO(gibi): Remove this when the move operations are supported and - # the API check is removed. - patcher = mock.patch( - 'nova.api.openstack.common.' - 'supports_port_resource_request_during_move', - return_value=True) - self.addCleanup(patcher.stop) - patcher.start() - self.compute2 = self._start_compute('host2') self.compute2_rp_uuid = self._get_provider_uuid_by_host('host2') self._create_networking_rp_tree('host2', self.compute2_rp_uuid) diff --git a/releasenotes/notes/support-cold-migrating-neutron-ports-with-resource-request-6d23be654a253625.yaml b/releasenotes/notes/support-cold-migrating-neutron-ports-with-resource-request-6d23be654a253625.yaml new file mode 100644 index 000000000000..3f4f3fc92ec5 --- /dev/null +++ b/releasenotes/notes/support-cold-migrating-neutron-ports-with-resource-request-6d23be654a253625.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + Cold migration is now supported for servers with neutron ports having + resource requests. E.g. ports that have QoS minimum bandwidth rules + attached. Note that the migration is only supported if both the source and + the destination compute services are upgraded to Train and the + ``[upgrade_levels]/compute`` configuration does not prevent the computes + from using the latest RPC version.