Giulio Fidente | bbb69e7 | 2013-06-18 16:06:24 +0200 | [diff] [blame] | 1 | # 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 Wang | d39431f | 2015-05-14 11:30:48 +1200 | [diff] [blame] | 13 | from tempest.common.utils import data_utils |
Walter A. Boring IV | b725e62 | 2013-07-11 17:21:33 -0700 | [diff] [blame] | 14 | import tempest.stress.stressaction as stressaction |
Giulio Fidente | bbb69e7 | 2013-06-18 16:06:24 +0200 | [diff] [blame] | 15 | |
| 16 | |
Giulio Fidente | c57ac8b | 2013-08-01 11:28:41 +0200 | [diff] [blame] | 17 | class VolumeCreateDeleteTest(stressaction.StressAction): |
Walter A. Boring IV | b725e62 | 2013-07-11 17:21:33 -0700 | [diff] [blame] | 18 | |
| 19 | def run(self): |
Masayuki Igawa | 259c113 | 2013-10-31 17:48:44 +0900 | [diff] [blame] | 20 | name = data_utils.rand_name("volume") |
Walter A. Boring IV | b725e62 | 2013-07-11 17:21:33 -0700 | [diff] [blame] | 21 | self.logger.info("creating %s" % name) |
Giulio Fidente | c57ac8b | 2013-08-01 11:28:41 +0200 | [diff] [blame] | 22 | volumes_client = self.manager.volumes_client |
John Warren | 6177c9e | 2015-08-19 20:00:17 +0000 | [diff] [blame] | 23 | volume = volumes_client.create_volume(display_name=name)['volume'] |
Walter A. Boring IV | b725e62 | 2013-07-11 17:21:33 -0700 | [diff] [blame] | 24 | vol_id = volume['id'] |
Giulio Fidente | c57ac8b | 2013-08-01 11:28:41 +0200 | [diff] [blame] | 25 | volumes_client.wait_for_volume_status(vol_id, 'available') |
Walter A. Boring IV | b725e62 | 2013-07-11 17:21:33 -0700 | [diff] [blame] | 26 | self.logger.info("created %s" % volume['id']) |
| 27 | self.logger.info("deleting %s" % name) |
ghanshyam | 51e84f4 | 2014-10-02 17:28:18 +0900 | [diff] [blame] | 28 | volumes_client.delete_volume(vol_id) |
Giulio Fidente | c57ac8b | 2013-08-01 11:28:41 +0200 | [diff] [blame] | 29 | volumes_client.wait_for_resource_deletion(vol_id) |
Walter A. Boring IV | b725e62 | 2013-07-11 17:21:33 -0700 | [diff] [blame] | 30 | self.logger.info("deleted %s" % vol_id) |