From 595212edf5ccd71af1bf7ef57a8d260fb1ec0c9e Mon Sep 17 00:00:00 2001 From: "Chornyi, TarasX" Date: Mon, 11 Jun 2018 15:18:54 +0300 Subject: Extended Context class with get_physical_nodes functionality JIRA: YARDSTICK-1255 Change-Id: I446d715dc6cf716a4fcbc1b809c1b1d6303071e0 Signed-off-by: Chornyi, TarasX --- yardstick/common/exceptions.py | 4 ++++ yardstick/common/openstack_utils.py | 9 +++++++++ yardstick/common/utils.py | 9 +++++++++ 3 files changed, 22 insertions(+) (limited to 'yardstick/common') 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 -- cgit 1.2.3-korg