summaryrefslogtreecommitdiff
path: root/nova/tests/functional/test_servers.py
diff options
context:
space:
mode:
authorBalazs Gibizer <balazs.gibizer@est.tech>2020-12-14 10:37:05 +0100
committerBalazs Gibizer <balazs.gibizer@est.tech>2020-12-16 17:01:49 +0100
commit1c056c384d1b89dd877e1aa3108b1797d7881223 (patch)
treece732f89c71ab15877a2b63d43b6740f713d2ad5 /nova/tests/functional/test_servers.py
parentf96ade2726c4ff91690064e9ae228fa12e618540 (diff)
downloadnova-1c056c384d1b89dd877e1aa3108b1797d7881223.tar.gz
Fallback to same-cell resize with qos ports
The cross-cell resize code does not consider neutron ports with resource request. To avoid migration failures this patch makes nova to fall back to same cell resize if the instance has neutron ports with resource request. Change-Id: Icaad4b2375b491c8a7e87fb6f4977ae2e13e8190 Closes-Bug: #1907522
Diffstat (limited to 'nova/tests/functional/test_servers.py')
-rw-r--r--nova/tests/functional/test_servers.py39
1 files changed, 17 insertions, 22 deletions
diff --git a/nova/tests/functional/test_servers.py b/nova/tests/functional/test_servers.py
index a7a3eb506d..342c13c37e 100644
--- a/nova/tests/functional/test_servers.py
+++ b/nova/tests/functional/test_servers.py
@@ -8025,41 +8025,36 @@ class CrossCellResizeWithQoSPort(PortResourceRequestBasedSchedulingTestBase):
# host is in a different cell and while cross cell migration is
# enabled it is not supported for neutron ports with resource
# request.
- # FIXME(gibi): We expect this to fail with NoValidHost.
- # Unfortunately it fails due to sending an invalid port binding to
- # Neutron today. This is bug 1907522.
self.api.post_server_action(server['id'], {'migrate': None})
self._wait_for_migration_status(server, ['error'])
- # FIXME(gibi): This is also the result of the bug1907522 as the
- # cleanup after the failure is incomplete.
self._wait_for_server_parameter(
server,
- {'status': 'RESIZE', 'OS-EXT-STS:task_state': 'resize_prep'})
+ {'status': 'ACTIVE', 'OS-EXT-SRV-ATTR:host': 'host1'})
event = self._wait_for_action_fail_completion(
server, 'migrate', 'conductor_migrate_server')
- # This is just the last exception in the chain of exceptions
- # happening after the port binding fails.
self.assertIn(
- 'exception.InstanceInfoCacheNotFound', event['traceback'])
- # This is the root case
+ 'exception.NoValidHost', event['traceback'])
self.assertIn(
+ 'Request is allowed by policy to perform cross-cell resize '
+ 'but the instance has ports with resource request and '
+ 'cross-cell resize is not supported with such ports.',
+ self.stdlog.logger.output)
+ self.assertNotIn(
'nova.exception.PortBindingFailed: Binding failed for port',
self.stdlog.logger.output)
# Now start a new compute in the same cell as the instance and retry
# the migration.
- #
- # This should work after the fallback to same cell resize is
- # implemented
- #
- # self._start_compute('host3', cell_name='cell1')
- #
- # with mock.patch(
- # 'nova.network.neutron.API._create_port_binding',
- # side_effect=spy_on_create_binding, autospec=True
- # ):
- # server = self._migrate_server(server)
- # self.assertEqual('host3', server['OS-EXT-SRV-ATTR:host'])
+ self._start_compute('host3', cell_name='cell1')
+ self.compute3_rp_uuid = self._get_provider_uuid_by_host('host3')
+ self._create_networking_rp_tree('host3', self.compute3_rp_uuid)
+
+ with mock.patch(
+ 'nova.network.neutron.API._create_port_binding',
+ side_effect=spy_on_create_binding, autospec=True
+ ):
+ server = self._migrate_server(server)
+ self.assertEqual('host3', server['OS-EXT-SRV-ATTR:host'])
self._delete_server_and_check_allocations(
server, qos_normal_port, qos_sriov_port)