diff options
author | Emma Foley <emma.l.foley@intel.com> | 2018-05-04 14:54:16 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-05-04 14:54:16 +0000 |
commit | beca893904ff893d2fc944eb475d045cbe22c39b (patch) | |
tree | de0e432322188925ab0360d91c4f43655814b070 /yardstick/common/openstack_utils.py | |
parent | 3cc4c5f8171f54232b40e393eea5873af78d302b (diff) | |
parent | 9ae331e1aa1081c3e821512d1940846dfb4063ec (diff) |
Merge "Add "os_cloud_config" as a new context flag parameter"
Diffstat (limited to 'yardstick/common/openstack_utils.py')
-rw-r--r-- | yardstick/common/openstack_utils.py | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/yardstick/common/openstack_utils.py b/yardstick/common/openstack_utils.py index 68cf0a521..53f0ccc34 100644 --- a/yardstick/common/openstack_utils.py +++ b/yardstick/common/openstack_utils.py @@ -7,19 +7,21 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +import copy +import logging import os import sys -import logging +from cinderclient import client as cinderclient +from novaclient import client as novaclient +from glanceclient import client as glanceclient from keystoneauth1 import loading from keystoneauth1 import session +from neutronclient.neutron import client as neutronclient import shade from shade import exc -from cinderclient import client as cinderclient -from novaclient import client as novaclient -from glanceclient import client as glanceclient -from neutronclient.neutron import client as neutronclient +from yardstick.common import constants log = logging.getLogger(__name__) @@ -155,8 +157,21 @@ def get_glance_client(): # pragma: no cover return glanceclient.Client(get_glance_client_version(), session=sess) -def get_shade_client(): - return shade.openstack_cloud() +def get_shade_client(**os_cloud_config): + """Get Shade OpenStack cloud client + + By default, the input parameters given to "shade.openstack_cloud" method + are stored in "constants.OS_CLOUD_DEFAULT_CONFIG". The input parameters + passed in this function, "os_cloud_config", will overwrite the default + ones. + + :param os_cloud_config: (kwargs) input arguments for + "shade.openstack_cloud" method. + :return: ``shade.OpenStackCloud`` object. + """ + params = copy.deepcopy(constants.OS_CLOUD_DEFAULT_CONFIG) + params.update(os_cloud_config) + return shade.openstack_cloud(**params) # ********************************************* |