summaryrefslogtreecommitdiffstats
path: root/yardstick/cmd
diff options
context:
space:
mode:
authorQiLiang <liangqi1@huawei.com>2015-10-15 14:24:27 +0800
committerQiLiang <liangqi1@huawei.com>2015-10-20 11:35:26 +0800
commit1e3e9b5d7ff40eb6921e60dc1a3254e8c984a08c (patch)
tree92b1e8e81ddb0b2a0cf7e7f38688ebaf1d409f8f /yardstick/cmd
parent8069fee968b73833d314b41f004c8f1cb1ab6c28 (diff)
Heat context code refactor
Heat context code refactor to cater for the evolution of the Yardstick framework. At test_case.yaml context segment add "type" to indicate the context type, see samples/ping-heat-context.yaml for an example. And the default context type is Heat, so the existing yaml file do not need to change. JIRA: YARDSTICK-168 Change-Id: Ida0ce12c17cd9b88d7acfb4c9eb1ac6986394b38 Signed-off-by: QiLiang <liangqi1@huawei.com>
Diffstat (limited to 'yardstick/cmd')
-rwxr-xr-xyardstick/cmd/commands/task.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/yardstick/cmd/commands/task.py b/yardstick/cmd/commands/task.py
index 5c25c576a..5eb38989a 100755
--- a/yardstick/cmd/commands/task.py
+++ b/yardstick/cmd/commands/task.py
@@ -16,7 +16,7 @@ import atexit
import pkg_resources
import ipaddress
-from yardstick.benchmark.context.model import Context
+from yardstick.benchmark.contexts.base import Context
from yardstick.benchmark.runners import base as base_runner
from yardstick.common.task_template import TaskTemplate
from yardstick.common.utils import cliargs
@@ -194,18 +194,20 @@ class TaskParser(object):
self._check_schema(cfg["schema"], "task")
# TODO: support one or many contexts? Many would simpler and precise
+ # TODO: support hybrid context type
if "context" in cfg:
context_cfgs = [cfg["context"]]
else:
context_cfgs = cfg["contexts"]
for cfg_attrs in context_cfgs:
- # config external_network based on env var
- if "networks" in cfg_attrs:
+ context_type = cfg_attrs.get("type", "Heat")
+ if "Heat" == context_type and "networks" in cfg_attrs:
+ # config external_network based on env var
for _, attrs in cfg_attrs["networks"].items():
attrs["external_network"] = os.environ.get(
'EXTERNAL_NETWORK', 'net04_ext')
- context = Context()
+ context = Context.get(context_type)
context.init(cfg_attrs)
run_in_parallel = cfg.get("run_in_parallel", False)
@@ -245,6 +247,7 @@ def run_one_scenario(scenario_cfg, output_file):
key_filename = pkg_resources.resource_filename(
'yardstick.resources', 'files/yardstick_key')
+ # TODO support get multi hosts/vms info
host = Context.get_server(scenario_cfg["host"])
runner_cfg = scenario_cfg["runner"]