summaryrefslogtreecommitdiffstats
path: root/yardstick/orchestrator/heat.py
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-04-26 15:24:44 +0100
committerEmma Foley <emma.l.foley@intel.com>2018-06-28 08:20:25 +0000
commit8b7e3af001b997f34e6a19b510e9c86e8d8d39d5 (patch)
treef3184e3ccb486dd9085da57a0164ff2608b91875 /yardstick/orchestrator/heat.py
parent405385acf890856390eb321cd1fc96c19ebfda0d (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> (cherry picked from commit 9ae331e1aa1081c3e821512d1940846dfb4063ec)
Diffstat (limited to 'yardstick/orchestrator/heat.py')
-rw-r--r--yardstick/orchestrator/heat.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py
index 5afa4151e..bfc1f7061 100644
--- a/yardstick/orchestrator/heat.py
+++ b/yardstick/orchestrator/heat.py
@@ -22,13 +22,13 @@ import time
from oslo_serialization import jsonutils
from oslo_utils import encodeutils
-import shade
from shade._heat import event_utils
-import yardstick.common.openstack_utils as op_utils
+from yardstick.common import constants as consts
from yardstick.common import exceptions
from yardstick.common import template_format
-from yardstick.common import constants as consts
+from yardstick.common import openstack_utils as op_utils
+
log = logging.getLogger(__name__)
@@ -41,10 +41,11 @@ _DEPLOYED_STACKS = {}
class HeatStack(object):
"""Represents a Heat stack (deployed template) """
- def __init__(self, name):
+ def __init__(self, name, os_cloud_config=None):
self.name = name
self.outputs = {}
- self._cloud = shade.openstack_cloud()
+ os_cloud_config = {} if not os_cloud_config else os_cloud_config
+ self._cloud = op_utils.get_shade_client(**os_cloud_config)
self._stack = None
def _update_stack_tracking(self):
@@ -152,10 +153,12 @@ name (i.e. %s).
# short hand for resources part of template
self.resources = self._template['resources']
- def __init__(self, name, template_file=None, heat_parameters=None):
+ def __init__(self, name, template_file=None, heat_parameters=None,
+ os_cloud_config=None):
self.name = name
self.keystone_client = None
self.heat_parameters = {}
+ self._os_cloud_config = {} if not os_cloud_config else os_cloud_config
# heat_parameters is passed to heat in stack create, empty dict when
# yardstick creates the template (no get_param in resources part)
@@ -229,7 +232,11 @@ name (i.e. %s).
name = "%s-%s" % (server_name, volume_name)
+ # TODO(elfoley): Fix this on master, it is a bug, and exposes untested
+ # code. Yardstick will crash when heat context uses volume.
+ # pylint: disable=no-value-for-parameter
volume_id = op_utils.get_volume_id(volume_name)
+ # pylint: enable=no-value-for-parameter
if not volume_id:
volume_id = {'get_resource': volume_name}
self.resources[name] = {
@@ -622,7 +629,7 @@ name (i.e. %s).
log.info("Creating stack '%s' START", self.name)
start_time = time.time()
- stack = HeatStack(self.name)
+ stack = HeatStack(self.name, os_cloud_config=self._os_cloud_config)
stack.create(self._template, self.heat_parameters, block, timeout)
if not block: