Use image minDisk as volume size when necessary

When creating a volume from an image, it is possible
that the configured volume_size value is less than
the minDisk of the image, which causes the test to
fail. In this case, the size of the created volume
should be the minDisk size instead.

Change-Id: I06f47fdcef7d36b9bb7793d29b5fe86bf6080b98
Closes-Bug: #1475746
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index f8ae5eb..b67a6d2 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -62,6 +62,7 @@
         super(BaseVolumeTest, cls).setup_clients()
         cls.servers_client = cls.os.servers_client
         cls.networks_client = cls.os.networks_client
+        cls.images_client = cls.os.images_client
 
         if cls._api_version == 1:
             cls.snapshots_client = cls.os.snapshots_client
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index 29c21ed..a90f9ca 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -131,7 +131,11 @@
     @test.idempotent_id('54a01030-c7fc-447c-86ee-c1182beae638')
     @test.services('image')
     def test_volume_create_get_update_delete_from_image(self):
-        self._volume_create_get_update_delete(imageRef=CONF.compute.image_ref)
+        image = self.images_client.show_image(CONF.compute.image_ref)
+        min_disk = image.get('minDisk')
+        disk_size = max(min_disk, CONF.volume.volume_size)
+        self._volume_create_get_update_delete(
+            imageRef=CONF.compute.image_ref, size=disk_size)
 
     @test.idempotent_id('3f591b4a-7dc6-444c-bd51-77469506b3a1')
     def test_volume_create_get_update_delete_as_clone(self):