diff options
author | Balazs Gibizer <balazs.gibizer@est.tech> | 2021-07-15 10:51:33 +0200 |
---|---|---|
committer | Balazs Gibizer <balazs.gibizer@est.tech> | 2021-08-27 15:51:12 +0200 |
commit | c3886c3ca758b32df8a58388d967dc3c0a5aebec (patch) | |
tree | e7e352ba9aceaf63183eb18cc5fb989cb4f0d5e2 /nova/tests/unit/compute | |
parent | 94f47471e058e46441a63d5aaf77776ef75b3fba (diff) | |
download | nova-c3886c3ca758b32df8a58388d967dc3c0a5aebec.tar.gz |
Support boot with extended resource request
This adds the final missing pieces to support creating servers with
ports having extended resource request. As the changes in the neutron
interface code is called from nova-compute service during the port
binding the compute service version is bumped. And a check is added to
the compute-api to reject such server create requests if there are old
computes in the cluster.
Note that some of the negative and SRIOV related interface attach
tests are also started to pass as they are not dependent on any of the
interface attach specific implementation. Still interface attach is
broken here as the failing of the positive tests show.
blueprint: qos-minimum-guaranteed-packet-rate
Change-Id: I9060cc9cb9e0d5de641ade78c5fd7e1cc77ade46
Diffstat (limited to 'nova/tests/unit/compute')
-rw-r--r-- | nova/tests/unit/compute/test_api.py | 2 | ||||
-rw-r--r-- | nova/tests/unit/compute/test_compute.py | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/nova/tests/unit/compute/test_api.py b/nova/tests/unit/compute/test_api.py index a8f91a0458..d0d7e5ba1d 100644 --- a/nova/tests/unit/compute/test_api.py +++ b/nova/tests/unit/compute/test_api.py @@ -7234,7 +7234,7 @@ class ComputeAPIUnitTestCase(_ComputeAPIUnitTestMixIn, test.NoDBTestCase): self.context, instance.host, 'nova-compute') @mock.patch( - 'nova.network.neutron.API._has_extended_resource_request_extension', + 'nova.network.neutron.API.has_extended_resource_request_extension', new=mock.Mock(return_value=False) ) @mock.patch('nova.compute.rpcapi.ComputeAPI.attach_interface') diff --git a/nova/tests/unit/compute/test_compute.py b/nova/tests/unit/compute/test_compute.py index a7b009d377..003114192b 100644 --- a/nova/tests/unit/compute/test_compute.py +++ b/nova/tests/unit/compute/test_compute.py @@ -9820,6 +9820,32 @@ class ComputeAPITestCase(BaseTestCase): self.assertEqual(refs[i]['display_name'], name) self.assertEqual(refs[i]['hostname'], name) + @mock.patch("nova.objects.service.get_minimum_version_all_cells") + @mock.patch( + "nova.network.neutron.API.has_extended_resource_request_extension") + @mock.patch("nova.network.neutron.API.create_resource_requests") + def test_instance_create_with_extended_res_req_old_compute( + self, mock_create_res_req, mock_has_extended_res_req, + mock_get_min_svc_version + ): + requested_networks = objects.NetworkRequestList( + objects=[ + objects.NetworkRequest(port_id=uuids.port1) + ] + ) + mock_create_res_req.return_value = ( + None, [objects.RequestGroup()], None) + mock_has_extended_res_req.return_value = True + mock_get_min_svc_version.return_value = 57 + + self.assertRaises( + exception.ExtendedResourceRequestOldCompute, + self.compute_api.create, self.context, self.default_flavor, + image_href=uuids.image_href_id, + requested_networks=requested_networks, + supports_port_resource_request=True, + ) + def test_instance_architecture(self): # Test the instance architecture. i_ref = self._create_fake_instance_obj() |