Trigger real BuildAbortException during migrate with bandwidth

The functional test
test_migrate_server_with_qos_port_pci_update_fail_not_reschedule used
fault injection to simulate that the
_update_pci_request_spec_with_allocated_interface_name call raises
BuildAbortException during migrating a instance with an SRIOV port
having resource request.

We can do a bit better. This patch simulates that neutron names the PF
device RP in placement in an unexpected way. Therefore the test does not
need to mock anything in nova to simulate the same failure.

Change-Id: Ib72f15eb62fd50ea7117df577478f555a8478724
blueprint: support-move-ops-with-qos-ports
This commit is contained in:
Balazs Gibizer 2019-09-18 13:46:32 +02:00
parent 0984ebb9f1
commit 6648e344a9
1 changed files with 20 additions and 15 deletions

View File

@ -6794,6 +6794,16 @@ class ServerMoveWithPortResourceRequestTest(
new_flavor=self.flavor_with_group_policy_bigger)
def test_migrate_server_with_qos_port_pci_update_fail_not_reschedule(self):
# Update the name of the network device RP of PF2 on host2 to something
# unexpected. This will cause
# _update_pci_request_spec_with_allocated_interface_name() to raise
# when the instance is migrated to the host2.
rsp = self.placement_api.put(
'/resource_providers/%s'
% self.sriov_dev_rp_per_host[self.compute2_rp_uuid][self.PF2],
{"name": "invalid-device-rp-name"})
self.assertEqual(200, rsp.status)
self._start_compute('host3')
compute3_rp_uuid = self._get_provider_uuid_by_host('host3')
self._create_networking_rp_tree('host3', compute3_rp_uuid)
@ -6810,24 +6820,19 @@ class ServerMoveWithPortResourceRequestTest(
server, self.compute1_rp_uuid, non_qos_port, qos_port,
qos_sriov_port, self.flavor_with_group_policy)
# The patched compute manager on host2 will raise from
# The compute manager on host2 will raise from
# _update_pci_request_spec_with_allocated_interface_name which will
# intentionally not trigger a re-schedule even if there is host3 as an
# alternate.
with mock.patch.object(
self.computes['host2'].manager,
'_update_pci_request_spec_with_allocated_interface_name',
side_effect=exception.BuildAbortException(
instance_uuid=server['id'], reason='Testing')):
self.api.post_server_action(server['id'], {'migrate': None})
server = self._wait_for_server_parameter(
self.api, server,
{'OS-EXT-SRV-ATTR:host': 'host1',
# Note that we have to wait for the task_state to be reverted
# to None since that happens after the fault is recorded.
'OS-EXT-STS:task_state': None,
'status': 'ERROR'})
self._wait_for_migration_status(server, ['error'])
self.api.post_server_action(server['id'], {'migrate': None})
server = self._wait_for_server_parameter(
self.api, server,
{'OS-EXT-SRV-ATTR:host': 'host1',
# Note that we have to wait for the task_state to be reverted
# to None since that happens after the fault is recorded.
'OS-EXT-STS:task_state': None,
'status': 'ERROR'})
self._wait_for_migration_status(server, ['error'])
self.assertIn(
'Build of instance %s aborted' % server['id'],