[ovs-dev] [bugtool2] ovs-bugtool: Add plugins previously used only under XenServer.

Ben Pfaff blp at nicira.com
Fri Jul 1 23:59:52 UTC 2011


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.
---
 Makefile.am                                        |    6 +++-
 configure.ac                                       |    1 +
 debian/copyright.in                                |   15 ++++------
 debian/openvswitch-common.install                  |    4 ++-
 debian/openvswitch-common.manpages                 |    2 +-
 lib/automake.mk                                    |    2 +-
 utilities/automake.mk                              |    6 +---
 utilities/bugtool/automake.mk                      |   29 ++++++++++++++++++++
 .../bugtool/ovs-bugtool-tc-class-show              |    0
 utilities/{ => bugtool}/ovs-bugtool.8              |    0
 utilities/{ovs-bugtool => bugtool/ovs-bugtool.in}  |   15 ++++------
 .../bugtool/plugins/kernel-info/openvswitch.xml    |    0
 .../bugtool/plugins/network-status/openvswitch.xml |    0
 .../bugtool/plugins/system-configuration.xml       |    0
 .../plugins/system-configuration/openvswitch.xml   |    0
 xenserver/automake.mk                              |    7 +----
 xenserver/openvswitch-xen.spec                     |   25 ++++-------------
 17 files changed, 61 insertions(+), 51 deletions(-)
 create mode 100644 utilities/bugtool/automake.mk
 rename xenserver/usr_share_openvswitch_scripts_xen-bugtool-tc-class-show => utilities/bugtool/ovs-bugtool-tc-class-show (100%)
 rename utilities/{ => bugtool}/ovs-bugtool.8 (100%)
 rename utilities/{ovs-bugtool => bugtool/ovs-bugtool.in} (99%)
 rename xenserver/etc_xensource_bugtool_kernel-info_openvswitch.xml => utilities/bugtool/plugins/kernel-info/openvswitch.xml (100%)
 rename xenserver/etc_xensource_bugtool_network-status_openvswitch.xml => utilities/bugtool/plugins/network-status/openvswitch.xml (100%)
 rename xenserver/etc_xensource_bugtool_system-configuration.xml => utilities/bugtool/plugins/system-configuration.xml (100%)
 rename xenserver/etc_xensource_bugtool_system-configuration_openvswitch.xml => utilities/bugtool/plugins/system-configuration/openvswitch.xml (100%)

diff --git a/Makefile.am b/Makefile.am
index e01459a..5e449d6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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
diff --git a/configure.ac b/configure.ac
index 046b386..9ac936f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/debian/copyright.in b/debian/copyright.in
index 2f2cc48..59fd8af 100644
--- a/debian/copyright.in
+++ b/debian/copyright.in
@@ -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
diff --git a/debian/openvswitch-common.install b/debian/openvswitch-common.install
index 43434ee..517a817 100644
--- a/debian/openvswitch-common.install
+++ b/debian/openvswitch-common.install
@@ -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
diff --git a/debian/openvswitch-common.manpages b/debian/openvswitch-common.manpages
index a5d5b25..e81295b 100644
--- a/debian/openvswitch-common.manpages
+++ b/debian/openvswitch-common.manpages
@@ -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
diff --git a/lib/automake.mk b/lib/automake.mk
index 8c97100..e3d7c3f 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -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)
diff --git a/utilities/automake.mk b/utilities/automake.mk
index 0cb0bf5..918386b 100644
--- a/utilities/automake.mk
+++ b/utilities/automake.mk
@@ -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 \
@@ -102,3 +98,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
index 0000000..8cfbda2
--- /dev/null
+++ b/utilities/bugtool/automake.mk
@@ -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
diff --git a/xenserver/usr_share_openvswitch_scripts_xen-bugtool-tc-class-show b/utilities/bugtool/ovs-bugtool-tc-class-show
similarity index 100%
rename from xenserver/usr_share_openvswitch_scripts_xen-bugtool-tc-class-show
rename to utilities/bugtool/ovs-bugtool-tc-class-show
diff --git a/utilities/ovs-bugtool.8 b/utilities/bugtool/ovs-bugtool.8
similarity index 100%
rename from utilities/ovs-bugtool.8
rename to utilities/bugtool/ovs-bugtool.8
diff --git a/utilities/ovs-bugtool b/utilities/bugtool/ovs-bugtool.in
similarity index 99%
rename from utilities/ovs-bugtool
rename to utilities/bugtool/ovs-bugtool.in
index 40dbb6c..034e6b1 100755
--- a/utilities/ovs-bugtool
+++ b/utilities/bugtool/ovs-bugtool.in
@@ -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'
diff --git a/xenserver/etc_xensource_bugtool_kernel-info_openvswitch.xml b/utilities/bugtool/plugins/kernel-info/openvswitch.xml
similarity index 100%
rename from xenserver/etc_xensource_bugtool_kernel-info_openvswitch.xml
rename to utilities/bugtool/plugins/kernel-info/openvswitch.xml
diff --git a/xenserver/etc_xensource_bugtool_network-status_openvswitch.xml b/utilities/bugtool/plugins/network-status/openvswitch.xml
similarity index 100%
rename from xenserver/etc_xensource_bugtool_network-status_openvswitch.xml
rename to utilities/bugtool/plugins/network-status/openvswitch.xml
diff --git a/xenserver/etc_xensource_bugtool_system-configuration.xml b/utilities/bugtool/plugins/system-configuration.xml
similarity index 100%
rename from xenserver/etc_xensource_bugtool_system-configuration.xml
rename to utilities/bugtool/plugins/system-configuration.xml
diff --git a/xenserver/etc_xensource_bugtool_system-configuration_openvswitch.xml b/utilities/bugtool/plugins/system-configuration/openvswitch.xml
similarity index 100%
rename from xenserver/etc_xensource_bugtool_system-configuration_openvswitch.xml
rename to utilities/bugtool/plugins/system-configuration/openvswitch.xml
diff --git a/xenserver/automake.mk b/xenserver/automake.mk
index b3fab0c..033b46a 100644
--- a/xenserver/automake.mk
+++ b/xenserver/automake.mk
@@ -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
diff --git a/xenserver/openvswitch-xen.spec b/xenserver/openvswitch-xen.spec
index 77afeb2..2864e04 100644
--- a/xenserver/openvswitch-xen.spec
+++ b/xenserver/openvswitch-xen.spec
@@ -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
-- 
1.7.4.4




More information about the dev mailing list