summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Harney <eharney@redhat.com>2018-03-14 16:11:29 -0400
committerEric Harney <eharney@redhat.com>2018-05-14 20:37:46 +0000
commit1d87444aa4e1e4131f99adeb393c119c9403f7ff (patch)
treec2bbaf366ef9bd5f09ed0e992e3625018f514f07
parent751fdf0f4552b4b2aa95b30a76b9d62c14bbf24c (diff)
downloadcinder-tempest-plugin-1d87444aa4e1e4131f99adeb393c119c9403f7ff.zip
cinder-tempest-plugin-1d87444aa4e1e4131f99adeb393c119c9403f7ff.tar.gz
cinder-tempest-plugin-1d87444aa4e1e4131f99adeb393c119c9403f7ff.tar.bz2
Test creating multiple volumes from image simultaneously
This test aims to help find issues in volume drivers and Cinder's image download internals. It creates five volumes simultaneously from the same image. Depends-On: I2ae36c4e90bd7b3340861ceec23dee406ea48214 Change-Id: I72d73c3e0e6160126a95103e36ab073a78ff8b3f
-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