diff --git a/api-guide/source/port_with_resource_request.rst b/api-guide/source/port_with_resource_request.rst index 7fe2db81cd02..604082fb6276 100644 --- a/api-guide/source/port_with_resource_request.rst +++ b/api-guide/source/port_with_resource_request.rst @@ -31,5 +31,8 @@ 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. +As of 21.0.0 (Ussuri), nova supports evacuating servers with neutron ports +having resource requests. + See :nova-doc:`the admin guide ` for administrative details. diff --git a/nova/api/openstack/compute/evacuate.py b/nova/api/openstack/compute/evacuate.py index 180da2a0d19a..48815b34b40f 100644 --- a/nova/api/openstack/compute/evacuate.py +++ b/nova/api/openstack/compute/evacuate.py @@ -117,18 +117,6 @@ class EvacuateController(wsgi.Controller): msg = _("The target host can't be the same one.") raise exc.HTTPBadRequest(explanation=msg) - # 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) and not - common.supports_port_resource_request_during_move(req)): - msg = _("The evacuate 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) - try: self.compute_api.evacuate(context, instance, host, on_shared_storage, password, force) diff --git a/nova/tests/functional/test_servers.py b/nova/tests/functional/test_servers.py index 0e9d2d25ef02..0b65596a665d 100644 --- a/nova/tests/functional/test_servers.py +++ b/nova/tests/functional/test_servers.py @@ -5911,27 +5911,6 @@ class UnsupportedPortResourceRequestBasedSchedulingTest( 'The os-migrateLive action on a server with ports having resource ' 'requests', six.text_type(ex)) - def test_evacuate_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'], {'evacuate': {}}) - - self.assertEqual(400, ex.response.status_code) - self.assertIn( - 'The evacuate action on a server with ports having resource ' - 'requests', six.text_type(ex)) - def test_unshelve_offloaded_server_with_port_resource_request_old_version( self): server = self._create_server( @@ -6994,18 +6973,6 @@ class ServerMoveWithPortResourceRequestTest( # the port that doesn't have resource request self.assertNotIn('binding:profile', updated_non_qos_port) - def _turn_off_api_check(self): - # 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() - def _check_allocation_during_evacuate( self, server, flavor, source_compute_rp_uuid, dest_compute_rp_uuid, non_qos_port, qos_port, qos_sriov_port): @@ -7128,10 +7095,6 @@ class ServerMoveWithPortResourceRequestTest( self.assertNotIn('binding:profile', updated_non_qos_port) def test_evacuate_with_qos_port(self, host=None): - # TODO(gibi): remove this when evacuate is fully supported and - # therefore the check is removed from the api - self._turn_off_api_check() - non_qos_normal_port = self.neutron.port_1 qos_normal_port = self.neutron.port_with_resource_request qos_sriov_port = self.neutron.port_with_sriov_resource_request @@ -7182,10 +7145,6 @@ class ServerMoveWithPortResourceRequestTest( self.test_evacuate_with_qos_port(host='host2') def test_evacuate_with_qos_port_fails_recover_source_compute(self): - # TODO(gibi): remove this when evacuate is fully supported and - # therefore the check is removed from the api - self._turn_off_api_check() - non_qos_normal_port = self.neutron.port_1 qos_normal_port = self.neutron.port_with_resource_request qos_sriov_port = self.neutron.port_with_sriov_resource_request @@ -7238,9 +7197,6 @@ class ServerMoveWithPortResourceRequestTest( qos_normal_port, qos_sriov_port, server) def test_evacuate_with_qos_port_pci_update_fail(self): - # TODO(gibi): remove this when evacuate is fully supported and - # therefore the check is removed from the api - self._turn_off_api_check() # Update the name of the network device RP of PF2 on host2 to something # unexpected. This will cause # _update_pci_request_spec_with_allocated_interface_name() to raise diff --git a/releasenotes/notes/support-evacuting-servers-with-neutron-ports-with-resource-request-04cf8c721cbc376f.yaml b/releasenotes/notes/support-evacuting-servers-with-neutron-ports-with-resource-request-04cf8c721cbc376f.yaml new file mode 100644 index 000000000000..90d507da1637 --- /dev/null +++ b/releasenotes/notes/support-evacuting-servers-with-neutron-ports-with-resource-request-04cf8c721cbc376f.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + The server ``evacute`` action API now supports servers with neutron + ports having resource requests, e.g. ports that have QoS minimum bandwidth + rules attached.