X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fbenchmark%2Fscenarios%2Fcompute%2Funixbench.py;h=cdb345717933ba63ce85a5d56da2ef6834c280ec;hb=5c4b29189bd69912c9bc356a15a46db764045537;hp=b22be29c95385a2ec04b9b3267b9e17ac9c5350b;hpb=beeeec75ea196f14659d9836d26dc0654df5fd4d;p=yardstick.git diff --git a/yardstick/benchmark/scenarios/compute/unixbench.py b/yardstick/benchmark/scenarios/compute/unixbench.py index b22be29c9..cdb345717 100644 --- a/yardstick/benchmark/scenarios/compute/unixbench.py +++ b/yardstick/benchmark/scenarios/compute/unixbench.py @@ -6,9 +6,13 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -import pkg_resources +from __future__ import absolute_import +from __future__ import print_function + import logging -import json + +import pkg_resources +from oslo_serialization import jsonutils import yardstick.ssh as ssh from yardstick.benchmark.scenarios import base @@ -66,14 +70,8 @@ class Unixbench(base.Scenario): Unixbench.TARGET_SCRIPT) host = self.context_cfg["host"] - user = host.get("user", "ubuntu") - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - ip = host.get("ip", None) - key_filename = host.get('key_filename', "~/.ssh/id_rsa") - - LOG.info("user:%s, host:%s", user, ip) - self.client = ssh.SSH(user, ip, key_filename=key_filename, - port=ssh_port) + + self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"}) self.client.wait(timeout=600) # copy scripts to host @@ -115,7 +113,7 @@ class Unixbench(base.Scenario): if status: raise RuntimeError(stderr) - result.update(json.loads(stdout)) + result.update(jsonutils.loads(stdout)) if "sla" in self.scenario_cfg: sla_error = "" @@ -152,7 +150,7 @@ def _test(): # pragma: no cover p = Unixbench(args, ctx) p.run(result) - print result + print(result) if __name__ == '__main__':