X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fbenchmark%2Fscenarios%2Fcompute%2Flmbench.py;h=801f7fa80a5d07943cb8ba011e609e8225770b31;hb=refs%2Fchanges%2F35%2F36935%2F6;hp=6a17ae8a104137fec0a025aeee25b9f49ba1725e;hpb=8f91b0a5c1f47953dd1a14541b71505dbf8f869a;p=yardstick.git diff --git a/yardstick/benchmark/scenarios/compute/lmbench.py b/yardstick/benchmark/scenarios/compute/lmbench.py index 6a17ae8a1..801f7fa80 100644 --- a/yardstick/benchmark/scenarios/compute/lmbench.py +++ b/yardstick/benchmark/scenarios/compute/lmbench.py @@ -15,6 +15,7 @@ import pkg_resources from oslo_serialization import jsonutils import yardstick.ssh as ssh +from yardstick.common import utils from yardstick.benchmark.scenarios import base LOG = logging.getLogger(__name__) @@ -80,14 +81,8 @@ class Lmbench(base.Scenario): "yardstick.benchmark.scenarios.compute", Lmbench.LATENCY_CACHE_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 @@ -133,30 +128,32 @@ class Lmbench(base.Scenario): if status: raise RuntimeError(stderr) + lmbench_result = {} if test_type == 'latency': - result.update( + lmbench_result.update( {"latencies": jsonutils.loads(stdout)}) else: - result.update(jsonutils.loads(stdout)) + lmbench_result.update(jsonutils.loads(stdout)) + result.update(utils.flatten_dict_key(lmbench_result)) if "sla" in self.scenario_cfg: sla_error = "" if test_type == 'latency': sla_max_latency = int(self.scenario_cfg['sla']['max_latency']) - for t_latency in result["latencies"]: + for t_latency in lmbench_result["latencies"]: latency = t_latency['latency'] if latency > sla_max_latency: sla_error += "latency %f > sla:max_latency(%f); " \ % (latency, sla_max_latency) elif test_type == 'bandwidth': sla_min_bw = int(self.scenario_cfg['sla']['min_bandwidth']) - bw = result["bandwidth(MBps)"] + bw = lmbench_result["bandwidth(MBps)"] if bw < sla_min_bw: sla_error += "bandwidth %f < " \ "sla:min_bandwidth(%f)" % (bw, sla_min_bw) elif test_type == 'latency_for_cache': sla_latency = float(self.scenario_cfg['sla']['max_latency']) - cache_latency = float(result['L1cache']) + cache_latency = float(lmbench_result['L1cache']) if sla_latency < cache_latency: sla_error += "latency %f > sla:max_latency(%f); " \ % (cache_latency, sla_latency)