aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/common/openstack_utils.py
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-04-26 15:24:44 +0100
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-05-03 08:17:39 +0000
commit9ae331e1aa1081c3e821512d1940846dfb4063ec (patch)
treef42ce6df5556d7921deab8ce5c9e341eb939a8e1 /yardstick/common/openstack_utils.py
parent346a2660b24ff3ca0128b0d873a716e735332a55 (diff)
Add "os_cloud_config" as a new context flag parameter
This new parameter will contain the OpenStack cloud specific configuration used by Shade client. This new flag is used only in Heat context. By default, this new parameter (dict) will contain this content: 'os_cloud_config': {'verify': False} This field will be used by HeatStack [1] to create a Shade cloud. Shade retrieves, if not defined, the OpenStack configuration from "os_client_config". This configuration is used to generate the cloud configuration, which is the description of the OpenStackCloud returned. The default parameter defined, "verify", refers to the related bug. By default, in case of using SSL certificate it will not be verified. [1] https://github.com/opnfv/yardstick/blob/b338d3091bb0beb89d4ad9f7c144f43a31a19a74/yardstick/orchestrator/heat.py#L47 JIRA: YARDSTICK-1139 Change-Id: I875a7018401b84e51dab775b8194174645d27e06 Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/common/openstack_utils.py')
-rw-r--r--yardstick/common/openstack_utils.py29
1 files changed, 22 insertions, 7 deletions
diff --git a/yardstick/common/openstack_utils.py b/yardstick/common/openstack_utils.py
index 0a3cfb5fc..bb53c1944 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)
# *********************************************