[ovs-dev] [PATCH] ovs-bugtool: Avoid running ethtool on non-physical devices.

Gurucharan Shetty gshetty at nicira.com
Mon Jun 25 21:33:14 UTC 2012


There can be possibilities where there are hundreds of OVS
internal devices. In such a situation, running ovs-bugtool
can take a very long time to complete as multiple ethtool
commands are run on each interface in /sys/class/net. Once
the ovs-bugtool completes, most of the ethtool command outputs
would be incomplete with "timeouts" as we only give 30 seconds
for CAP_NETWORK_STATUS.

With the following patch, we only run ethtools on those interfaces
that have an associated "device". All physical interfaces have
this entry in /sys/class/net/${interface_name}/. Virtual interfaces
can have this entry too, if it has an underlying virtual device.

Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 utilities/bugtool/ovs-bugtool.in |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/utilities/bugtool/ovs-bugtool.in b/utilities/bugtool/ovs-bugtool.in
index 3daf9cc..d071fd0 100755
--- a/utilities/bugtool/ovs-bugtool.in
+++ b/utilities/bugtool/ovs-bugtool.in
@@ -583,7 +583,7 @@ exclude those logs from the archive.
             f = open('/sys/class/net/%s/type' % p, 'r')
             t = f.readline()
             f.close()
-            if int(t) == 1:
+            if os.path.islink('/sys/class/net/%s/device' % p) and int(t) == 1:
                 # ARPHRD_ETHER
                 cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, p])
                 cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, '-S', p])
@@ -592,6 +592,9 @@ exclude those logs from the archive.
                 cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, '-c', p])
                 cmd_output(CAP_NETWORK_STATUS,
                            [TC, '-s', '-d', 'class', 'show', 'dev', p])
+            elif int(t) == 1:
+                cmd_output(CAP_NETWORK_STATUS,
+                           [TC, '-s', '-d', 'class', 'show', 'dev', p])
         except:
             pass
     tree_output(CAP_NETWORK_STATUS, PROC_NET_BONDING_DIR)
-- 
1.7.2.5




More information about the dev mailing list