summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-05-15 20:36:05 +0000
committerGerrit Code Review <review@openstack.org>2018-05-15 20:36:05 +0000
commit28456a1234ad2e3d158237644c9c262a57cc2ee1 (patch)
tree328eaf0a8409474693d7f3931ad1ae6a4e5a20b2
parent0897bd341e0cde94784277893707861f555d4f0e (diff)
parent1d87444aa4e1e4131f99adeb393c119c9403f7ff (diff)
downloadcinder-tempest-plugin-28456a1234ad2e3d158237644c9c262a57cc2ee1.zip
cinder-tempest-plugin-28456a1234ad2e3d158237644c9c262a57cc2ee1.tar.gz
cinder-tempest-plugin-28456a1234ad2e3d158237644c9c262a57cc2ee1.tar.bz2
Merge "Test creating multiple volumes from image simultaneously"
-rw-r--r--cinder_tempest_plugin/api/volume/test_create_from_image.py77
1 files changed, 77 insertions, 0 deletions
diff --git a/cinder_tempest_plugin/api/volume/test_create_from_image.py b/cinder_tempest_plugin/api/volume/test_create_from_image.py
new file mode 100644
index 0000000..12e6c8e
--- /dev/null
+++ b/cinder_tempest_plugin/api/volume/test_create_from_image.py
@@ -0,0 +1,77 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.common import waiters
+from tempest import config
+from tempest.lib.common.utils import data_utils
+from tempest.lib.common.utils import test_utils
+from tempest.lib import decorators
+
+from cinder_tempest_plugin.api.volume import base
+
+CONF = config.CONF
+
+
+class VolumeFromImageTest(base.BaseVolumeTest):
+
+ @classmethod
+ def skip_checks(cls):
+ super(VolumeFromImageTest, cls).skip_checks()
+
+ @classmethod
+ def create_volume_no_wait(cls, **kwargs):
+ """Returns a test volume.
+
+ This does not wait for volume creation to finish,
+ so that multiple operations can happen on the
+ Cinder server in parallel.
+ """
+ if 'size' not in kwargs:
+ kwargs['size'] = CONF.volume.volume_size
+
+ if 'imageRef' in kwargs:
+ image = cls.os_primary.image_client_v2.show_image(
+ kwargs['imageRef'])
+ min_disk = image['min_disk']
+ kwargs['size'] = max(kwargs['size'], min_disk)
+
+ if 'name' not in kwargs:
+ name = data_utils.rand_name(cls.__name__ + '-Volume')
+ kwargs['name'] = name
+
+ volume = cls.volumes_client.create_volume(**kwargs)['volume']
+ cls.addClassResourceCleanup(
+ cls.volumes_client.wait_for_resource_deletion, volume['id'])
+ cls.addClassResourceCleanup(test_utils.call_and_ignore_notfound_exc,
+ cls.volumes_client.delete_volume,
+ volume['id'])
+
+ return volume
+
+ @decorators.idempotent_id('8976a11b-1ddc-49b6-b66f-8c26adf3fa9e')
+ def test_create_from_image_multiple(self):
+ """Create a handful of volumes from the same image at once.
+
+ The purpose of this test is to stress volume drivers,
+ image download, the image cache, etc., within Cinder.
+ """
+
+ img_uuid = CONF.compute.image_ref
+
+ vols = []
+ for v in range(0, 5):
+ vols.append(self.create_volume_no_wait(imageRef=img_uuid))
+
+ for v in vols:
+ waiters.wait_for_volume_resource_status(self.volumes_client,
+ v['id'],
+ 'available')

This mirror site include all the OpenStack related repositories under: openstack, openstack-dev and openstack-infra.

NOTE: All repositories are updated every one hour.

Usage

For Git Clone
 git clone http://git.trystack.cn/openstack/nova.git 
For DevStack

Add GIT_BASE, NOVNC_REPO and SPICE_REPO variables to local.conf file.

[[local|localrc]]

# use TryStack git mirror
GIT_BASE=http://git.trystack.cn
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git