improve minDisk checking
If a new image is created from an instance, it is expected that the new
image's minDisk is the same as the original images. This is not valid
with at least with VHD images. See the bug description for a link to a
unit test that proves this. This patch checks if the minDisk is either
the original minDisk or the disk size of the flavor.
Fixes bug 1198265
Change-Id: I59ecb79c933e44b4a9f2d565e050a8f9fd9ac767
diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index 4163245..7740cfc 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -40,7 +40,6 @@
def setUpClass(cls):
super(ImagesOneServerTestJSON, cls).setUpClass()
cls.client = cls.images_client
- cls.servers_client = cls.servers_client
try:
resp, cls.server = cls.create_server(wait_until='ACTIVE')
@@ -104,6 +103,10 @@
self.assertRaises(exceptions.NotFound,
self.alt_client.delete_image, image_id)
+ def _get_default_flavor_disk_size(self, flavor_id):
+ resp, flavor = self.flavors_client.get_flavor_details(flavor_id)
+ return flavor['disk']
+
@testtools.skipUnless(compute.CREATE_IMAGE_ENABLED,
'Environment unable to create images.')
@attr(type='smoke')
@@ -123,10 +126,15 @@
self.assertEqual(name, image['name'])
self.assertEqual('test', image['metadata']['image_type'])
- # Verify minRAM and minDisk values are the same as the original image
resp, original_image = self.client.get_image(self.image_ref)
- self.assertEqual(original_image['minRam'], image['minRam'])
- self.assertEqual(original_image['minDisk'], image['minDisk'])
+
+ # Verify minRAM is the same as the original image
+ self.assertEqual(image['minRam'], original_image['minRam'])
+
+ # Verify minDisk is the same as the original image or the flavor size
+ flavor_disk_size = self._get_default_flavor_disk_size(self.flavor_ref)
+ self.assertIn(str(image['minDisk']),
+ (str(original_image['minDisk']), str(flavor_disk_size)))
# Verify the image was deleted correctly
resp, body = self.client.delete_image(image_id)