Add wait for location import task

When uploading a volume to image in optimized path, we are working
to get support of new location APIs.
The new location APIs are async and we need to wait for the task
to finish before performing the cleanup else we will fail.
This patch adds a waiter for location import task during upload volume.

Change-Id: Ia19e0bcc318ba7c4e71c2f36343b783431743a3e
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 150677d..8cf44be 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -119,6 +119,13 @@
                         self.images_client.delete_image,
                         image_id)
         waiters.wait_for_image_status(self.images_client, image_id, 'active')
+        # This is required for the optimized upload volume path.
+        # 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')
         waiters.wait_for_volume_resource_status(self.volumes_client,
                                                 self.volume['id'], 'available')