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
This commit is contained in:
Balazs Gibizer 2019-07-18 15:44:34 +02:00 committed by Matt Riedemann
parent d7d51e1064
commit fee98b7147
4 changed files with 16 additions and 44 deletions

View File

@ -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 <admin/port_with_resource_request.html>` 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.

View File

@ -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(

View File

@ -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)

View File

@ -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.