Merge "[func test] Fix race between attachment delete and server delete"
This commit is contained in:
commit
6328a8fb2f
@ -2503,6 +2503,8 @@ def wait_for_delete(session, resource, interval, wait, callback=None):
|
|||||||
resource = resource.fetch(session, skip_cache=True)
|
resource = resource.fetch(session, skip_cache=True)
|
||||||
if not resource:
|
if not resource:
|
||||||
return orig_resource
|
return orig_resource
|
||||||
|
# Some resources like VolumeAttachment don't have status field.
|
||||||
|
if hasattr(resource, 'status'):
|
||||||
if resource.status.lower() == 'deleted':
|
if resource.status.lower() == 'deleted':
|
||||||
return resource
|
return resource
|
||||||
except exceptions.NotFoundException:
|
except exceptions.NotFoundException:
|
||||||
|
@ -137,3 +137,17 @@ class TestServerVolumeAttachment(ft_base.BaseComputeTest):
|
|||||||
status='available',
|
status='available',
|
||||||
wait=self._wait_for_timeout,
|
wait=self._wait_for_timeout,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Wait for the attachment to be deleted.
|
||||||
|
# This is done to prevent a race between the BDM
|
||||||
|
# record being deleted and we trying to delete the server.
|
||||||
|
self.user_cloud.compute.wait_for_delete(
|
||||||
|
volume_attachment,
|
||||||
|
wait=self._wait_for_timeout,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Verify the server doesn't have any volume attachment
|
||||||
|
volume_attachments = list(
|
||||||
|
self.user_cloud.compute.volume_attachments(self.server)
|
||||||
|
)
|
||||||
|
self.assertEqual(0, len(volume_attachments))
|
||||||
|
Loading…
Reference in New Issue
Block a user