From 64cdb82b998d4dfc8188dfba174be95c06da13ad Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Sat, 14 Dec 2019 12:00:40 +0100 Subject: [PATCH] Enable live migration with qos ports Previous patches in the blueprint implemented the support for live migraton with qos ports and added functional test coverage for the various live migration scenarios. So this patch removes the API check that rejected such operation and document the new feature. Change-Id: Ib9ef18fff28c463c9ffe3607d93428b689dc89fb blueprint: support-move-ops-with-qos-ports-ussuri --- .../source/port_with_resource_request.rst | 4 +- nova/api/openstack/compute/migrate_server.py | 12 ---- nova/tests/functional/test_servers.py | 59 ------------------- ...ith-resource-request-cf9a21dacb9c5ece.yaml | 6 ++ 4 files changed, 8 insertions(+), 73 deletions(-) create mode 100644 releasenotes/notes/support-live-migrating-servers-with-neutron-ports-with-resource-request-cf9a21dacb9c5ece.yaml diff --git a/api-guide/source/port_with_resource_request.rst b/api-guide/source/port_with_resource_request.rst index 604082fb6276..867dd0181230 100644 --- a/api-guide/source/port_with_resource_request.rst +++ b/api-guide/source/port_with_resource_request.rst @@ -31,8 +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. +As of 21.0.0 (Ussuri), nova supports evacuating and live migrating servers +with neutron ports having resource requests. See :nova-doc:`the admin guide ` for administrative details. diff --git a/nova/api/openstack/compute/migrate_server.py b/nova/api/openstack/compute/migrate_server.py index e28b201f71ff..ddbb2beb1315 100644 --- a/nova/api/openstack/compute/migrate_server.py +++ b/nova/api/openstack/compute/migrate_server.py @@ -128,18 +128,6 @@ class MigrateServerController(wsgi.Controller): instance = common.get_instance(self.compute_api, context, id, expected_attrs=['numa_topology']) - # 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( - instance.uuid, self.network_api) and not - common.supports_port_resource_request_during_move(req)): - msg = _("The os-migrateLive 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.live_migrate(context, instance, block_migration, disk_over_commit, host, force, diff --git a/nova/tests/functional/test_servers.py b/nova/tests/functional/test_servers.py index d2bb51564eb4..f7d2775ed4ab 100644 --- a/nova/tests/functional/test_servers.py +++ b/nova/tests/functional/test_servers.py @@ -5858,18 +5858,6 @@ class PortResourceRequestBasedSchedulingTestBase( device_name, pci_requests.requests[0].spec[0]['parent_ifname']) - 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() - class UnsupportedPortResourceRequestBasedSchedulingTest( PortResourceRequestBasedSchedulingTestBase): @@ -5968,33 +5956,6 @@ class UnsupportedPortResourceRequestBasedSchedulingTest( "until microversion 2.72.", six.text_type(ex)) - def test_live_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(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']) - - post = { - 'os-migrateLive': { - 'host': None, - 'block_migration': False, - } - } - ex = self.assertRaises( - client.OpenStackApiException, - self.api.post_server_action, server['id'], post) - - self.assertEqual(400, ex.response.status_code) - self.assertIn( - 'The os-migrateLive 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( @@ -7221,10 +7182,6 @@ class ServerMoveWithPortResourceRequestTest( qos_sriov_port, self.flavor_with_group_policy) def test_live_migrate_with_qos_port(self, host=None): - # TODO(gibi): remove this when live migration 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 @@ -7260,10 +7217,6 @@ class ServerMoveWithPortResourceRequestTest( self.test_live_migrate_with_qos_port(host='host2') def test_live_migrate_with_qos_port_reschedule_success(self): - # TODO(gibi): remove this when live migration is fully supported and - # therefore the check is removed from the api - self._turn_off_api_check() - self._start_compute('host3') compute3_rp_uuid = self._get_provider_uuid_by_host('host3') self._create_networking_rp_tree('host3', compute3_rp_uuid) @@ -7318,10 +7271,6 @@ class ServerMoveWithPortResourceRequestTest( server, qos_normal_port, qos_sriov_port) def test_live_migrate_with_qos_port_reschedule_fails(self): - # TODO(gibi): remove this when live migration 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 @@ -7365,10 +7314,6 @@ class ServerMoveWithPortResourceRequestTest( server, qos_normal_port, qos_sriov_port) def test_live_migrate_with_qos_port_pci_update_fails(self): - # TODO(gibi): remove this when live migration 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 @@ -7434,10 +7379,6 @@ class LiveMigrateAbortWithPortResourceRequestTest( host='host2', binary='nova-compute')[0]['id'] def test_live_migrate_with_qos_port_abort_migration(self): - # TODO(gibi): remove this when live migration 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 diff --git a/releasenotes/notes/support-live-migrating-servers-with-neutron-ports-with-resource-request-cf9a21dacb9c5ece.yaml b/releasenotes/notes/support-live-migrating-servers-with-neutron-ports-with-resource-request-cf9a21dacb9c5ece.yaml new file mode 100644 index 000000000000..3e06149df6fc --- /dev/null +++ b/releasenotes/notes/support-live-migrating-servers-with-neutron-ports-with-resource-request-cf9a21dacb9c5ece.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + The server ``os-migrateLive`` action API now supports servers with neutron + ports having resource requests, e.g. ports that have QoS minimum bandwidth + rules attached.