aboutsummaryrefslogtreecommitdiffstats
path: root/utils/openstack_utils.py
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-07-13 12:07:21 +0200
committerJose Lausuch <jose.lausuch@ericsson.com>2016-07-14 11:10:47 +0000
commitaddc7f7318147c29de474813b00ae40882ca9662 (patch)
tree6fd60f2dcd2a50c811851ebb9ff7dbeb6b4d3f81 /utils/openstack_utils.py
parent57d44d445189755d84dfb4abd50082900cb8811f (diff)
Use common way to get the openstack clients
Instead of repeating the code in all the scripts and importing the openstack libraries, the clients shall be given by openstack utils, which is its purpose JIRA: FUNCTEST-163 Change-Id: I1ccc05a3af44ee1ab5938ea9e4e01dbe55f4816d Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'utils/openstack_utils.py')
-rw-r--r--utils/openstack_utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/openstack_utils.py b/utils/openstack_utils.py
index 2103c7fe..2af12e55 100644
--- a/utils/openstack_utils.py
+++ b/utils/openstack_utils.py
@@ -14,6 +14,7 @@ import subprocess
import sys
import time
+from cinderclient import client as cinderclient
from glanceclient import client as glanceclient
from keystoneclient.v2_0 import client as keystoneclient
from neutronclient.v2_0 import client as neutronclient
@@ -103,6 +104,15 @@ def get_nova_client():
return novaclient.Client('2', **creds_nova)
+def get_cinder_client():
+ creds_cinder = get_credentials("cinder")
+ return cinderclient.Client('2', creds_cinder['username'],
+ creds_cinder['api_key'],
+ creds_cinder['project_id'],
+ creds_cinder['auth_url'],
+ service_type="volume")
+
+
def get_neutron_client():
creds_neutron = get_credentials("neutron")
return neutronclient.Client(**creds_neutron)