diff options
Diffstat (limited to 'yardstick/benchmark/scenarios/networking/ping.py')
-rw-r--r-- | yardstick/benchmark/scenarios/networking/ping.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/yardstick/benchmark/scenarios/networking/ping.py b/yardstick/benchmark/scenarios/networking/ping.py index 2becdaf36..6e49a1437 100644 --- a/yardstick/benchmark/scenarios/networking/ping.py +++ b/yardstick/benchmark/scenarios/networking/ping.py @@ -55,7 +55,7 @@ class Ping(base.Scenario): self.connection = ssh.SSH(user, ip, key_filename=key_filename, port=ssh_port) - self.connection.wait() + self.connection.wait(timeout=600) def run(self, result): """execute the benchmark""" @@ -79,9 +79,10 @@ class Ping(base.Scenario): target_vm = self.scenario_cfg['target'] LOG.debug("ping '%s' '%s'", options, dest) - exit_status, stdout, stderr = self.connection.execute( - "/bin/sh -s {0} {1}".format(dest, options), - stdin=open(self.target_script, "r")) + with open(self.target_script, "r") as stdin_file: + exit_status, stdout, stderr = self.connection.execute( + "/bin/sh -s {0} {1}".format(dest, options), + stdin=stdin_file) if exit_status != 0: raise RuntimeError(stderr) |