diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-05-22 01:08:39 -0700 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2017-06-22 02:16:48 +0000 |
commit | d583b110cf0952b2a61a74e35ac7c42ad7a0a33f (patch) | |
tree | 385b0fb72bd4b33f20968729424ba4910aac1579 | |
parent | f9e384775559bca42e25f2f0ee952e2e304e678b (diff) |
ping: don't split if target_vm is a dict
If we run sample/ping-hot.yaml, it will encounter an AttributeError, log
see below:
Traceback (most recent call last):
File
"/usr/local/lib/python2.7/dist-packages/yardstick/benchmark/runners/duration.py",
line 69, in _worker_process
method(data)
File
"/usr/local/lib/python2.7/dist-packages/yardstick/benchmark/scenarios/networking/ping.py",
line 94, in run
target_vm_name = target_vm.split('.')[0]
AttributeError: 'dict' object has no attribute 'split'
Because here host and target will be a dict
JIRA: YARDSTICK-561
Change-Id: I4b7628bf20050d6d516a80efe3785f750d27c05e
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
(cherry picked from commit eb142a953a59f447f1c186d2f58004fe354e4c4b)
-rw-r--r-- | yardstick/benchmark/scenarios/networking/ping.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/yardstick/benchmark/scenarios/networking/ping.py b/yardstick/benchmark/scenarios/networking/ping.py index 95367b3bb..a929e5337 100644 --- a/yardstick/benchmark/scenarios/networking/ping.py +++ b/yardstick/benchmark/scenarios/networking/ping.py @@ -76,7 +76,10 @@ class Ping(base.Scenario): raise RuntimeError(stderr) if stdout: - target_vm_name = target_vm.split('.')[0] + if isinstance(target_vm, dict): + target_vm_name = target_vm.get("name") + else: + target_vm_name = target_vm.split('.')[0] rtt_result[target_vm_name] = float(stdout) if "sla" in self.scenario_cfg: sla_max_rtt = int(self.scenario_cfg["sla"]["max_rtt"]) |