debian: Do not call obsolete command "ovs-ofctl status" in ovs-bugtool.
[sliver-openvswitch.git] / debian / ovs-bugtool
index f991f27..209d937 100755 (executable)
@@ -14,7 +14,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 # Copyright (c) 2005, 2007 XenSource Ltd.
-# Copyright (c) 2010, Nicira Networks.
+# Copyright (c) 2010, 2011 Nicira Networks.
 
 #
 # To add new entries to the bugtool, you need to:
@@ -33,6 +33,9 @@
 # or func_output().
 #
 
+import warnings
+warnings.filterwarnings(action="ignore", category=DeprecationWarning)
+
 import getopt
 import re
 import os
@@ -64,7 +67,7 @@ OS_RELEASE = platform.release()
 # Files & directories
 #
 
-BUG_DIR = "/var/log/openvswitch"
+BUG_DIR = "/var/log/ovs-bugtool"
 PLUGIN_DIR = "/etc/openvswitch/bugtool"
 GRUB_CONFIG = '/boot/grub/menu.lst'
 BOOT_KERNEL = '/boot/vmlinuz-' + OS_RELEASE
@@ -93,12 +96,14 @@ HOSTS = '/etc/hosts'
 HOSTS_ALLOW = '/etc/hosts.allow'
 HOSTS_DENY = '/etc/hosts.deny'
 DHCP_LEASE_DIR = '/var/lib/dhcp3'
-OPENVSWITCH_CORE_DIR = '/var/log/openvswitch/cores'
+OPENVSWITCH_LOG_DIR = '/var/log/openvswitch'
 OPENVSWITCH_DEFAULT_SWITCH = '/etc/default/openvswitch-switch'
 OPENVSWITCH_DEFAULT_CONTROLLER = '/etc/default/openvswitch-controller'
 OPENVSWITCH_CONF_DB = '/etc/openvswitch/conf.db'
 OPENVSWITCH_VSWITCHD_PID = '/var/run/openvswitch/ovs-vswitchd.pid'
+COLLECTD_LOGS_DIR = '/var/lib/collectd/rrd'
 VAR_LOG_DIR = '/var/log/'
+VAR_LOG_CORE_DIR = '/var/log/core'
 X11_LOGS_DIR = VAR_LOG_DIR
 X11_LOGS_RE = re.compile(r'.*/Xorg\..*$')
 X11_AUTH_DIR = '/root/'
@@ -114,7 +119,6 @@ CAT = '/bin/cat'
 DF = '/bin/df'
 DMESG = '/bin/dmesg'
 DMIDECODE = '/usr/sbin/dmidecode'
-ETHTOOL = '/sbin/ethtool'
 FDISK = '/sbin/fdisk'
 FIND = '/usr/bin/find'
 IFCONFIG = '/sbin/ifconfig'
@@ -136,6 +140,11 @@ TC = '/sbin/tc'
 UPTIME = '/usr/bin/uptime'
 ZCAT = '/bin/zcat'
 
+ETHTOOL = '/sbin/ethtool'
+# ETHTOOL recently moved from /usr/sbin to /sbin in debian
+if not os.path.isfile(ETHTOOL):
+    ETHTOOL = '/usr/sbin/ethtool'
+
 #
 # PII -- Personally identifiable information.  Of particular concern are
 # things that would identify customers, or their network topology.
@@ -177,6 +186,7 @@ CAP_XML_ELEMENT = 'capability'
 
 CAP_BLOBS                = 'blobs'
 CAP_BOOT_LOADER          = 'boot-loader'
+CAP_COLLECTD_LOGS        = 'collectd-logs'
 CAP_DISK_INFO            = 'disk-info'
 CAP_FIRSTBOOT            = 'firstboot'
 CAP_HARDWARE_INFO        = 'hardware-info'
@@ -216,6 +226,8 @@ def cap(key, pii=PII_MAYBE, min_size=-1, max_size=-1, min_time=-1,
 cap(CAP_BLOBS,               PII_NO,                    max_size=5*MB)
 cap(CAP_BOOT_LOADER,         PII_NO,                    max_size=3*KB,
     max_time=5)
+cap(CAP_COLLECTD_LOGS,       PII_MAYBE,                 max_size=50*MB,
+    max_time=5)
 cap(CAP_DISK_INFO,           PII_MAYBE,                 max_size=25*KB,
     max_time=20)
 cap(CAP_FIRSTBOOT,           PII_YES,   min_size=60*KB, max_size=80*KB)
@@ -444,6 +456,7 @@ exclude those logs from the archive.
     cmd_output(CAP_BOOT_LOADER, [LS, '-lR', '/boot'])
     cmd_output(CAP_BOOT_LOADER, [MD5SUM, BOOT_KERNEL, BOOT_INITRD], label='vmlinuz-initrd.md5sum')
 
+    tree_output(CAP_COLLECTD_LOGS, COLLECTD_LOGS_DIR)
     cmd_output(CAP_DISK_INFO, [FDISK, '-l'])
     file_output(CAP_DISK_INFO, [PROC_PARTITIONS, PROC_MOUNTS])
     file_output(CAP_DISK_INFO, [FSTAB])
@@ -494,16 +507,17 @@ exclude those logs from the archive.
                 cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, '-k', p])
                 cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, '-i', p])
                 cmd_output(CAP_NETWORK_STATUS, [ETHTOOL, '-c', p])
+                cmd_output(CAP_NETWORK_STATUS,
+                           [TC, '-s', '-d', 'class', 'show', 'dev', p])
         except:
             pass
     cmd_output(CAP_NETWORK_STATUS, [TC, '-s', 'qdisc'])
     file_output(CAP_NETWORK_STATUS, [PROC_NET_SOFTNET_STAT])
-    tree_output(CAP_NETWORK_STATUS, OPENVSWITCH_CORE_DIR)
+    tree_output(CAP_NETWORK_STATUS, OPENVSWITCH_LOG_DIR)
     if os.path.exists(OPENVSWITCH_VSWITCHD_PID):
         cmd_output(CAP_NETWORK_STATUS, [OVS_DPCTL, 'show'])
         for d in dp_list():
             cmd_output(CAP_NETWORK_STATUS, [OVS_OFCTL, 'show', d])
-            cmd_output(CAP_NETWORK_STATUS, [OVS_OFCTL, 'status', d])
             cmd_output(CAP_NETWORK_STATUS, [OVS_OFCTL, 'dump-flows', d])
             cmd_output(CAP_NETWORK_STATUS, [OVS_DPCTL, 'dump-flows', d])
         try:
@@ -537,6 +551,7 @@ exclude those logs from the archive.
 
     tree_output(CAP_X11_LOGS, X11_LOGS_DIR, X11_LOGS_RE)
     tree_output(CAP_X11_AUTH, X11_AUTH_DIR, X11_AUTH_RE)
+    tree_output(CAP_SYSTEM_LOGS, VAR_LOG_CORE_DIR)
 
 
     try: