Add wait for location import task

We have recently added support of new location APIs in glance,
where we are adding hash calculation mechanism once the image
location is added. Since new location api is async,
we need to wait for the task to finish before performing the
cleanup else we will fail due to the existing bug [1].

[1]: https://bugs.launchpad.net/glance/+bug/2045769

Change-Id: I6a482410956145cc6fa1ed73bb3668f88c790b75
This commit is contained in:
Pranali Deore 2024-08-30 08:32:44 +00:00
parent f6bb9d1e4b
commit 57183797ba

View File

@ -90,6 +90,14 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
name=snapshot_name,
wait_until='ACTIVE',
wait_for_server=False)
# This is required due to ceph issue:
# https://bugs.launchpad.net/glance/+bug/2045769.
# New location APIs are async so we need to wait for the location
# import task to complete.
# This should work with old location API since we don't fail if there
# are no tasks for the image
waiters.wait_for_image_tasks_status(self.images_client,
image['id'], 'success')
self.addCleanup(self.client.delete_image, image['id'])
self.assertEqual(snapshot_name, image['name'])
@ -110,6 +118,14 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
name=snapshot_name,
wait_until='ACTIVE',
wait_for_server=False)
# This is required due to ceph issue:
# https://bugs.launchpad.net/glance/+bug/2045769.
# New location APIs are async so we need to wait for the location
# import task to complete.
# This should work with old location API since we don't fail if there
# are no tasks for the image
waiters.wait_for_image_tasks_status(self.images_client,
image['id'], 'success')
self.addCleanup(self.client.delete_image, image['id'])
self.assertEqual(snapshot_name, image['name'])
@ -130,6 +146,14 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
name=snapshot_name,
wait_until='ACTIVE',
wait_for_server=False)
# This is required due to ceph issue:
# https://bugs.launchpad.net/glance/+bug/2045769.
# New location APIs are async so we need to wait for the location
# import task to complete.
# This should work with old location API since we don't fail if there
# are no tasks for the image
waiters.wait_for_image_tasks_status(self.images_client,
image['id'], 'success')
self.addCleanup(self.client.delete_image, image['id'])
self.assertEqual(snapshot_name, image['name'])