Merge "Adds disk_format parameter to upload_volume method in volumes client"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 1ce8f75..cca3cdd 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -226,6 +226,8 @@
# Unless you have a custom Keystone service catalog implementation, you
# probably want to leave this value as "volume"
catalog_type = volume
+# The disk format to use when copying a volume to image
+disk_format = raw
# Number of seconds to wait while looping to check the status of a
# volume that is being made available
build_interval = 10
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 766a2c7..ad80505 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -103,7 +103,9 @@
# there is no way to delete it from Cinder, so we delete it from Glance
# using the Glance image_client and from Cinder via tearDownClass.
image_name = rand_name('Image-')
- resp, body = self.client.upload_volume(self.volume['id'], image_name)
+ resp, body = self.client.upload_volume(self.volume['id'],
+ image_name,
+ self.config.volume.disk_format)
image_id = body["image_id"]
self.addCleanup(self.image_client.delete_image, image_id)
self.assertEqual(202, resp.status)
diff --git a/tempest/config.py b/tempest/config.py
index ac1999d..100c673 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -326,6 +326,9 @@
cfg.StrOpt('vendor_name',
default='Open Source',
help='Backend vendor to target when creating volume types'),
+ cfg.StrOpt('disk_format',
+ default='raw',
+ help='Disk format to use when copying a volume to image'),
]
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index 2ae73b1..c35452e 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -89,10 +89,11 @@
"""Deletes the Specified Volume."""
return self.delete("volumes/%s" % str(volume_id))
- def upload_volume(self, volume_id, image_name):
+ def upload_volume(self, volume_id, image_name, disk_format):
"""Uploads a volume in Glance."""
post_body = {
'image_name': image_name,
+ 'disk_format': disk_format
}
post_body = json.dumps({'os-volume_upload_image': post_body})
url = 'volumes/%s/action' % (volume_id)
diff --git a/tempest/services/volume/xml/volumes_client.py b/tempest/services/volume/xml/volumes_client.py
index 936e036..ecbfb19 100644
--- a/tempest/services/volume/xml/volumes_client.py
+++ b/tempest/services/volume/xml/volumes_client.py
@@ -183,10 +183,11 @@
body = xml_to_json(etree.fromstring(body))
return resp, body
- def upload_volume(self, volume_id, image_name):
+ def upload_volume(self, volume_id, image_name, disk_format):
"""Uploads a volume in Glance."""
post_body = Element("os-volume_upload_image",
- image_name=image_name)
+ image_name=image_name,
+ disk_format=disk_format)
url = 'volumes/%s/action' % str(volume_id)
resp, body = self.post(url, str(Document(post_body)), self.headers)
volume = xml_to_json(etree.fromstring(body))