Merge "Adds create volume from image test"
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index 6b0befd..87c0eba 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -72,6 +72,7 @@
metadata: A dictionary of values to be used as metadata.
volume_type: Optional Name of volume_type for the volume
snapshot_id: When specified the volume is created from this snapshot
+ imageRef: When specified the volume is created from this image
"""
post_body = {'size': size}
post_body.update(kwargs)
diff --git a/tempest/services/volume/xml/volumes_client.py b/tempest/services/volume/xml/volumes_client.py
index 6fd1397..8eda26b 100644
--- a/tempest/services/volume/xml/volumes_client.py
+++ b/tempest/services/volume/xml/volumes_client.py
@@ -100,6 +100,8 @@
:param volume_type: Optional Name of volume_type for the volume
:param snapshot_id: When specified the volume is created from
this snapshot
+ :param imageRef: When specified the volume is created from this
+ image
"""
#NOTE(afazekas): it should use a volume namespace
volume = Element("volume", xmlns=XMLNS_11, size=size)
diff --git a/tempest/tests/volume/test_volumes_get.py b/tempest/tests/volume/test_volumes_get.py
index a246afe..8e80e18 100644
--- a/tempest/tests/volume/test_volumes_get.py
+++ b/tempest/tests/volume/test_volumes_get.py
@@ -29,17 +29,22 @@
super(VolumesGetTest, cls).setUpClass()
cls.client = cls.volumes_client
- @attr(type='smoke')
- def test_volume_create_get_delete(self):
+ def _volume_create_get_delete(self, image_ref=None):
# Create a volume, Get it's details and Delete the volume
try:
volume = {}
v_name = rand_name('Volume-')
metadata = {'Type': 'work'}
#Create a volume
- resp, volume = self.client.create_volume(size=1,
- display_name=v_name,
- metadata=metadata)
+ if not image_ref:
+ resp, volume = self.client.create_volume(size=1,
+ display_name=v_name,
+ metadata=metadata)
+ else:
+ resp, volume = self.client.create_volume(size=1,
+ display_name=v_name,
+ metadata=metadata,
+ imageRef=image_ref)
self.assertEqual(200, resp.status)
self.assertTrue('id' in volume)
self.assertTrue('display_name' in volume)
@@ -100,6 +105,14 @@
self.assertEqual(202, resp.status)
self.client.wait_for_resource_deletion(volume['id'])
+ @attr(type='smoke')
+ def test_volume_create_get_delete(self):
+ self._volume_create_get_delete(image_ref=None)
+
+ @attr(type='smoke')
+ def test_volume_from_image(self):
+ self._volume_create_get_delete(image_ref=self.config.compute.image_ref)
+
class VolumesGetTestXML(VolumesGetTest):
_interface = "xml"