From 74e60d69adf697e8167a1d1c4d29700ccbe3ee31 Mon Sep 17 00:00:00 2001 From: Gurucharan Shetty Date: Mon, 25 Jun 2012 14:14:39 -0700 Subject: [PATCH] ovs-bugtool: Avoid running ethtool on non-physical devices. 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 --- utilities/bugtool/ovs-bugtool.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utilities/bugtool/ovs-bugtool.in b/utilities/bugtool/ovs-bugtool.in index 3daf9cca..3bafa134 100755 --- a/utilities/bugtool/ovs-bugtool.in +++ b/utilities/bugtool/ovs-bugtool.in @@ -583,13 +583,14 @@ 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]) cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, '-k', p]) cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, '-i', p]) cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, '-c', p]) + if int(t) == 1: cmd_output(CAP_NETWORK_STATUS, [TC, '-s', '-d', 'class', 'show', 'dev', p]) except: -- 2.30.2