diff options
author | Miikka Koistinen <miikka.koistinen@nokia.com> | 2018-06-29 16:31:31 +0300 |
---|---|---|
committer | Miikka Koistinen <miikka.koistinen@nokia.com> | 2018-07-27 09:34:18 +0000 |
commit | 155d28791fdde113b01e257a32d16e5bc42a1d2a (patch) | |
tree | 5fe2bf9eb5356e86524be7cc7291426b84d8e566 /yardstick/benchmark/scenarios/networking/vsperf.py | |
parent | 000cc9146035aceb0980ea0db0e6d4648cca1ad1 (diff) |
Refactor remote command execution in vsperf
* Remove unneeded variables
* Do not raise RuntimeError when a remote command fails, instead leave
it for the yardstick ssh module to handle.
* Prevent CsvReader from raising StopIteration if csv output cannot be
parsed. The SLA validation will take care of errors in that case.
JIRA: YARDSTICK-1166
Change-Id: I6cf550bd7bc8f511b3c0f25c67f8caab18bccd28
Signed-off-by: Miikka Koistinen <miikka.koistinen@nokia.com>
Diffstat (limited to 'yardstick/benchmark/scenarios/networking/vsperf.py')
-rw-r--r-- | yardstick/benchmark/scenarios/networking/vsperf.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/yardstick/benchmark/scenarios/networking/vsperf.py b/yardstick/benchmark/scenarios/networking/vsperf.py index 2b3474070..8344b1595 100644 --- a/yardstick/benchmark/scenarios/networking/vsperf.py +++ b/yardstick/benchmark/scenarios/networking/vsperf.py @@ -193,22 +193,19 @@ class Vsperf(base.Scenario): cmd += "--conf-file ~/vsperf.conf " cmd += "--test-params=\"%s\"" % (';'.join(test_params)) LOG.debug("Executing command: %s", cmd) - status, stdout, stderr = self.client.execute(cmd) - - if status: - raise RuntimeError(stderr) + self.client.run(cmd) # get test results cmd = "cat /tmp/results*/result.csv" LOG.debug("Executing command: %s", cmd) - status, stdout, stderr = self.client.execute(cmd) - - if status: - raise RuntimeError(stderr) + _, stdout, _ = self.client.execute(cmd, raise_on_error=True) # convert result.csv to JSON format - reader = csv.DictReader(stdout.split('\r\n')) - result.update(next(reader)) + reader = csv.DictReader(stdout.split('\r\n'), strict=True) + try: + result.update(next(reader)) + except StopIteration: + pass # sla check; go through all defined SLAs and check if values measured # by VSPERF are higher then those defined by SLAs |