Merge "Use names containing "invalid" or "nonexistent" as invalid name"
diff --git a/tempest/api/compute/servers/test_attach_interfaces.py b/tempest/api/compute/servers/test_attach_interfaces.py
index fc6a20f..8342a3e 100644
--- a/tempest/api/compute/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/servers/test_attach_interfaces.py
@@ -50,30 +50,6 @@
cls.subnets_client = cls.os.subnets_client
cls.ports_client = cls.os.ports_client
- def wait_for_interface_status(self, server, port_id, status):
- """Waits for an interface to reach a given status."""
- body = (self.interfaces_client.show_interface(server, port_id)
- ['interfaceAttachment'])
- interface_status = body['port_state']
- start = int(time.time())
-
- while(interface_status != status):
- time.sleep(self.build_interval)
- body = (self.interfaces_client.show_interface(server, port_id)
- ['interfaceAttachment'])
- interface_status = body['port_state']
-
- timed_out = int(time.time()) - start >= self.build_timeout
-
- if interface_status != status and timed_out:
- message = ('Interface %s failed to reach %s status '
- '(current %s) within the required time (%s s).' %
- (port_id, status, interface_status,
- self.build_timeout))
- raise lib_exc.TimeoutException(message)
-
- return body
-
# TODO(mriedem): move this into a common waiters utility module
def wait_for_port_detach(self, port_id):
"""Waits for the port's device_id to be unset.
@@ -118,16 +94,16 @@
server = self.create_test_server(wait_until='ACTIVE')
ifs = (self.interfaces_client.list_interfaces(server['id'])
['interfaceAttachments'])
- body = self.wait_for_interface_status(
- server['id'], ifs[0]['port_id'], 'ACTIVE')
+ body = waiters.wait_for_interface_status(
+ self.interfaces_client, server['id'], ifs[0]['port_id'], 'ACTIVE')
ifs[0]['port_state'] = body['port_state']
return server, ifs
def _test_create_interface(self, server):
iface = (self.interfaces_client.create_interface(server['id'])
['interfaceAttachment'])
- iface = self.wait_for_interface_status(
- server['id'], iface['port_id'], 'ACTIVE')
+ iface = waiters.wait_for_interface_status(
+ self.interfaces_client, server['id'], iface['port_id'], 'ACTIVE')
self._check_interface(iface)
return iface
@@ -135,8 +111,8 @@
network_id = ifs[0]['net_id']
iface = self.interfaces_client.create_interface(
server['id'], net_id=network_id)['interfaceAttachment']
- iface = self.wait_for_interface_status(
- server['id'], iface['port_id'], 'ACTIVE')
+ iface = waiters.wait_for_interface_status(
+ self.interfaces_client, server['id'], iface['port_id'], 'ACTIVE')
self._check_interface(iface, network_id=network_id)
return iface
@@ -147,8 +123,8 @@
self.addCleanup(self.ports_client.delete_port, port_id)
iface = self.interfaces_client.create_interface(
server['id'], port_id=port_id)['interfaceAttachment']
- iface = self.wait_for_interface_status(
- server['id'], iface['port_id'], 'ACTIVE')
+ iface = waiters.wait_for_interface_status(
+ self.interfaces_client, server['id'], iface['port_id'], 'ACTIVE')
self._check_interface(iface, port_id=port_id)
return iface
@@ -166,8 +142,8 @@
server['id'], net_id=network_id,
fixed_ips=fixed_ips)['interfaceAttachment']
self.addCleanup(self.ports_client.delete_port, iface['port_id'])
- iface = self.wait_for_interface_status(
- server['id'], iface['port_id'], 'ACTIVE')
+ iface = waiters.wait_for_interface_status(
+ self.interfaces_client, server['id'], iface['port_id'], 'ACTIVE')
self._check_interface(iface, fixed_ip=ip_list[0])
return iface
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 50910ec..0a94d5e 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import logging
-
+from oslo_log import log as logging
from six.moves.urllib import parse as urlparse
import testtools
diff --git a/tempest/api/compute/volumes/test_volume_snapshots.py b/tempest/api/compute/volumes/test_volume_snapshots.py
index 460c882..01718cc 100644
--- a/tempest/api/compute/volumes/test_volume_snapshots.py
+++ b/tempest/api/compute/volumes/test_volume_snapshots.py
@@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import testtools
+
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.common import waiters
@@ -39,6 +41,8 @@
cls.snapshots_client = cls.snapshots_extensions_client
@test.idempotent_id('cd4ec87d-7825-450d-8040-6e2068f2da8f')
+ @testtools.skipUnless(CONF.volume_feature_enabled.snapshot,
+ 'Cinder volume snapshots are disabled')
def test_volume_snapshot_create_get_list_delete(self):
volume = self.create_volume()
self.addCleanup(self.delete_volume, volume['id'])
diff --git a/tempest/api/compute/volumes/test_volumes_list.py b/tempest/api/compute/volumes/test_volumes_list.py
index c60fcca..7d76731 100644
--- a/tempest/api/compute/volumes/test_volumes_list.py
+++ b/tempest/api/compute/volumes/test_volumes_list.py
@@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from oslo_log import log as logging
+
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.common import waiters
@@ -20,6 +22,7 @@
from tempest import test
CONF = config.CONF
+LOG = logging.getLogger(__name__)
class VolumesTestJSON(base.BaseV2ComputeTest):
@@ -59,21 +62,16 @@
volume = cls.client.show_volume(volume['id'])['volume']
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
- except Exception:
+ except Exception as exc:
+ LOG.exception(exc)
if cls.volume_list:
# We could not create all the volumes, though we were able
# to create *some* of the volumes. This is typically
# because the backing file size of the volume group is
- # too small. So, here, we clean up whatever we did manage
- # to create and raise a SkipTest
+ # too small.
for volume in cls.volume_list:
cls.delete_volume(volume['id'])
- msg = ("Failed to create ALL necessary volumes to run "
- "test. This typically means that the backing file "
- "size of the nova-volumes group is too small to "
- "create the 3 volumes needed by this test case")
- raise cls.skipException(msg)
- raise
+ raise exc
@classmethod
def resource_cleanup(cls):
diff --git a/tempest/api/compute/volumes/test_volumes_negative.py b/tempest/api/compute/volumes/test_volumes_negative.py
index 5fe4cb3..c4041cb 100644
--- a/tempest/api/compute/volumes/test_volumes_negative.py
+++ b/tempest/api/compute/volumes/test_volumes_negative.py
@@ -66,7 +66,7 @@
@test.attr(type=['negative'])
@test.idempotent_id('131cb3a1-75cc-4d40-b4c3-1317f64719b0')
- def test_create_volume_with_out_passing_size(self):
+ def test_create_volume_without_passing_size(self):
# Negative: Should not be able to create volume without passing size
# in request
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 5cf8084..42912f0 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -129,7 +129,6 @@
class ListImagesTest(base.BaseV2ImageTest):
- """Here we test the listing of image information"""
@classmethod
def resource_setup(cls):
@@ -157,23 +156,49 @@
"""
size = random.randint(1024, 4096)
image_file = six.BytesIO(data_utils.random_bytes(size))
+ tags = [data_utils.rand_name('tag'), data_utils.rand_name('tag')]
image = cls.create_image(container_format=container_format,
disk_format=disk_format,
- visibility='private')
+ visibility='private',
+ tags=tags)
cls.client.store_image_file(image['id'], data=image_file)
+ # Keep the data of one test image so it can be used to filter lists
+ cls.test_data = image
+ cls.test_data['size'] = size
return image['id']
+
+class ListUserImagesTest(ListImagesTest):
+ """Here we test the listing of image information"""
+
def _list_by_param_value_and_assert(self, params):
"""Perform list action with given params and validates result."""
-
+ # Retrieve the list of images that meet the filter
images_list = self.client.list_images(params=params)['images']
# Validating params of fetched images
+ msg = 'No images were found that met the filter criteria.'
+ self.assertNotEmpty(images_list, msg)
for image in images_list:
for key in params:
msg = "Failed to list images by %s" % key
self.assertEqual(params[key], image[key], msg)
+ def _list_sorted_by_image_size_and_assert(self, params, desc=False):
+ """Validate an image list that has been sorted by size
+
+ Perform list action with given params and validates the results are
+ sorted by image size in either ascending or descending order.
+ """
+ # Retrieve the list of images that meet the filter
+ images_list = self.client.list_images(params=params)['images']
+ # Validate that the list was fetched sorted accordingly
+ msg = 'No images were found that met the filter criteria.'
+ self.assertNotEmpty(images_list, msg)
+ sorted_list = [image['size'] for image in images_list]
+ msg = 'The list of images was not sorted correctly.'
+ self.assertEqual(sorted(sorted_list, reverse=desc), sorted_list, msg)
+
@test.idempotent_id('1e341d7a-90a9-494c-b143-2cdf2aeb6aee')
def test_list_no_params(self):
# Simple test to see all fixture images returned
@@ -185,8 +210,8 @@
@test.idempotent_id('9959ca1d-1aa7-4b7a-a1ea-0fff0499b37e')
def test_list_images_param_container_format(self):
- # Test to get all images with container_format='bare'
- params = {"container_format": "bare"}
+ # Test to get all images with a specific container_format
+ params = {"container_format": self.test_data['container_format']}
self._list_by_param_value_and_assert(params)
@test.idempotent_id('4a4735a7-f22f-49b6-b0d9-66e1ef7453eb')
@@ -254,6 +279,37 @@
params = {"owner": image['owner']}
self._list_by_param_value_and_assert(params)
+ @test.idempotent_id('55c8f5f5-bfed-409d-a6d5-4caeda985d7b')
+ def test_list_images_param_name(self):
+ # Test to get images by name
+ params = {'name': self.test_data['name']}
+ self._list_by_param_value_and_assert(params)
+
+ @test.idempotent_id('aa8ac4df-cff9-418b-8d0f-dd9c67b072c9')
+ def test_list_images_param_tag(self):
+ # Test to get images matching a tag
+ params = {'tag': self.test_data['tags'][0]}
+ images_list = self.client.list_images(params=params)['images']
+ # Validating properties of fetched images
+ self.assertNotEmpty(images_list)
+ for image in images_list:
+ msg = ("The image {image_name} does not have the expected tag "
+ "{expected_tag} among its tags: {observerd_tags}."
+ .format(image_name=image['name'],
+ expected_tag=self.test_data['tags'][0],
+ observerd_tags=image['tags']))
+ self.assertIn(self.test_data['tags'][0], image['tags'], msg)
+
+ @test.idempotent_id('eeadce49-04e0-43b7-aec7-52535d903e7a')
+ def test_list_images_param_sort(self):
+ params = {'sort': 'size:desc'}
+ self._list_sorted_by_image_size_and_assert(params, desc=True)
+
+ @test.idempotent_id('9faaa0c2-c3a5-43e1-8f61-61c54b409a49')
+ def test_list_images_param_sort_key_dir(self):
+ params = {'sort_key': 'size', 'sort_dir': 'desc'}
+ self._list_sorted_by_image_size_and_assert(params, desc=True)
+
@test.idempotent_id('622b925c-479f-4736-860d-adeaf13bc371')
def test_get_image_schema(self):
# Test to get image schema
@@ -267,3 +323,32 @@
schema = "images"
body = self.schemas_client.show_schema(schema)
self.assertEqual("images", body['name'])
+
+
+class ListSharedImagesTest(ListImagesTest):
+ """Here we test the listing of a shared image information"""
+
+ credentials = ['primary', 'alt']
+
+ @classmethod
+ def setup_clients(cls):
+ super(ListSharedImagesTest, cls).setup_clients()
+ cls.image_member_client = cls.os.image_member_client_v2
+ cls.alt_img_client = cls.os_alt.image_client_v2
+
+ @test.idempotent_id('3fa50be4-8e38-4c02-a8db-7811bb780122')
+ def test_list_images_param_member_status(self):
+ # Share one of the images created with the alt user
+ self.image_member_client.create_image_member(
+ image_id=self.test_data['id'],
+ member=self.alt_img_client.tenant_id)
+ # Update the info on the test data so it remains accurate
+ self.test_data['updated_at'] = self.client.show_image(
+ self.test_data['id'])['updated_at']
+ # As an image consumer you need to provide the member_status parameter
+ # along with the visibility=shared parameter in order for it to show
+ # results
+ params = {'member_status': 'pending', 'visibility': 'shared'}
+ fetched_images = self.alt_img_client.list_images(params)['images']
+ self.assertEqual(1, len(fetched_images))
+ self.assertEqual(self.test_data['id'], fetched_images[0]['id'])
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index a3792b4..bffcb64 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -10,10 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-
-import logging
-
import netaddr
+from oslo_log import log as logging
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 6db3807..f32c84a 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -116,6 +116,12 @@
if 'size' not in kwargs:
kwargs['size'] = CONF.volume.volume_size
+ if 'imageRef' in kwargs:
+ image = cls.compute_images_client.show_image(
+ kwargs['imageRef'])['image']
+ min_disk = image.get('minDisk')
+ kwargs['size'] = max(kwargs['size'], min_disk)
+
name_field = cls.special_fields['name_field']
if name_field not in kwargs:
name = data_utils.rand_name(cls.__name__ + '-Volume')
@@ -151,6 +157,18 @@
client.delete_volume(volume_id)
client.wait_for_resource_deletion(volume_id)
+ def attach_volume(self, server_id, volume_id):
+ """Attachs a volume to a server"""
+ self.servers_client.attach_volume(
+ server_id, volumeId=volume_id,
+ device='/dev/%s' % CONF.compute.volume_device_name)
+ waiters.wait_for_volume_status(self.volumes_client,
+ volume_id, 'in-use')
+ self.addCleanup(waiters.wait_for_volume_status, self.volumes_client,
+ volume_id, 'available')
+ self.addCleanup(self.servers_client.detach_volume, server_id,
+ self.volume_origin['id'])
+
@classmethod
def clear_volumes(cls):
for volume in cls.volumes:
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index fda0dda..6ed6b9c 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -62,7 +62,7 @@
@test.attr(type=['negative'])
@test.idempotent_id('9387686f-334f-4d31-a439-33494b9e2683')
- def test_create_volume_with_out_passing_size(self):
+ def test_create_volume_without_passing_size(self):
# Should not be able to create volume without passing size
# in request
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 3c05d3e..3c7a2c8 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -12,7 +12,6 @@
from tempest.api.volume import base
from tempest.common.utils import data_utils
-from tempest.common import waiters
from tempest import config
from tempest import test
@@ -46,21 +45,53 @@
# Create a snapshot when volume status is in-use
# Create a test instance
server = self.create_server(wait_until='ACTIVE')
- self.servers_client.attach_volume(
- server['id'], volumeId=self.volume_origin['id'],
- device='/dev/%s' % CONF.compute.volume_device_name)
- waiters.wait_for_volume_status(self.volumes_client,
- self.volume_origin['id'], 'in-use')
- self.addCleanup(waiters.wait_for_volume_status, self.volumes_client,
- self.volume_origin['id'], 'available')
- self.addCleanup(self.servers_client.detach_volume, server['id'],
- self.volume_origin['id'])
+ self.attach_volume(server['id'], self.volume_origin['id'])
+
# Snapshot a volume even if it's attached to an instance
snapshot = self.create_snapshot(self.volume_origin['id'],
force=True)
# Delete the snapshot
self.cleanup_snapshot(snapshot)
+ @test.idempotent_id('8567b54c-4455-446d-a1cf-651ddeaa3ff2')
+ @test.services('compute')
+ def test_snapshot_delete_with_volume_in_use(self):
+ # Create a test instance
+ server = self.create_server(wait_until='ACTIVE')
+ self.attach_volume(server['id'], self.volume_origin['id'])
+
+ # Snapshot a volume attached to an instance
+ snapshot1 = self.create_snapshot(self.volume_origin['id'], force=True)
+ snapshot2 = self.create_snapshot(self.volume_origin['id'], force=True)
+ snapshot3 = self.create_snapshot(self.volume_origin['id'], force=True)
+
+ # Delete the snapshots. Some snapshot implementations can take
+ # different paths according to order they are deleted.
+ self.cleanup_snapshot(snapshot1)
+ self.cleanup_snapshot(snapshot3)
+ self.cleanup_snapshot(snapshot2)
+
+ @test.idempotent_id('5210a1de-85a0-11e6-bb21-641c676a5d61')
+ @test.services('compute')
+ def test_snapshot_create_offline_delete_online(self):
+
+ # Create a snapshot while it is not attached
+ snapshot1 = self.create_snapshot(self.volume_origin['id'])
+
+ # Create a server and attach it
+ server = self.create_server(wait_until='ACTIVE')
+ self.attach_volume(server['id'], self.volume_origin['id'])
+
+ # Now that the volume is attached, create another snapshots
+ snapshot2 = self.create_snapshot(self.volume_origin['id'], force=True)
+ snapshot3 = self.create_snapshot(self.volume_origin['id'], force=True)
+
+ # Delete the snapshots. Some snapshot implementations can take
+ # different paths according to order they are deleted.
+ self.cleanup_snapshot(snapshot3)
+ self.cleanup_snapshot(snapshot1)
+ self.cleanup_snapshot(snapshot2)
+
@test.idempotent_id('2a8abbe4-d871-46db-b049-c41f5af8216e')
def test_snapshot_create_get_list_update_delete(self):
# Create a snapshot
diff --git a/tempest/cmd/main.py b/tempest/cmd/main.py
index 641d11c..1090c41 100644
--- a/tempest/cmd/main.py
+++ b/tempest/cmd/main.py
@@ -11,11 +11,11 @@
# License for the specific language governing permissions and limitations
# under the License.
-import logging
import sys
from cliff import app
from cliff import commandmanager
+from oslo_log import log as logging
from pbr import version
diff --git a/tempest/common/waiters.py b/tempest/common/waiters.py
index 0cf8154..981a922 100644
--- a/tempest/common/waiters.py
+++ b/tempest/common/waiters.py
@@ -290,3 +290,28 @@
if int(time.time()) - start_time >= client.build_timeout:
raise lib_exc.TimeoutException
time.sleep(client.build_interval)
+
+
+def wait_for_interface_status(client, server, port_id, status):
+ """Waits for an interface to reach a given status."""
+ body = (client.show_interface(server, port_id)
+ ['interfaceAttachment'])
+ interface_status = body['port_state']
+ start = int(time.time())
+
+ while(interface_status != status):
+ time.sleep(client.build_interval)
+ body = (client.show_interface(server, port_id)
+ ['interfaceAttachment'])
+ interface_status = body['port_state']
+
+ timed_out = int(time.time()) - start >= client.build_timeout
+
+ if interface_status != status and timed_out:
+ message = ('Interface %s failed to reach %s status '
+ '(current %s) within the required time (%s s).' %
+ (port_id, status, interface_status,
+ client.build_timeout))
+ raise lib_exc.TimeoutException(message)
+
+ return body
diff --git a/tempest/lib/services/volume/v1/snapshots_client.py b/tempest/lib/services/volume/v1/snapshots_client.py
index 1881078..2cf1555 100644
--- a/tempest/lib/services/volume/v1/snapshots_client.py
+++ b/tempest/lib/services/volume/v1/snapshots_client.py
@@ -25,8 +25,9 @@
def list_snapshots(self, detail=False, **params):
"""List all the snapshot.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v1.html#listSnapshots
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v1.html#listSnapshots
"""
url = 'snapshots'
if detail:
@@ -42,8 +43,9 @@
def show_snapshot(self, snapshot_id):
"""Returns the details of a single snapshot.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v1.html#showSnapshot
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v1.html#showSnapshot
"""
url = "snapshots/%s" % snapshot_id
resp, body = self.get(url)
@@ -54,8 +56,9 @@
def create_snapshot(self, **kwargs):
"""Creates a new snapshot.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v1.html#createSnapshot
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v1.html#createSnapshot
"""
post_body = json.dumps({'snapshot': kwargs})
resp, body = self.post('snapshots', post_body)
@@ -66,8 +69,9 @@
def delete_snapshot(self, snapshot_id):
"""Delete Snapshot.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v1.html#deleteSnapshot
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v1.html#deleteSnapshot
"""
resp, body = self.delete("snapshots/%s" % snapshot_id)
self.expected_success(202, resp.status)
@@ -117,9 +121,9 @@
def update_snapshot(self, snapshot_id, **kwargs):
"""Updates a snapshot.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v1.html#
- updateSnapshotMetadata
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v1.html#updateSnapshotMetadata
"""
put_body = json.dumps({'snapshot': kwargs})
resp, body = self.put('snapshots/%s' % snapshot_id, put_body)
@@ -130,9 +134,9 @@
def show_snapshot_metadata(self, snapshot_id):
"""Get metadata of the snapshot.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v1.html#
- showSnapshotMetadata
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v1.html#showSnapshotMetadata
"""
url = "snapshots/%s/metadata" % snapshot_id
resp, body = self.get(url)
@@ -143,9 +147,9 @@
def update_snapshot_metadata(self, snapshot_id, **kwargs):
"""Update metadata for the snapshot.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v1.html#
- updateSnapshotMetadata
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v1.html#updateSnapshotMetadata
"""
put_body = json.dumps(kwargs)
url = "snapshots/%s/metadata" % snapshot_id
diff --git a/tempest/lib/services/volume/v1/types_client.py b/tempest/lib/services/volume/v1/types_client.py
index dce728d..2b696e5 100644
--- a/tempest/lib/services/volume/v1/types_client.py
+++ b/tempest/lib/services/volume/v1/types_client.py
@@ -38,8 +38,9 @@
def list_volume_types(self, **params):
"""List all the volume_types created.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v1.html#listVolumeTypes
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v1.html#listVolumeTypes
"""
url = 'types'
if params:
@@ -53,8 +54,9 @@
def show_volume_type(self, volume_type_id):
"""Returns the details of a single volume_type.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v1.html#showVolumeType
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v1.html#showVolumeType
"""
url = "types/%s" % volume_type_id
resp, body = self.get(url)
@@ -65,8 +67,9 @@
def create_volume_type(self, **kwargs):
"""Create volume type.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v1.html#createVolumeType
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v1.html#createVolumeType
"""
post_body = json.dumps({'volume_type': kwargs})
resp, body = self.post('types', post_body)
@@ -77,8 +80,9 @@
def delete_volume_type(self, volume_type_id):
"""Deletes the Specified Volume_type.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v1.html#deleteVolumeType
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v1.html#deleteVolumeType
"""
resp, body = self.delete("types/%s" % volume_type_id)
self.expected_success(202, resp.status)
@@ -131,8 +135,9 @@
def update_volume_type(self, volume_type_id, **kwargs):
"""Updates volume type name, description, and/or is_public.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#updateVolumeType
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#updateVolumeType
"""
put_body = json.dumps({'volume_type': kwargs})
resp, body = self.put('types/%s' % volume_type_id, put_body)
@@ -148,9 +153,9 @@
extra_spec_name: Name of the extra spec to be updated.
extra_spec: A dictionary of with key as extra_spec_name and the
updated value.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#
- updateVolumeTypeExtraSpecs
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#updateVolumeTypeExtraSpecs
"""
url = "types/%s/extra_specs/%s" % (volume_type_id, extra_spec_name)
put_body = json.dumps(extra_specs)
diff --git a/tempest/lib/services/volume/v1/volumes_client.py b/tempest/lib/services/volume/v1/volumes_client.py
index cc98c91..242befc 100644
--- a/tempest/lib/services/volume/v1/volumes_client.py
+++ b/tempest/lib/services/volume/v1/volumes_client.py
@@ -61,8 +61,9 @@
def create_volume(self, **kwargs):
"""Creates a new Volume.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#createVolume
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#createVolume
"""
post_body = json.dumps({'volume': kwargs})
resp, body = self.post('volumes', post_body)
@@ -73,8 +74,9 @@
def update_volume(self, volume_id, **kwargs):
"""Updates the Specified Volume.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#updateVolume
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#updateVolume
"""
put_body = json.dumps({'volume': kwargs})
resp, body = self.put('volumes/%s' % volume_id, put_body)
@@ -100,8 +102,9 @@
def attach_volume(self, volume_id, **kwargs):
"""Attaches a volume to a given instance on a given mountpoint.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#attachVolume
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#attachVolume
"""
post_body = json.dumps({'os-attach': kwargs})
url = 'volumes/%s/action' % (volume_id)
@@ -156,8 +159,9 @@
def extend_volume(self, volume_id, **kwargs):
"""Extend a volume.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#extendVolume
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#extendVolume
"""
post_body = json.dumps({'os-extend': kwargs})
url = 'volumes/%s/action' % (volume_id)
@@ -168,8 +172,9 @@
def reset_volume_status(self, volume_id, **kwargs):
"""Reset the Specified Volume's Status.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#resetVolume
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#resetVolume
"""
post_body = json.dumps({'os-reset_status': kwargs})
resp, body = self.post('volumes/%s/action' % volume_id, post_body)
@@ -179,8 +184,9 @@
def create_volume_transfer(self, **kwargs):
"""Create a volume transfer.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#createVolumeTransfer
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#createVolumeTransfer
"""
post_body = json.dumps({'transfer': kwargs})
resp, body = self.post('os-volume-transfer', post_body)
@@ -199,8 +205,9 @@
def list_volume_transfers(self, **params):
"""List all the volume transfers created.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#listVolumeTransfer
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#listVolumeTransfer
"""
url = 'os-volume-transfer'
if params:
@@ -219,8 +226,9 @@
def accept_volume_transfer(self, transfer_id, **kwargs):
"""Accept a volume transfer.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#acceptVolumeTransfer
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#acceptVolumeTransfer
"""
url = 'os-volume-transfer/%s/accept' % transfer_id
post_body = json.dumps({'accept': kwargs})
diff --git a/tempest/lib/services/volume/v2/backups_client.py b/tempest/lib/services/volume/v2/backups_client.py
index 61f865d..ab5eefd 100644
--- a/tempest/lib/services/volume/v2/backups_client.py
+++ b/tempest/lib/services/volume/v2/backups_client.py
@@ -26,8 +26,9 @@
def create_backup(self, **kwargs):
"""Creates a backup of volume.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#createBackup
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#createBackup
"""
post_body = json.dumps({'backup': kwargs})
resp, body = self.post('backups', post_body)
@@ -38,8 +39,9 @@
def restore_backup(self, backup_id, **kwargs):
"""Restore volume from backup.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#restoreBackup
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#restoreBackup
"""
post_body = json.dumps({'restore': kwargs})
resp, body = self.post('backups/%s/restore' % (backup_id), post_body)
diff --git a/tempest/lib/services/volume/v2/snapshots_client.py b/tempest/lib/services/volume/v2/snapshots_client.py
index c84e557..dd0f407 100644
--- a/tempest/lib/services/volume/v2/snapshots_client.py
+++ b/tempest/lib/services/volume/v2/snapshots_client.py
@@ -25,8 +25,9 @@
def list_snapshots(self, detail=False, **params):
"""List all the snapshot.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#listSnapshots
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#listSnapshots
"""
url = 'snapshots'
if detail:
@@ -42,8 +43,9 @@
def show_snapshot(self, snapshot_id):
"""Returns the details of a single snapshot.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#showSnapshot
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#showSnapshot
"""
url = "snapshots/%s" % snapshot_id
resp, body = self.get(url)
@@ -54,8 +56,9 @@
def create_snapshot(self, **kwargs):
"""Creates a new snapshot.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#createSnapshot
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#createSnapshot
"""
post_body = json.dumps({'snapshot': kwargs})
resp, body = self.post('snapshots', post_body)
@@ -66,8 +69,9 @@
def update_snapshot(self, snapshot_id, **kwargs):
"""Updates a snapshot.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#updateSnapshot
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#updateSnapshot
"""
put_body = json.dumps({'snapshot': kwargs})
resp, body = self.put('snapshots/%s' % snapshot_id, put_body)
@@ -78,8 +82,9 @@
def delete_snapshot(self, snapshot_id):
"""Delete Snapshot.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#deleteSnapshot
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#deleteSnapshot
"""
resp, body = self.delete("snapshots/%s" % snapshot_id)
self.expected_success(202, resp.status)
@@ -129,9 +134,9 @@
def show_snapshot_metadata(self, snapshot_id):
"""Get metadata of the snapshot.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#
- showSnapshotMetadata
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#showSnapshotMetadata
"""
url = "snapshots/%s/metadata" % snapshot_id
resp, body = self.get(url)
@@ -142,9 +147,9 @@
def update_snapshot_metadata(self, snapshot_id, **kwargs):
"""Update metadata for the snapshot.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#
- updateSnapshotMetadata
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#updateSnapshotMetadata
"""
put_body = json.dumps(kwargs)
url = "snapshots/%s/metadata" % snapshot_id
diff --git a/tempest/lib/services/volume/v2/types_client.py b/tempest/lib/services/volume/v2/types_client.py
index d399e99..7a0d6d0 100644
--- a/tempest/lib/services/volume/v2/types_client.py
+++ b/tempest/lib/services/volume/v2/types_client.py
@@ -39,8 +39,9 @@
def list_volume_types(self, **params):
"""List all the volume_types created.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#showVolumeTypes
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#showVolumeTypes
"""
url = 'types'
if params:
@@ -54,8 +55,9 @@
def show_volume_type(self, volume_type_id):
"""Returns the details of a single volume_type.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#showVolumeType
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#showVolumeType
"""
url = "types/%s" % volume_type_id
resp, body = self.get(url)
@@ -66,8 +68,9 @@
def create_volume_type(self, **kwargs):
"""Create volume type.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#createVolumeType
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#createVolumeType
"""
post_body = json.dumps({'volume_type': kwargs})
resp, body = self.post('types', post_body)
@@ -78,8 +81,9 @@
def delete_volume_type(self, volume_type_id):
"""Deletes the Specified Volume_type.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#deleteVolumeType
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#deleteVolumeType
"""
resp, body = self.delete("types/%s" % volume_type_id)
self.expected_success(202, resp.status)
@@ -132,8 +136,9 @@
def update_volume_type(self, volume_type_id, **kwargs):
"""Updates volume type name, description, and/or is_public.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#updateVolumeType
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#updateVolumeType
"""
put_body = json.dumps({'volume_type': kwargs})
resp, body = self.put('types/%s' % volume_type_id, put_body)
@@ -149,9 +154,9 @@
extra_spec_name: Name of the extra spec to be updated.
extra_spec: A dictionary of with key as extra_spec_name and the
updated value.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#
- updateVolumeTypeExtraSpecs
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#updateVolumeTypeExtraSpecs
"""
url = "types/%s/extra_specs/%s" % (volume_type_id, extra_spec_name)
put_body = json.dumps(extra_specs)
@@ -163,9 +168,9 @@
def add_type_access(self, volume_type_id, **kwargs):
"""Adds volume type access for the given project.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html
- #createVolumeTypeAccessExt
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#createVolumeTypeAccessExt
"""
post_body = json.dumps({'addProjectAccess': kwargs})
url = 'types/%s/action' % volume_type_id
@@ -176,9 +181,9 @@
def remove_type_access(self, volume_type_id, **kwargs):
"""Removes volume type access for the given project.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html
- #removeVolumeTypeAccessExt
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#removeVolumeTypeAccessExt
"""
post_body = json.dumps({'removeProjectAccess': kwargs})
url = 'types/%s/action' % volume_type_id
@@ -189,9 +194,9 @@
def list_type_access(self, volume_type_id):
"""Print access information about the given volume type.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#
- listVolumeTypeAccessExt
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#listVolumeTypeAccessExt
"""
url = 'types/%s/os-volume-type-access' % volume_type_id
resp, body = self.get(url)
diff --git a/tempest/lib/services/volume/v2/volumes_client.py b/tempest/lib/services/volume/v2/volumes_client.py
index b1930e1..1fb5727 100644
--- a/tempest/lib/services/volume/v2/volumes_client.py
+++ b/tempest/lib/services/volume/v2/volumes_client.py
@@ -62,8 +62,9 @@
def create_volume(self, **kwargs):
"""Creates a new Volume.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#createVolume
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#createVolume
"""
post_body = json.dumps({'volume': kwargs})
resp, body = self.post('volumes', post_body)
@@ -74,8 +75,9 @@
def update_volume(self, volume_id, **kwargs):
"""Updates the Specified Volume.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#updateVolume
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#updateVolume
"""
put_body = json.dumps({'volume': kwargs})
resp, body = self.put('volumes/%s' % volume_id, put_body)
@@ -101,8 +103,9 @@
def attach_volume(self, volume_id, **kwargs):
"""Attaches a volume to a given instance on a given mountpoint.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#attachVolume
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#attachVolume
"""
post_body = json.dumps({'os-attach': kwargs})
url = 'volumes/%s/action' % (volume_id)
@@ -157,8 +160,9 @@
def extend_volume(self, volume_id, **kwargs):
"""Extend a volume.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#extendVolume
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#extendVolume
"""
post_body = json.dumps({'os-extend': kwargs})
url = 'volumes/%s/action' % (volume_id)
@@ -169,8 +173,9 @@
def reset_volume_status(self, volume_id, **kwargs):
"""Reset the Specified Volume's Status.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#resetVolume
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#resetVolume
"""
post_body = json.dumps({'os-reset_status': kwargs})
resp, body = self.post('volumes/%s/action' % volume_id, post_body)
@@ -180,8 +185,9 @@
def create_volume_transfer(self, **kwargs):
"""Create a volume transfer.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#createVolumeTransfer
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#createVolumeTransfer
"""
post_body = json.dumps({'transfer': kwargs})
resp, body = self.post('os-volume-transfer', post_body)
@@ -200,8 +206,9 @@
def list_volume_transfers(self, **params):
"""List all the volume transfers created.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#listVolumeTransfer
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#listVolumeTransfer
"""
url = 'os-volume-transfer'
if params:
@@ -220,8 +227,9 @@
def accept_volume_transfer(self, transfer_id, **kwargs):
"""Accept a volume transfer.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html#acceptVolumeTransfer
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#acceptVolumeTransfer
"""
url = 'os-volume-transfer/%s/accept' % transfer_id
post_body = json.dumps({'accept': kwargs})
@@ -296,9 +304,9 @@
def update_volume_image_metadata(self, volume_id, **kwargs):
"""Update image metadata for the volume.
- Available params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html
- #setVolumeimagemetadata
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#setVolumeimagemetadata
"""
post_body = json.dumps({'os-set_image_metadata': {'metadata': kwargs}})
url = "volumes/%s/action" % (volume_id)
@@ -329,9 +337,9 @@
def show_backend_capabilities(self, host):
"""Shows capabilities for a storage back end.
- Output params: see http://developer.openstack.org/
- api-ref-blockstorage-v2.html
- #showBackendCapabilities
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref-blockstorage-v2.html#showBackendCapabilities
"""
url = 'capabilities/%s' % host
resp, body = self.get(url)
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 8b86267..73544d9 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -219,6 +219,10 @@
imageRef=None, volume_type=None):
if size is None:
size = CONF.volume.volume_size
+ if imageRef:
+ image = self.compute_images_client.show_image(imageRef)['image']
+ min_disk = image.get('minDisk')
+ size = max(size, min_disk)
if name is None:
name = data_utils.rand_name(self.__class__.__name__ + "-volume")
kwargs = {'display_name': name,