ovs-bugtool: Add plugins previously used only under XenServer.
authorBen Pfaff <blp@nicira.com>
Wed, 6 Jul 2011 17:43:03 +0000 (10:43 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 13 Jul 2011 19:44:06 +0000 (12:44 -0700)
All of the xen-bugtool plugins that OVS has previously installed only under
XenServer are equally useful with Debian and other distributions, so
this commit installs and uses them everywhere.

18 files changed:
Makefile.am
configure.ac
debian/copyright.in
debian/openvswitch-common.install
debian/openvswitch-common.manpages
lib/automake.mk
rhel/openvswitch.spec.in
utilities/automake.mk
utilities/bugtool/automake.mk [new file with mode: 0644]
utilities/bugtool/ovs-bugtool-tc-class-show [moved from xenserver/usr_share_openvswitch_scripts_xen-bugtool-tc-class-show with 100% similarity]
utilities/bugtool/ovs-bugtool.8 [moved from utilities/ovs-bugtool.8 with 100% similarity]
utilities/bugtool/ovs-bugtool.in [moved from utilities/ovs-bugtool with 99% similarity]
utilities/bugtool/plugins/kernel-info/openvswitch.xml [moved from xenserver/etc_xensource_bugtool_kernel-info_openvswitch.xml with 100% similarity]
utilities/bugtool/plugins/network-status/openvswitch.xml [moved from xenserver/etc_xensource_bugtool_network-status_openvswitch.xml with 95% similarity]
utilities/bugtool/plugins/system-configuration.xml [moved from xenserver/etc_xensource_bugtool_system-configuration.xml with 100% similarity]
utilities/bugtool/plugins/system-configuration/openvswitch.xml [moved from xenserver/etc_xensource_bugtool_system-configuration_openvswitch.xml with 100% similarity]
xenserver/automake.mk
xenserver/openvswitch-xen.spec

index e01459a..5e449d6 100644 (file)
@@ -54,6 +54,8 @@ dist_man_MANS =
 dist_pkgdata_DATA =
 dist_pkgdata_SCRIPTS =
 dist_sbin_SCRIPTS =
+dist_scripts_SCRIPTS =
+INSTALL_DATA_LOCAL =
 man_MANS =
 noinst_DATA =
 noinst_HEADERS =
@@ -63,6 +65,7 @@ noinst_PROGRAMS =
 noinst_SCRIPTS =
 OVSIDL_BUILT =
 pkgdata_DATA =
+sbin_SCRIPTS =
 scripts_SCRIPTS =
 SUFFIXES =
 check_DATA =
@@ -147,7 +150,8 @@ rate-limit-check:
 dist-hook: $(DIST_HOOKS)
 all-local: $(ALL_LOCAL)
 clean-local: $(CLEAN_LOCAL)
-.PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL)
+install-data-local: $(INSTALL_DATA_LOCAL)
+.PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL)
 
 include lib/automake.mk
 include ofproto/automake.mk
index 046b386..9ac936f 100644 (file)
@@ -103,5 +103,6 @@ dnl This makes sure that include/openflow gets created in the build directory.
 AC_CONFIG_COMMANDS([include/openflow/openflow.h.stamp])
 
 AC_CONFIG_COMMANDS([ovsdb/ovsdbmonitor/dummy], [:])
+AC_CONFIG_COMMANDS([utilities/bugtool/dummy], [:])
 
 AC_OUTPUT
index 2f2cc48..59fd8af 100644 (file)
@@ -52,15 +52,12 @@ License:
 * The following components are licensed under the
   GNU Lesser General Public Licence version 2.1.
 
-       utilities/ovs-bugtool
-       xenserver/etc_xensource_bugtool_kernel-info_openvswitch.xml [*]
-       xenserver/etc_xensource_bugtool_network-status_openvswitch.xml [*]
-       xenserver/etc_xensource_bugtool_system-configuration.xml [*]
-       xenserver/etc_xensource_bugtool_system-configuration_openvswitch.xml [*]
-       xenserver/usr_share_openvswitch_scripts_xen-bugtool-tc-class-show [*]
-
-       * These components are only distributed in the source package.
-         They do not appear in any binary packages.
+       utilities/bugtool/ovs-bugtool
+       utilities/bugtool/ovs-bugtool-tc-class-show
+       utilities/bugtool/plugins/kernel-info/openvswitch.xml
+       utilities/bugtool/plugins/network-status/openvswitch.xml
+       utilities/bugtool/plugins/system-configuration.xml
+       utilities/bugtool/plugins/system-configuration/openvswitch.xml
 
   On Debian systems, the complete text of the
   GNU Lesser General Public Licence version 2.1 can be found in
index 43434ee..517a817 100644 (file)
@@ -4,5 +4,7 @@ _debian/utilities/ovs-appctl usr/sbin
 _debian/utilities/ovs-ofctl usr/sbin
 _debian/utilities/ovs-parse-leaks usr/bin
 _debian/utilities/ovs-pki usr/sbin
-utilities/ovs-bugtool usr/sbin
+debian/openvswitch/etc/openvswitch/bugtool-plugins etc/openvswitch
+debian/openvswitch/usr/share/openvswitch/scripts/ovs-bugtool-tc-class-show usr/share/openvswitch/scripts/ovs-bugtool-tc-class-show
+_debian/utilities/bugtool/ovs-bugtool usr/sbin
 vswitchd/vswitch.ovsschema usr/share/openvswitch
index a5d5b25..e81295b 100644 (file)
@@ -3,5 +3,5 @@ _debian/ovsdb/ovsdb-tool.1
 _debian/utilities/ovs-appctl.8
 _debian/utilities/ovs-ofctl.8
 _debian/utilities/ovs-pki.8
-utilities/ovs-bugtool.8
+utilities/bugtool/ovs-bugtool.8
 utilities/ovs-parse-leaks.8
index 8c97100..e3d7c3f 100644 (file)
@@ -273,7 +273,7 @@ $(srcdir)/lib/ofp-errors.c: \
                openflow/openflow.h openflow/nicira-ext.h > ../lib/ofp-errors.c
 EXTRA_DIST += build-aux/extract-ofp-errors
 
-install-data-local: lib-install-data-local
+INSTALL_DATA_LOCAL += lib-install-data-local
 lib-install-data-local:
        $(MKDIR_P) $(DESTDIR)$(RUNDIR)
        $(MKDIR_P) $(DESTDIR)$(PKIDIR)
index bdedb9c..040b4c0 100644 (file)
@@ -101,6 +101,7 @@ exit 0
 %defattr(-,root,root)
 /etc/init.d/openvswitch
 /etc/logrotate.d/openvswitch
+/etc/openvswitch/bugtool-plugins/*
 /usr/bin/ovs-appctl
 /usr/bin/ovs-dpctl
 /usr/bin/ovs-ofctl
@@ -130,6 +131,7 @@ exit 0
 /usr/share/man/man8/ovs-vsctl.8.gz
 /usr/share/man/man8/ovs-vswitchd.8.gz
 /usr/share/openvswitch/python/
+/usr/share/openvswitch/scripts/ovs-bugtool-*
 /usr/share/openvswitch/scripts/ovs-ctl
 /usr/share/openvswitch/scripts/ovs-lib.sh
 /usr/share/openvswitch/scripts/ovs-save
index 8bea123..520c373 100644 (file)
@@ -7,19 +7,15 @@ bin_PROGRAMS += \
 bin_SCRIPTS += utilities/ovs-pki utilities/ovs-vsctl
 if HAVE_PYTHON
 bin_SCRIPTS += \
-       utilities/ovs-bugtool \
        utilities/ovs-pcap \
        utilities/ovs-tcpundump \
        utilities/ovs-vlan-test
-man_MANS += utilities/ovs-bugtool.8
 endif
 noinst_SCRIPTS += utilities/ovs-pki-cgi utilities/ovs-parse-leaks
 scripts_SCRIPTS += utilities/ovs-ctl utilities/ovs-lib.sh utilities/ovs-save
 
 EXTRA_DIST += \
        utilities/ovs-appctl.8.in \
-       utilities/ovs-bugtool \
-       utilities/ovs-bugtool.8 \
        utilities/ovs-controller.8.in \
        utilities/ovs-ctl.in \
        utilities/ovs-dpctl.8.in \
@@ -101,3 +97,5 @@ noinst_PROGRAMS += utilities/nlmon
 utilities_nlmon_SOURCES = utilities/nlmon.c
 utilities_nlmon_LDADD = lib/libopenvswitch.a
 endif
+
+include utilities/bugtool/automake.mk
diff --git a/utilities/bugtool/automake.mk b/utilities/bugtool/automake.mk
new file mode 100644 (file)
index 0000000..8cfbda2
--- /dev/null
@@ -0,0 +1,29 @@
+if HAVE_PYTHON
+sbin_SCRIPTS += utilities/bugtool/ovs-bugtool
+man_MANS += utilities/bugtool/ovs-bugtool.8
+
+bugtool_plugins = \
+       utilities/bugtool/plugins/kernel-info/openvswitch.xml \
+       utilities/bugtool/plugins/network-status/openvswitch.xml \
+       utilities/bugtool/plugins/system-configuration.xml \
+       utilities/bugtool/plugins/system-configuration/openvswitch.xml
+
+bugtool_scripts = utilities/bugtool/ovs-bugtool-tc-class-show
+scripts_SCRIPTS += $(bugtool_scripts)
+
+bugtoolpluginsdir = $(sysconfdir)/openvswitch/bugtool-plugins
+INSTALL_DATA_LOCAL += bugtool-install-data-local
+bugtool-install-data-local:
+       for plugin in $(bugtool_plugins); do \
+         stem=`echo "$$plugin" | sed 's,utilities/bugtool/plugins/,,'`; \
+         dir=`expr "$$stem" : '\(.*\)/[^/]*$$'`; \
+         $(MKDIR_P) "$(DESTDIR)$(bugtoolpluginsdir)/$$dir"; \
+         $(INSTALL_DATA) "$(srcdir)/$$plugin" "$(DESTDIR)$(bugtoolpluginsdir)/$$stem"; \
+       done
+endif
+
+EXTRA_DIST += \
+       $(bugtool_plugins) \
+       $(bugtool_scripts) \
+       utilities/bugtool/ovs-bugtool.8 \
+       utilities/bugtool/ovs-bugtool.in
similarity index 99%
rename from utilities/ovs-bugtool
rename to utilities/bugtool/ovs-bugtool.in
index c730e37..b628939 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#! @PYTHON@
 
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of version 2.1 of the GNU Lesser General Public
@@ -58,9 +58,6 @@ import urllib
 import socket
 import base64
 
-sys.path.append('/usr/lib/python')
-sys.path.append('/usr/lib64/python')
-
 OS_RELEASE = platform.release()
 
 #
@@ -70,7 +67,7 @@ OS_RELEASE = platform.release()
 APT_SOURCES_LIST = "/etc/apt/sources.list"
 APT_SOURCES_LIST_D = "/etc/apt/sources.list.d"
 BUG_DIR = "/var/log/ovs-bugtool"
-PLUGIN_DIR = "/etc/openvswitch/bugtool"
+PLUGIN_DIR = "@sysconfdir@/openvswitch/bugtool-plugins"
 GRUB_CONFIG = '/boot/grub/menu.lst'
 BOOT_KERNEL = '/boot/vmlinuz-' + OS_RELEASE
 BOOT_INITRD = '/boot/initrd-' + OS_RELEASE + '.img'
@@ -114,12 +111,12 @@ HOSTS = '/etc/hosts'
 HOSTS_ALLOW = '/etc/hosts.allow'
 HOSTS_DENY = '/etc/hosts.deny'
 DHCP_LEASE_DIR = ['/var/lib/dhclient', '/var/lib/dhcp3']
-OPENVSWITCH_LOG_DIR = '/var/log/openvswitch'
+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 = '/etc/openvswitch/conf.db'
-OPENVSWITCH_VSWITCHD_PID = '/var/run/openvswitch/ovs-vswitchd.pid'
+OPENVSWITCH_CONF_DB = '@sysconfdir@/openvswitch/conf.db'
+OPENVSWITCH_VSWITCHD_PID = '@RUNDIR@/ovs-vswitchd.pid'
 COLLECTD_LOGS_DIR = '/var/lib/collectd/rrd'
 VAR_LOG_DIR = '/var/log/'
 VAR_LOG_CORE_DIR = '/var/log/core'
@@ -136,7 +133,7 @@ KRB5_CONF = '/etc/krb5.conf'
 # External programs
 #
 
-os.environ['PATH'] = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
+os.environ['PATH'] = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:@pkgdatadir@/scripts'
 ARP = 'arp'
 BRCTL = 'brctl'
 CAT = 'cat'
@@ -17,5 +17,5 @@
 -->
 
 <collect>
-  <command label="tc-class-show">/usr/share/openvswitch/scripts/xen-bugtool-tc-class-show</command>
+  <command label="tc-class-show">/usr/share/openvswitch/scripts/ovs-bugtool-tc-class-show</command>
 </collect>
index b3fab0c..033b46a 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2009, 2010 Nicira Networks, Inc.
+# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
@@ -15,10 +15,6 @@ EXTRA_DIST += \
        xenserver/etc_logrotate.d_openvswitch \
        xenserver/etc_profile.d_openvswitch.sh \
        xenserver/etc_xapi.d_plugins_openvswitch-cfg-update \
-       xenserver/etc_xensource_bugtool_network-status_openvswitch.xml \
-       xenserver/etc_xensource_bugtool_kernel-info_openvswitch.xml \
-       xenserver/etc_xensource_bugtool_system-configuration.xml \
-       xenserver/etc_xensource_bugtool_system-configuration_openvswitch.xml \
        xenserver/etc_xensource_scripts_vif \
        xenserver/openvswitch-xen.spec \
        xenserver/opt_xensource_libexec_InterfaceReconfigure.py \
@@ -28,5 +24,4 @@ EXTRA_DIST += \
        xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py \
        xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync \
        xenserver/usr_share_openvswitch_scripts_sysconfig.template \
-       xenserver/usr_share_openvswitch_scripts_xen-bugtool-tc-class-show \
        xenserver/uuid.py
index 77afeb2..2864e04 100644 (file)
@@ -82,17 +82,6 @@ install -m 755 xenserver/etc_profile.d_openvswitch.sh \
 install -d -m 755 $RPM_BUILD_ROOT/etc/xapi.d/plugins
 install -m 755 xenserver/etc_xapi.d_plugins_openvswitch-cfg-update \
          $RPM_BUILD_ROOT/etc/xapi.d/plugins/openvswitch-cfg-update
-install -d -m 755 $RPM_BUILD_ROOT/etc/xensource/bugtool/network-status
-install -m 644 xenserver/etc_xensource_bugtool_network-status_openvswitch.xml \
-         $RPM_BUILD_ROOT/etc/xensource/bugtool/network-status/openvswitch.xml
-install -d -m 755 $RPM_BUILD_ROOT/etc/xensource/bugtool/kernel-info
-install -m 644 xenserver/etc_xensource_bugtool_kernel-info_openvswitch.xml \
-         $RPM_BUILD_ROOT/etc/xensource/bugtool/kernel-info/openvswitch.xml
-install -m 644 xenserver/etc_xensource_bugtool_system-configuration.xml \
-         $RPM_BUILD_ROOT/etc/xensource/bugtool/system-configuration.xml
-install -d -m 755 $RPM_BUILD_ROOT/etc/xensource/bugtool/system-configuration
-install -m 644 xenserver/etc_xensource_bugtool_system-configuration_openvswitch.xml \
-         $RPM_BUILD_ROOT/etc/xensource/bugtool/system-configuration/openvswitch.xml
 install -d -m 755 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts
 install -m 755 xenserver/opt_xensource_libexec_interface-reconfigure \
              $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/interface-reconfigure
@@ -108,8 +97,6 @@ install -m 755 xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync \
                $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/ovs-xapi-sync
 install -m 755 xenserver/usr_share_openvswitch_scripts_sysconfig.template \
          $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/sysconfig.template
-install -m 755 xenserver/usr_share_openvswitch_scripts_xen-bugtool-tc-class-show \
-         $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/xen-bugtool-tc-class-show
 install -d -m 755 $RPM_BUILD_ROOT/usr/lib/xsconsole/plugins-base
 install -m 644 \
         xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py \
@@ -119,9 +106,12 @@ install -d -m 755 $RPM_BUILD_ROOT/lib/modules/%{xen_version}/extra/openvswitch
 find datapath/linux -name *.ko -exec install -m 755  \{\} $RPM_BUILD_ROOT/lib/modules/%{xen_version}/extra/openvswitch \;
 install xenserver/uuid.py $RPM_BUILD_ROOT/usr/share/openvswitch/python
 
+install -d -m 755 $RPM_BUILD_ROOT/etc/xensource/bugtool
+mv $RPM_BUILD_ROOT/etc/openvswitch/bugtool-plugins $RPM_BUILD_ROOT/etc/xensource/bugtool
+
 # Get rid of stuff we don't want to make RPM happy.
 rm \
-    $RPM_BUILD_ROOT/usr/bin/ovs-bugtool \
+    $RPM_BUILD_ROOT/usr/sbin/ovs-bugtool \
     $RPM_BUILD_ROOT/usr/bin/ovs-controller \
     $RPM_BUILD_ROOT/usr/bin/ovs-pki \
     $RPM_BUILD_ROOT/usr/share/man/man8/ovs-bugtool.8 \
@@ -328,10 +318,7 @@ exit 0
 /etc/init.d/openvswitch
 /etc/init.d/openvswitch-xapi-update
 /etc/xapi.d/plugins/openvswitch-cfg-update
-/etc/xensource/bugtool/network-status/openvswitch.xml
-/etc/xensource/bugtool/kernel-info/openvswitch.xml
-/etc/xensource/bugtool/system-configuration.xml
-/etc/xensource/bugtool/system-configuration/openvswitch.xml
+/etc/xensource/bugtool/*
 /etc/logrotate.d/openvswitch
 /etc/profile.d/openvswitch.sh
 /usr/share/openvswitch/python/ovs/__init__.py
@@ -363,7 +350,7 @@ exit 0
 /usr/share/openvswitch/scripts/InterfaceReconfigureVswitch.py
 /usr/share/openvswitch/scripts/vif
 /usr/share/openvswitch/scripts/sysconfig.template
-/usr/share/openvswitch/scripts/xen-bugtool-tc-class-show
+/usr/share/openvswitch/scripts/ovs-bugtool-tc-class-show
 /usr/share/openvswitch/scripts/ovs-save
 /usr/share/openvswitch/scripts/ovs-ctl
 /usr/share/openvswitch/scripts/ovs-lib.sh