Check volume and minimum disk sizes to create volume

Check minimum disk size before attempting to create a volume
from an image. Use the maximum between that value and the volume
size specified in the configuration.

Change-Id: I8e540de90b308877575816edb8305588b1fe6e17
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index b9aeb99..ba982ed 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -113,6 +113,12 @@
         if 'size' not in kwargs:
             kwargs['size'] = CONF.volume.volume_size
 
+        if 'imageRef' in kwargs:
+            image = cls.compute_images_client.show_image(
+                kwargs['imageRef'])['image']
+            min_disk = image.get('minDisk')
+            kwargs['size'] = max(kwargs['size'], min_disk)
+
         name_field = cls.special_fields['name_field']
         if name_field not in kwargs:
             name = data_utils.rand_name(cls.__name__ + '-Volume')
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 8b86267..73544d9 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -219,6 +219,10 @@
                       imageRef=None, volume_type=None):
         if size is None:
             size = CONF.volume.volume_size
+        if imageRef:
+            image = self.compute_images_client.show_image(imageRef)['image']
+            min_disk = image.get('minDisk')
+            size = max(size, min_disk)
         if name is None:
             name = data_utils.rand_name(self.__class__.__name__ + "-volume")
         kwargs = {'display_name': name,