Merge "Add tearDownClass to base swift test class"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 2f07a19..cca3cdd 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -53,6 +53,9 @@
# The above administrative user's tenant name
admin_tenant_name = admin
+# The role that is required to administrate keystone.
+admin_role = admin
+
[compute]
# This section contains configuration options used when executing tests
# against the OpenStack Compute API.
@@ -223,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/common/isolated_creds.py b/tempest/common/isolated_creds.py
index 22e1bd2..d6b4466 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -141,10 +141,11 @@
role = None
try:
roles = self._list_roles()
+ admin_role = self.config.identity.admin_role
if self.tempest_client:
- role = next(r for r in roles if r['name'] == 'admin')
+ role = next(r for r in roles if r['name'] == admin_role)
else:
- role = next(r for r in roles if r.name == 'admin')
+ role = next(r for r in roles if r.name == admin_role)
except StopIteration:
msg = "No admin role found"
raise exceptions.NotFound(msg)
diff --git a/tempest/config.py b/tempest/config.py
index acb0e8d..100c673 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -51,6 +51,9 @@
cfg.StrOpt('tenant_name',
default='demo',
help="Tenant name to use for Nova API requests."),
+ cfg.StrOpt('admin_role',
+ default='admin',
+ help="Role required to administrate keystone."),
cfg.StrOpt('password',
default='pass',
help="API key to use when authenticating.",
@@ -323,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))