Skip to content

Commit fee98b7

Browse files
Balazs Gibizermriedem
authored andcommitted
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
1 parent d7d51e1 commit fee98b7

File tree

4 files changed

+16
-44
lines changed

4 files changed

+16
-44
lines changed

api-guide/source/port_with_resource_request.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@ However the following API operations are still not supported in nova:
1818
* Attaching Neutron ports and networks having QoS minimum bandwidth rule is not
1919
supported.
2020

21+
Also the following API operations are not supported in the 19.0.0 (Stein)
22+
version of nova:
23+
2124
* Moving (resizing, migrating, live-migrating, evacuating, unshelving after
2225
shelve offload) servers with ports having resource request is not yet
2326
supported.
2427

25-
See :nova-doc:`the admin guide <admin/port_with_resource_request.html>` for
26-
administrative details.
28+
As of 20.0.0 (Train), nova supports cold migrating servers with neutron ports
29+
having resource requests if both the source and destination compute services
30+
are upgraded to 20.0.0 (Train) and the ``[upgrade_levels]/compute``
31+
configuration does not prevent the computes from using the latest RPC version.

nova/api/openstack/compute/migrate_server.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,8 @@ def _migrate(self, req, id, body):
5858
instance = common.get_instance(self.compute_api, context, id,
5959
expected_attrs=['flavor'])
6060

61-
# We could potentially move this check to conductor and avoid the
62-
# extra API call to neutron when we support move operations with ports
63-
# having resource requests.
6461
if common.instance_has_port_with_resource_request(
6562
context, instance.uuid, self.network_api):
66-
if not common.supports_port_resource_request_during_move(req):
67-
msg = _("The migrate action on a server with ports having "
68-
"resource requests, like a port with a QoS minimum "
69-
"bandwidth policy, is not supported with this "
70-
"microversion")
71-
raise exc.HTTPBadRequest(explanation=msg)
72-
7363
# TODO(gibi): Remove when nova only supports compute newer than
7464
# Train
7565
source_service = objects.Service.get_by_host_and_binary(

nova/tests/functional/test_servers.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5820,26 +5820,6 @@ def test_resize_server_with_port_resource_request_old_microversion(self):
58205820
'The resize action on a server with ports having resource '
58215821
'requests', six.text_type(ex))
58225822

5823-
def test_migrate_server_with_port_resource_request_old_microversion(self):
5824-
server = self._create_server(
5825-
flavor=self.flavor,
5826-
networks=[{'port': self.neutron.port_1['id']}])
5827-
self._wait_for_state_change(self.admin_api, server, 'ACTIVE')
5828-
5829-
# We need to simulate that the above server has a port that has
5830-
# resource request; we cannot boot with such a port but legacy servers
5831-
# can exist with such a port.
5832-
self._add_resource_request_to_a_bound_port(self.neutron.port_1['id'])
5833-
5834-
ex = self.assertRaises(
5835-
client.OpenStackApiException,
5836-
self.api.post_server_action, server['id'], {'migrate': None})
5837-
5838-
self.assertEqual(400, ex.response.status_code)
5839-
self.assertIn(
5840-
'The migrate action on a server with ports having resource '
5841-
'requests', six.text_type(ex))
5842-
58435823
def test_live_migrate_server_with_port_resource_request_old_microversion(
58445824
self):
58455825
server = self._create_server(
@@ -6362,18 +6342,6 @@ def setUp(self):
63626342
self.flags(weight_classes=[__name__ + '.HostNameWeigher'],
63636343
group='filter_scheduler')
63646344
super(ServerMoveWithPortResourceRequestTest, self).setUp()
6365-
6366-
# The API actively rejecting the move operations with resource
6367-
# request so we have to turn off that check.
6368-
# TODO(gibi): Remove this when the move operations are supported and
6369-
# the API check is removed.
6370-
patcher = mock.patch(
6371-
'nova.api.openstack.common.'
6372-
'supports_port_resource_request_during_move',
6373-
return_value=True)
6374-
self.addCleanup(patcher.stop)
6375-
patcher.start()
6376-
63776345
self.compute2 = self._start_compute('host2')
63786346
self.compute2_rp_uuid = self._get_provider_uuid_by_host('host2')
63796347
self._create_networking_rp_tree('host2', self.compute2_rp_uuid)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
features:
3+
- |
4+
Cold migration is now supported for servers with neutron ports having
5+
resource requests. E.g. ports that have QoS minimum bandwidth rules
6+
attached. Note that the migration is only supported if both the source and
7+
the destination compute services are upgraded to Train and the
8+
``[upgrade_levels]/compute`` configuration does not prevent the computes
9+
from using the latest RPC version.

0 commit comments

Comments
 (0)