Merge lp:~bladernr/checkbox/1257308 into lp:checkbox

Proposed by Jeff Lane 
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 2535
Merged at revision: 2537
Proposed branch: lp:~bladernr/checkbox/1257308
Merge into: lp:checkbox
Diff against target: 41 lines (+16/-4)
2 files modified
checkbox-old/debian/changelog (+3/-1)
checkbox-old/scripts/network (+13/-3)
To merge this branch: bzr merge lp:~bladernr/checkbox/1257308
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Jeff Lane  Needs Resubmitting
Review via email: mp+197554@code.launchpad.net

Commit message

scripts/network Handle ZeroDivisionError better (LP: #1257308)

Description of the change

scripts/network Handle ZeroDivisionError better (LP: #1257308)

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

37 - print("theoretical max %sMb/s" % int(self.iface.max_speed))
38 + print("theoretical max %sMb/s\n" % int(self.iface.max_speed))

Is this intended?

review: Needs Information
Revision history for this message
Jeff Lane  (bladernr) wrote :

Yes... without the newlines (note the preceding newline above it) all
the output was wedged together and made it more difficult to my eyes
to pick out the failure and quickly parse the output visually.

I can remove those if you prefer, it was just a bit of extra
formatting I threw in (and forgot to mention in the MR).

On Tue, Dec 3, 2013 at 11:05 AM, Zygmunt Krynicki
<email address hidden> wrote:
> Review: Needs Information
>
> 37 - print("theoretical max %sMb/s" % int(self.iface.max_speed))
> 38 + print("theoretical max %sMb/s\n" % int(self.iface.max_speed))
>
> Is this intended?
> --
> https://code.launchpad.net/~bladernr/checkbox/1257308/+merge/197554
> You are the owner of lp:~bladernr/checkbox/1257308.

--
Jeff Lane - Server and Cloud Certification and Tools Development
Ubuntu Ham: W4KDH
Freenode IRC: bladernr or bladernr_
gpg: 1024D/3A14B2DD 8C88 B076 0DD7 B404 1417 C466 4ABD 3635 3A14 B2DD

Revision history for this message
Jeff Lane  (bladernr) wrote :

Note, this is the original output:
bladernr@klaatu:~/development/1257308/checkbox-old/scripts$ sudo ./network test -t iperf -i eth0 --target transit.local
DEBUG:root:Shutting down interface:virbr0
DEBUG:root:Shutting down interface:wlan0
DEBUG:root:timeout 180 iperf -c transit.local -n 1024M
------------------------------------------------------------
Client connecting to transit.local, TCP port 5001
TCP window size: 22.9 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.0.100 port 57642 connected with 192.168.0.10 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 9.9 sec 1.00 GBytes 871 Mbits/sec

ERROR:root:Max Speed was not reported properly. Run ethtool and verify that the card is properly reporting its capabilities.
Transfer speed: 871 Mb/s
0.00% of theoretical max 1000Mb/s
WARNING:root:Poor network performance detected
DEBUG:root:Restoring interface:virbr0
DEBUG:root:Restoring interface:wlan0

and this is the slighly revised output:
bladernr@klaatu:~/development/1257308/checkbox-old/scripts$ sudo ./network tes -t iperf -i eth0 --target transit.local
[sudo] password for bladernr:
DEBUG:root:Shutting down interface:virbr0
DEBUG:root:Shutting down interface:wlan0
DEBUG:root:timeout 180 iperf -c transit.local -n 1024M
------------------------------------------------------------
Client connecting to transit.local, TCP port 5001
TCP window size: 22.9 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.0.100 port 57851 connected with 192.168.0.10 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 9.6 sec 1.00 GBytes 893 Mbits/sec

ERROR:root:Max Speed was not reported properly. Run ethtool and verify that the card is properly reporting its capabilities.

Transfer speed: 893 Mb/s
0.00% of theoretical max 1000Mb/s

WARNING:root:Poor network performance detected
DEBUG:root:Restoring interface:virbr0
DEBUG:root:Restoring interface:wlan0

Revision history for this message
Jeff Lane  (bladernr) wrote :

Do I need a resubmit for Needs Information? I can't remember... anyway, re-submitting in any case.

review: Needs Resubmitting
Revision history for this message
Daniel Manrique (roadmr) wrote :

Looks good to me, save for the instructions that advise running ethtool. If you run this against a wireless interface, ethtool will not be of use, which will leave the user head-scratching. I'll just leave this as a comment, final approval is up to Zygmunt who was the initial reviewer.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox-old/debian/changelog'
2--- checkbox-old/debian/changelog 2013-11-29 21:32:46 +0000
3+++ checkbox-old/debian/changelog 2013-12-03 15:50:47 +0000
4@@ -1,6 +1,8 @@
5 checkbox (0.17.1) UNRELEASED; urgency=low
6
7- * Incremented changelog
8+ [ Jeff Lane ]
9+ * scripts/network Handle ZeroDivisionError better (LP: #1257308)
10+
11
12 -- Sylvain Pineau <sylvain.pineau@canonical.com> Fri, 29 Nov 2013 22:30:45 +0100
13
14
15=== modified file 'checkbox-old/scripts/network'
16--- checkbox-old/scripts/network 2013-11-13 15:30:48 +0000
17+++ checkbox-old/scripts/network 2013-12-03 15:50:47 +0000
18@@ -97,10 +97,20 @@
19 scaled_throughput *= 1000
20 if units == 'K':
21 scaled_throughput /= 1000
22- percent = scaled_throughput / int(self.iface.max_speed) * 100
23- print("Transfer speed: {} {}b/s".format(throughput, units))
24+ try:
25+ percent = scaled_throughput / int(self.iface.max_speed) * 100
26+ except ZeroDivisionError:
27+ # Catches a condition where the interface functions fine but
28+ # ethtool fails to properly report max speed. In this case
29+ # it's up to the reviewer to pass or fail.
30+ logging.error("Max Speed was not reported properly. Run "
31+ "ethtool and verify that the card is properly "
32+ "reporting its capabilities.")
33+ percent = 0
34+
35+ print("\nTransfer speed: {} {}b/s".format(throughput, units))
36 print("%3.2f%% of " % percent, end="")
37- print("theoretical max %sMb/s" % int(self.iface.max_speed))
38+ print("theoretical max %sMb/s\n" % int(self.iface.max_speed))
39
40 if percent < 40:
41 logging.warn("Poor network performance detected")

Subscribers

People subscribed via source and target branches