From 9cb92e88321237f5581b2e125136d211bb080a45 Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Thu, 8 Jul 2021 14:38:25 +0200 Subject: [PATCH] [func test] refactor interface attach with qos To make the existing negative detach test more generic the logic is changed from increasing the resource request of the port over the resource inventory to decrease the resource inventory below the port request. This is needed as the way to increasing the port request will be different when the extended resource request extension is enabled. Change-Id: Iec9d3bb4fef7b6b18a13517872f46afcce02520c blueprint: qos-minimum-guaranteed-packet-rate --- .../functional/test_servers_resource_request.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/nova/tests/functional/test_servers_resource_request.py b/nova/tests/functional/test_servers_resource_request.py index faf892ffc0..d308980209 100644 --- a/nova/tests/functional/test_servers_resource_request.py +++ b/nova/tests/functional/test_servers_resource_request.py @@ -1017,11 +1017,16 @@ class PortResourceRequestBasedSchedulingTest( networks=[{'port': self.neutron.port_1['id']}]) self._wait_for_state_change(server, 'ACTIVE') - # attach an OVS port with too big resource request + # decrease the resource inventory so that the OVS port will not fit + self._set_provider_inventories( + self.ovs_bridge_rp_per_host[self.compute1_rp_uuid], + {"inventories": { + orc.NET_BW_IGR_KILOBIT_PER_SEC: {"total": 10}, + orc.NET_BW_EGR_KILOBIT_PER_SEC: {"total": 10}, + }}) + + # try to attach an OVS port with too big resource request ovs_port = self.neutron.port_with_resource_request - resources = self.neutron._ports[ - ovs_port['id']]['resource_request']['resources'] - resources['NET_BW_IGR_KILOBIT_PER_SEC'] = 1000000 post = { 'interfaceAttachment': { @@ -1033,6 +1038,9 @@ class PortResourceRequestBasedSchedulingTest( self.assertEqual(400, ex.response.status_code) self.assertIn('Failed to allocate additional resources', str(ex)) + self.assertNotIn( + 'Failed to retrieve allocation candidates from placement API', + self.stdlog.logger.output) def test_interface_attach_with_resource_request_pci_claim_fails(self): # boot a server with a single SRIOV port that has no resource request