scenario: Use wait_for_volume_attachment_remove_from_server in nova_volume_detach
Detaching a volume from an instance in Nova is an asynchronous
operation. While the request can be accepted the underlying act of
detaching the device from the instance, disconnecting the volume from
the host, updating cinder and deleting records in Nova can take some
considerable time.
As such when detaching a volume callers should continue to poll the
os-volume_attachments Nova API to determine when the underlying volume
attachment, also known as a Block Device Mapping or BDM, is removed.
Bug #1908399 outlines an issue where the scenario helper method
nova_volume_detach was being called multiple times during tests and
cleanup while only waiting for the volume status to change to available.
This allowed for a race to occur where additional requests could be made
to detach the volume while the volume attachment still remained in Nova
resulting in a 400 error being returned by n-api.
This change addresses this by switching between the volume resource
status and the volume attachment removal waiters.
Closes-Bug: #1908399
Change-Id: Ib6ae2c30be65eb444976b0330fd23d9457146284
1 file changed