summaryrefslogtreecommitdiffstats
path: root/testcases/functest_utils.py
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-01-28 07:46:11 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-01-28 07:46:11 +0000
commite1e2cf3216a37341684c4dc7fd92c6e154f355e9 (patch)
tree2bb4d6294857c8c3d9c0f63142fd158fddedf416 /testcases/functest_utils.py
parent9c6eeae44d8e82fb7af2111784474628ec839a46 (diff)
parent9922669c3dd92d43c6e387c8077255153c35b71e (diff)
Merge "Volume type management moved from run_tests.sh to run_rally-cert.py"
Diffstat (limited to 'testcases/functest_utils.py')
-rw-r--r--testcases/functest_utils.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py
index bbe933ab8..b3549ee93 100644
--- a/testcases/functest_utils.py
+++ b/testcases/functest_utils.py
@@ -544,6 +544,36 @@ def delete_volume(cinder_client, volume_id, forced=False):
return False
+def list_volume_types(cinder_client, public=True, private=True):
+ try:
+ volume_types = cinder_client.volume_types.list()
+ if not public:
+ volume_types = [vt for vt in volume_types if not vt.is_public]
+ if not private:
+ volume_types = [vt for vt in volume_types if vt.is_public]
+ return volume_types
+ except:
+ return None
+
+
+def create_volume_type(cinder_client, name):
+ try:
+ volume_type = cinder_client.volume_types.create(name)
+ return volume_type
+ except:
+ print "Error:", sys.exc_info()[0]
+ return None
+
+
+def delete_volume_type(cinder_client, volume_type):
+ try:
+ cinder_client.volume_types.delete(volume_type)
+ return True
+ except:
+ print "Error:", sys.exc_info()[0]
+ return False
+
+
#*********************************************
# KEYSTONE