migrate: Add bw min service level check of source compute

During cold migrate the RequestSpec goes from the dest compute to the
source compute and then back to the dest. The previous patch [1] added
service level check for the dest compute. However the source compute also
needs to be new enough so the RequestSpec is passed through it.

Please note that the functional coverage for this api change is in a
later patch [2].

[1] https://review.opendev.org/#/c/680394
[2] https://review.opendev.org/#/c/655113

blueprint: support-move-ops-with-qos-ports
Change-Id: I09cac780b9ee5b5726874d4e6f895fd0cd4bff8c
This commit is contained in:
Balazs Gibizer
2019-09-04 12:27:18 +02:00
parent d6795e1393
commit a061b0ea2e
2 changed files with 45 additions and 8 deletions
@@ -296,6 +296,29 @@ class MigrateServerTestsV21(admin_only_action_common.CommonTests):
expected_exc=webob.exc.HTTPInternalServerError,
check_response=False)
@mock.patch('nova.api.openstack.common.'
'supports_port_resource_request_during_move',
return_value=True)
@mock.patch('nova.objects.Service.get_by_host_and_binary')
@mock.patch('nova.api.openstack.common.'
'instance_has_port_with_resource_request', return_value=True)
def test_migrate_with_bandwidth_from_old_compute_not_supported(
self, mock_has_res_req, mock_get_service, mock_support):
instance = self._stub_instance_get()
mock_get_service.return_value = objects.Service(host=instance['host'])
mock_get_service.return_value.version = 38
self.assertRaises(
webob.exc.HTTPConflict, self.controller._migrate, self.req,
instance['uuid'], body={'migrate': None})
mock_has_res_req.assert_called_once_with(
self.req.environ['nova.context'], instance['uuid'],
self.controller.network_api)
mock_get_service.assert_called_once_with(
self.req.environ['nova.context'], instance['host'], 'nova-compute')
class MigrateServerTestsV225(MigrateServerTestsV21):