Fix volume XML tests
Run the xml version in the .*XML classes instead of the json version.
Change-Id: Ib7d92119ecf1b1c5ecca8b14747b628c7e70eb7d
diff --git a/tempest/services/volume/xml/volumes_client.py b/tempest/services/volume/xml/volumes_client.py
index b0104e0..440a80e 100644
--- a/tempest/services/volume/xml/volumes_client.py
+++ b/tempest/services/volume/xml/volumes_client.py
@@ -37,7 +37,7 @@
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(VolumesClientXML, self).__init__(config, username, password,
auth_url, tenant_name)
- self.service = self.config.compute.catalog_type
+ self.service = self.config.volume.catalog_type
self.build_interval = self.config.compute.build_interval
self.build_timeout = self.config.compute.build_timeout
@@ -50,10 +50,11 @@
ns, tag = tag.split("}", 1)
if tag == 'metadata':
vol['metadata'] = dict((meta.get('key'),
- meta.text) for meta in list(child))
+ meta.text) for meta in
+ child.getchildren())
else:
vol[tag] = xml_to_json(child)
- return vol
+ return vol
def list_volumes(self, params=None):
"""List all the volumes created."""
@@ -90,25 +91,33 @@
body = etree.fromstring(body)
return resp, self._parse_volume(body)
- def create_volume(self, size, display_name=None, metadata=None):
+ def create_volume(self, size, **kwargs):
"""Creates a new Volume.
:param size: Size of volume in GB. (Required)
:param display_name: Optional Volume Name.
:param metadata: An optional dictionary of values for metadata.
+ :param volume_type: Optional Name of volume_type for the volume
+ :param snapshot_id: When specified the volume is created from
+ this snapshot
"""
volume = Element("volume", xmlns=XMLNS_11, size=size)
- if display_name:
- volume.add_attr('display_name', display_name)
- if metadata:
+ if 'metadata' in kwargs:
_metadata = Element('metadata')
volume.append(_metadata)
- for key, value in metadata.items():
+ for key, value in kwargs['metadata'].items():
meta = Element('meta')
meta.add_attr('key', key)
meta.append(Text(value))
_metadata.append(meta)
+ attr_to_add = kwargs.copy()
+ del attr_to_add['metadata']
+ else:
+ attr_to_add = kwargs
+
+ for key, value in attr_to_add.items():
+ volume.add_attr(key, value)
resp, body = self.post('volumes', str(Document(volume)),
self.headers)
@@ -122,7 +131,6 @@
def wait_for_volume_status(self, volume_id, status):
"""Waits for a Volume to reach a given status."""
resp, body = self.get_volume(volume_id)
- volume_name = body['displayName']
volume_status = body['status']
start = int(time.time())
@@ -135,7 +143,8 @@
if int(time.time()) - start >= self.build_timeout:
message = 'Volume %s failed to reach %s status within '\
- 'the required time (%s s).' % (volume_name, status,
+ 'the required time (%s s).' % (volume_id,
+ status,
self.build_timeout)
raise exceptions.TimeoutException(message)
diff --git a/tempest/tests/volume/admin/test_volume_types.py b/tempest/tests/volume/admin/test_volume_types.py
index cef8428..7184f11 100644
--- a/tempest/tests/volume/admin/test_volume_types.py
+++ b/tempest/tests/volume/admin/test_volume_types.py
@@ -21,6 +21,7 @@
class VolumeTypesTest(BaseVolumeTest):
+ _interface = "json"
@classmethod
def setUpClass(cls):
diff --git a/tempest/tests/volume/admin/test_volume_types_extra_specs.py b/tempest/tests/volume/admin/test_volume_types_extra_specs.py
index d3fd8e5..c743567 100644
--- a/tempest/tests/volume/admin/test_volume_types_extra_specs.py
+++ b/tempest/tests/volume/admin/test_volume_types_extra_specs.py
@@ -21,6 +21,7 @@
class VolumeTypesExtraSpecsTest(BaseVolumeTest):
+ _interface = "json"
@classmethod
def setUpClass(cls):
diff --git a/tempest/tests/volume/base.py b/tempest/tests/volume/base.py
index de78c99..32c211e 100644
--- a/tempest/tests/volume/base.py
+++ b/tempest/tests/volume/base.py
@@ -43,9 +43,10 @@
username, tenant_name, password = creds
os = clients.Manager(username=username,
password=password,
- tenant_name=tenant_name)
+ tenant_name=tenant_name,
+ interface=cls._interface)
else:
- os = clients.Manager()
+ os = clients.Manager(interface=cls._interface)
cls.os = os
cls.volumes_client = os.volumes_client
diff --git a/tempest/tests/volume/test_volumes_actions.py b/tempest/tests/volume/test_volumes_actions.py
index 155acb6..dd93b89 100644
--- a/tempest/tests/volume/test_volumes_actions.py
+++ b/tempest/tests/volume/test_volumes_actions.py
@@ -22,6 +22,7 @@
class VolumesActionsTest(BaseVolumeTest):
+ _interface = "json"
@classmethod
def setUpClass(cls):