From b2df0225a3575e2a15cdf67adc4b2dd9656fed19 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 6 Jul 2011 10:43:03 -0700 Subject: [PATCH] ovs-bugtool: Add plugins previously used only under XenServer. 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 +- rhel/openvswitch.spec.in | 2 ++ utilities/automake.mk | 6 ++-- utilities/bugtool/automake.mk | 29 +++++++++++++++++++ .../bugtool/ovs-bugtool-tc-class-show | 0 utilities/{ => bugtool}/ovs-bugtool.8 | 0 .../{ovs-bugtool => bugtool/ovs-bugtool.in} | 15 ++++------ .../plugins/kernel-info/openvswitch.xml | 0 .../plugins/network-status/openvswitch.xml | 2 +- .../bugtool/plugins/system-configuration.xml | 0 .../system-configuration/openvswitch.xml | 0 xenserver/automake.mk | 7 +---- xenserver/openvswitch-xen.spec | 25 ++++------------ 18 files changed, 64 insertions(+), 52 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 (95%) 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 e01459aa..5e449d6d 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 046b3869..9ac936f2 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 2f2cc48b..59fd8af0 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 43434eeb..517a817d 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 a5d5b253..e81295b4 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 8c97100c..e3d7c3f6 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/rhel/openvswitch.spec.in b/rhel/openvswitch.spec.in index bdedb9cd..040b4c0b 100644 --- a/rhel/openvswitch.spec.in +++ b/rhel/openvswitch.spec.in @@ -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 diff --git a/utilities/automake.mk b/utilities/automake.mk index 8bea123e..520c3731 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 \ @@ -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 index 00000000..8cfbda2b --- /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 c730e373..b628939a 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 95% rename from xenserver/etc_xensource_bugtool_network-status_openvswitch.xml rename to utilities/bugtool/plugins/network-status/openvswitch.xml index c926d9ef..8b280aa2 100644 --- a/xenserver/etc_xensource_bugtool_network-status_openvswitch.xml +++ b/utilities/bugtool/plugins/network-status/openvswitch.xml @@ -17,5 +17,5 @@ --> - /usr/share/openvswitch/scripts/xen-bugtool-tc-class-show + /usr/share/openvswitch/scripts/ovs-bugtool-tc-class-show 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 b3fab0c7..033b46ab 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 77afeb2d..2864e048 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 -- 2.30.2