From: Gurucharan Shetty Date: Mon, 25 Jun 2012 21:14:39 +0000 (-0700) Subject: ovs-bugtool: Avoid running ethtool on non-physical devices. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74e60d69adf697e8167a1d1c4d29700ccbe3ee31;p=openvswitch 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 --- 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: