# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Copyright (c) 2005, 2007 XenSource Ltd.
-# Copyright (c) 2010, 2011, 2012 Nicira, Inc.
+# Copyright (c) 2010, 2011, 2012, 2013, 2015 Nicira, Inc.
#
# To add new entries to the bugtool, you need to:
OPENVSWITCH_LOG_DIR = '@LOGDIR@/'
OPENVSWITCH_DEFAULT_SWITCH = '/etc/default/openvswitch-switch' # Debian
OPENVSWITCH_SYSCONFIG_SWITCH = '/etc/sysconfig/openvswitch' # RHEL
-OPENVSWITCH_DEFAULT_CONTROLLER = '/etc/default/openvswitch-controller'
OPENVSWITCH_CONF_DB = '@DBDIR@/conf.db'
OPENVSWITCH_COMPACT_DB = '@DBDIR@/bugtool-compact-conf.db'
OPENVSWITCH_VSWITCHD_PID = '@RUNDIR@/ovs-vswitchd.pid'
only_ovs_info = False
collect_all_info = True
+ if '--help' in sys.argv:
+ print """\
+%(argv0)s: create status report bundles to assist in problem diagnosis
+usage: %(argv0)s OPTIONS
+
+By default, %(argv0)s prompts for permission to collect each form of status
+information and produces a .tar.gz file as output.
+
+The following options are available.
+ --help display this help message, then exit
+ -s, --silent suppress most output to stdout
+
+Options for categories of data to collect:
+ --entries=CAP_A,CAP_B,... set categories of data to collect
+ --all collect all categories
+ --ovs collect only directly OVS-related info
+ --log-days=DAYS collect DAYS worth of old logs
+ -y, --yestoall suppress prompts to confirm collection
+ --capabilities print categories as XML on stdout, then exit
+
+Output options:
+ --output=FORMAT set output format to one of tar tar.bz2 tar.gz zip
+ --outfile=FILE write output to FILE
+ --outfd=FD write output to FD (requires --output=tar)
+ --unlimited ignore default limits on sizes of data collected
+ --debug print ovs-bugtool debug info on stdout\
+""" % {'argv0': sys.argv[0]}
+ sys.exit(0)
+
# we need access to privileged files, exit if we are not running as root
if os.getuid() != 0:
print >>sys.stderr, "Error: ovs-bugtool must be run as root"
file_output(CAP_NETWORK_CONFIG, [SYSCONFIG_NETWORK, RESOLV_CONF, NSSWITCH_CONF, HOSTS])
file_output(CAP_NETWORK_CONFIG, [NTP_CONF, IPTABLES_CONFIG, HOSTS_ALLOW, HOSTS_DENY])
file_output(CAP_NETWORK_CONFIG, [OPENVSWITCH_DEFAULT_SWITCH,
- OPENVSWITCH_SYSCONFIG_SWITCH, OPENVSWITCH_DEFAULT_CONTROLLER])
+ OPENVSWITCH_SYSCONFIG_SWITCH])
cmd_output(CAP_NETWORK_INFO, [IFCONFIG, '-a'])
cmd_output(CAP_NETWORK_INFO, [ROUTE, '-n'])
if os.path.exists(OPENVSWITCH_VSWITCHD_PID):
cmd_output(CAP_NETWORK_STATUS, [OVS_DPCTL, 'show', '-s'])
for d in dp_list():
- cmd_output(CAP_NETWORK_STATUS, [OVS_DPCTL, 'dump-flows', d])
+ cmd_output(CAP_NETWORK_STATUS, [OVS_DPCTL, 'dump-flows', '-m', d])
cmd_output(CAP_PROCESS_LIST, [PS, 'wwwaxf', '-eo', 'pid,tty,stat,time,nice,psr,pcpu,pmem,nwchan,wchan:25,args'], label='process-tree')
func_output(CAP_PROCESS_LIST, 'fd_usage', fd_usage)