aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/common
diff options
context:
space:
mode:
authorChornyi, TarasX <tarasx.chornyi@intel.com>2018-06-11 15:18:54 +0300
committerChornyi, TarasX <tarasx.chornyi@intel.com>2018-06-26 11:05:27 +0300
commit595212edf5ccd71af1bf7ef57a8d260fb1ec0c9e (patch)
treedc032e0dc4f32b5d158a0d72f1bfe9629fd48677 /yardstick/common
parent4c4edf05781b0a7d7368cb29d27ae2e92230c194 (diff)
Extended Context class with get_physical_nodes functionality
JIRA: YARDSTICK-1255 Change-Id: I446d715dc6cf716a4fcbc1b809c1b1d6303071e0 Signed-off-by: Chornyi, TarasX <tarasx.chornyi@intel.com>
Diffstat (limited to 'yardstick/common')
-rw-r--r--yardstick/common/exceptions.py4
-rw-r--r--yardstick/common/openstack_utils.py9
-rw-r--r--yardstick/common/utils.py9
3 files changed, 22 insertions, 0 deletions
diff --git a/yardstick/common/exceptions.py b/yardstick/common/exceptions.py
index 650c09edb..935c77866 100644
--- a/yardstick/common/exceptions.py
+++ b/yardstick/common/exceptions.py
@@ -68,6 +68,10 @@ class ResourceCommandError(YardstickException):
message = 'Command: "%(command)s" Failed, stderr: "%(stderr)s"'
+class ContextUpdateCollectdForNodeError(YardstickException):
+ message = 'Cannot find node %(attr_name)s'
+
+
class FunctionNotImplemented(YardstickException):
message = ('The function "%(function_name)s" is not implemented in '
'"%(class_name)" class.')
diff --git a/yardstick/common/openstack_utils.py b/yardstick/common/openstack_utils.py
index 6ff6617a9..541061351 100644
--- a/yardstick/common/openstack_utils.py
+++ b/yardstick/common/openstack_utils.py
@@ -172,6 +172,15 @@ def get_shade_client(**os_cloud_config):
params.update(os_cloud_config)
return shade.openstack_cloud(**params)
+def get_shade_operator_client(**os_cloud_config):
+ """Get Shade Operator cloud client
+
+ :return: ``shade.OperatorCloud`` object.
+ """
+ params = copy.deepcopy(constants.OS_CLOUD_DEFAULT_CONFIG)
+ params.update(os_cloud_config)
+ return shade.operator_cloud(**params)
+
# *********************************************
# NOVA
diff --git a/yardstick/common/utils.py b/yardstick/common/utils.py
index f9fe0e336..251e5cc6c 100644
--- a/yardstick/common/utils.py
+++ b/yardstick/common/utils.py
@@ -37,6 +37,7 @@ from oslo_utils import encodeutils
import yardstick
from yardstick.common import exceptions
+from yardstick.common.yaml_loader import yaml_load
logger = logging.getLogger(__name__)
@@ -527,3 +528,11 @@ def wait_until_true(predicate, timeout=60, sleep=1, exception=None):
if exception and issubclass(exception, Exception):
raise exception # pylint: disable=raising-bad-type
raise exceptions.WaitTimeout
+
+
+def read_yaml_file(path):
+ """Read yaml file"""
+
+ with open(path) as stream:
+ data = yaml_load(stream)
+ return data