Fix to create an image with given min_ram value.
Currently the create_image() method creates an image by setting
'min_ram' value to zero.When create_image() is asked to create
an image with different 'min_ram' value say '40' it ignores this
and still creates the image with 'min_ram' value set to zero.
Also adding a new test named "test_register_image_with_min_ram"
just to make sure that create_image() indeed creates an image
with the given 'min_ram' value.
This fixes Bug #1166675
Change-Id: Ie90ec93c04b538dc9cb991e6836727a507c9eb00
diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/image_client.py
index a3b3e96..a8fab7f 100644
--- a/tempest/services/image/v1/json/image_client.py
+++ b/tempest/services/image/v1/json/image_client.py
@@ -139,7 +139,8 @@
headers = {}
- for option in ['is_public', 'location', 'properties', 'copy_from']:
+ for option in ['is_public', 'location', 'properties',
+ 'copy_from', 'min_ram']:
if option in kwargs:
params[option] = kwargs.get(option)
diff --git a/tempest/tests/image/v1/test_images.py b/tempest/tests/image/v1/test_images.py
index 1b6fa10..0065d27 100644
--- a/tempest/tests/image/v1/test_images.py
+++ b/tempest/tests/image/v1/test_images.py
@@ -117,6 +117,26 @@
self.assertEqual(resp['status'], '200')
self.assertEqual(body, data)
+ @attr(type='image')
+ def test_register_image_with_min_ram(self):
+ # Register an image with min ram
+ properties = {'prop1': 'val1'}
+ resp, body = self.create_image(name='New_image_with_min_ram',
+ container_format='bare',
+ disk_format='raw',
+ is_public=True,
+ min_ram=40,
+ properties=properties)
+ self.assertTrue('id' in body)
+ image_id = body.get('id')
+ self.created_images.append(image_id)
+ self.assertEqual('New_image_with_min_ram', body.get('name'))
+ self.assertTrue(body.get('is_public'))
+ self.assertEqual('queued', body.get('status'))
+ self.assertEqual(40, body.get('min_ram'))
+ for key, val in properties.items():
+ self.assertEqual(val, body.get('properties')[key])
+
class ListImagesTest(base.BaseV1ImageTest):