From 911c16e8eb306f23f5501e33630138d9bf8cce65 Mon Sep 17 00:00:00 2001 From: janbalaz Date: Mon, 12 Sep 2016 11:29:09 -0700 Subject: [PATCH] Fix ping command error handling, remove pypy from tox.ini Change-Id: Ie7c3521f702a8db63739ddd40c73b93d67e9f2ed --- requirements.txt | 2 +- tox.ini | 2 +- vmtp/perf_tool.py | 6 ++---- vmtp/vmtp.py | 15 +++++++++------ 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/requirements.txt b/requirements.txt index bab2858..2c6b4bd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,12 +10,12 @@ lxml>=3.4.0 paramiko>=1.14.0 prettytable>=0.7.2 pymongo>=2.7.2 +pytz>=2016.4 python-glanceclient>=0.15.0 python-neutronclient<3,>=2.3.6 python-novaclient>=2.18.1 python-openstackclient>=0.4.1 python-keystoneclient>=1.7.2 -pytz>=2016.4 scp>=0.8.0 tabulate>=0.7.3 diff --git a/tox.ini b/tox.ini index 79cc401..ad6add1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 1.6 -envlist = py27,pypy,pep8 +envlist = py27,pep8 skipsdist = True [testenv] diff --git a/vmtp/perf_tool.py b/vmtp/perf_tool.py index 12c7b06..ce48e0d 100644 --- a/vmtp/perf_tool.py +++ b/vmtp/perf_tool.py @@ -245,12 +245,10 @@ class PingTool(PerfTool): else: ping_cmd = "ping" cmd = "%s -c %d -s %d %s" % (ping_cmd, ping_count, size, target_ip) - print cmd cmd_out = self.instance.exec_command(cmd) if not cmd_out: - res = {'protocol': 'ICMP', - 'tool': 'ping', - 'error': 'failed'} + res = {'packet_size': size, + 'error': 'ping failed'} return res match = re.search(r'(\d*) packets transmitted, (\d*) ', cmd_out) diff --git a/vmtp/vmtp.py b/vmtp/vmtp.py index f0d61a5..4df3dec 100755 --- a/vmtp/vmtp.py +++ b/vmtp/vmtp.py @@ -558,12 +558,15 @@ def gen_report_data(proto, result): elif proto == 'ICMP': pkt_size_results = {} for pkt_size_res in item['results']: - - pkt_size_results[str(pkt_size_res['packet_size']) + '-byte'] = \ - '%s/%s/%s/%s' % (pkt_size_res['rtt_avg_ms'], - pkt_size_res['rtt_min_ms'], - pkt_size_res['rtt_max_ms'], - pkt_size_res['rtt_stddev']) + label = str(pkt_size_res['packet_size']) + '-byte' + if 'error' in pkt_size_res: + pkt_size_results[label] = pkt_size_res['error'] + else: + pkt_size_results[label] = '%s/%s/%s/%s' % \ + (pkt_size_res['rtt_avg_ms'], + pkt_size_res['rtt_min_ms'], + pkt_size_res['rtt_max_ms'], + pkt_size_res['rtt_stddev']) retval['rtt avg/min/max/stddev msec'] = pkt_size_results if proto in ['TCP', 'Upload', 'Download']: