Deacrease the required image store size by 4 GiB

The test_volumes_actions inreased the volume size by 1 before,
upload the volume to the image store.

This test run with xml/json and with volume v1/v2 api version,
 so it is 4 in total.

This change decreases the theoretical maximum image store size,
 consumed by the test suite in a parallel run.

This change does the followings:
* The extend test cases moved to dedicated file.
* The image deletion now a waited action,
  so the image delteion needs to be comploted before the
  next test.
* Use HEAD instead of get for checking image deletion,
  in order to avoid full image download just for status check.

Change-Id: I982d783312eef5b18dc7518e119b0aa018a195d5
Related-Bug: #1347692
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 6fef564..0f92f01 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -40,6 +40,10 @@
         # Create a test shared volume for attach/detach tests
         cls.volume = cls.create_volume()
 
+    def _delete_image_with_wait(self, image_id):
+        self.image_client.delete_image(image_id)
+        self.image_client.wait_for_resource_deletion(image_id)
+
     @classmethod
     def tearDownClass(cls):
         # Delete the test instance
@@ -101,23 +105,12 @@
                                                image_name,
                                                CONF.volume.disk_format)
         image_id = body["image_id"]
-        self.addCleanup(self.image_client.delete_image, image_id)
+        self.addCleanup(self._delete_image_with_wait, image_id)
         self.assertEqual(202, resp.status)
         self.image_client.wait_for_image_status(image_id, 'active')
         self.client.wait_for_volume_status(self.volume['id'], 'available')
 
     @test.attr(type='gate')
-    def test_volume_extend(self):
-        # Extend Volume Test.
-        extend_size = int(self.volume['size']) + 1
-        resp, body = self.client.extend_volume(self.volume['id'], extend_size)
-        self.assertEqual(202, resp.status)
-        self.client.wait_for_volume_status(self.volume['id'], 'available')
-        resp, volume = self.client.get_volume(self.volume['id'])
-        self.assertEqual(200, resp.status)
-        self.assertEqual(int(volume['size']), extend_size)
-
-    @test.attr(type='gate')
     def test_reserve_unreserve_volume(self):
         # Mark volume as reserved.
         resp, body = self.client.reserve_volume(self.volume['id'])
diff --git a/tempest/api/volume/test_volumes_extend.py b/tempest/api/volume/test_volumes_extend.py
new file mode 100644
index 0000000..58bbe41
--- /dev/null
+++ b/tempest/api/volume/test_volumes_extend.py
@@ -0,0 +1,53 @@
+# Copyright 2012 OpenStack Foundation
+# All Rights Reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+from tempest.api.volume import base
+from tempest import config
+from tempest import test
+
+CONF = config.CONF
+
+
+class VolumesV2ExtendTest(base.BaseVolumeTest):
+
+    @classmethod
+    @test.safe_setup
+    def setUpClass(cls):
+        super(VolumesV2ExtendTest, cls).setUpClass()
+        cls.client = cls.volumes_client
+
+    @test.attr(type='gate')
+    def test_volume_extend(self):
+        # Extend Volume Test.
+        self.volume = self.create_volume()
+        extend_size = int(self.volume['size']) + 1
+        resp, body = self.client.extend_volume(self.volume['id'], extend_size)
+        self.assertEqual(202, resp.status)
+        self.client.wait_for_volume_status(self.volume['id'], 'available')
+        resp, volume = self.client.get_volume(self.volume['id'])
+        self.assertEqual(200, resp.status)
+        self.assertEqual(int(volume['size']), extend_size)
+
+
+class VolumesV2ExtendTestXML(VolumesV2ExtendTest):
+    _interface = "xml"
+
+
+class VolumesV1ExtendTest(VolumesV2ExtendTest):
+    _api_version = 1
+
+
+class VolumesV1ExtendTestXML(VolumesV1ExtendTest):
+    _interface = "xml"
diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/image_client.py
index 4a7c163..bc5e04a 100644
--- a/tempest/services/image/v1/json/image_client.py
+++ b/tempest/services/image/v1/json/image_client.py
@@ -235,7 +235,7 @@
 
     def is_resource_deleted(self, id):
         try:
-            self.get_image(id)
+            self.get_image_meta(id)
         except exceptions.NotFound:
             return True
         return False