blob: 39867485f47c6b3d75a690dc6573736a0b4cf168 [file] [log] [blame]
Giulio Fidentebbb69e72013-06-18 16:06:24 +02001# Licensed under the Apache License, Version 2.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10# See the License for the specific language governing permissions and
11# limitations under the License.
12
Fei Long Wangd39431f2015-05-14 11:30:48 +120013from tempest.common.utils import data_utils
Walter A. Boring IVb725e622013-07-11 17:21:33 -070014import tempest.stress.stressaction as stressaction
Giulio Fidentebbb69e72013-06-18 16:06:24 +020015
16
Giulio Fidentec57ac8b2013-08-01 11:28:41 +020017class VolumeCreateDeleteTest(stressaction.StressAction):
Walter A. Boring IVb725e622013-07-11 17:21:33 -070018
19 def run(self):
Masayuki Igawa259c1132013-10-31 17:48:44 +090020 name = data_utils.rand_name("volume")
Walter A. Boring IVb725e622013-07-11 17:21:33 -070021 self.logger.info("creating %s" % name)
Giulio Fidentec57ac8b2013-08-01 11:28:41 +020022 volumes_client = self.manager.volumes_client
John Warren6177c9e2015-08-19 20:00:17 +000023 volume = volumes_client.create_volume(display_name=name)['volume']
Walter A. Boring IVb725e622013-07-11 17:21:33 -070024 vol_id = volume['id']
Giulio Fidentec57ac8b2013-08-01 11:28:41 +020025 volumes_client.wait_for_volume_status(vol_id, 'available')
Walter A. Boring IVb725e622013-07-11 17:21:33 -070026 self.logger.info("created %s" % volume['id'])
27 self.logger.info("deleting %s" % name)
ghanshyam51e84f42014-10-02 17:28:18 +090028 volumes_client.delete_volume(vol_id)
Giulio Fidentec57ac8b2013-08-01 11:28:41 +020029 volumes_client.wait_for_resource_deletion(vol_id)
Walter A. Boring IVb725e622013-07-11 17:21:33 -070030 self.logger.info("deleted %s" % vol_id)