2009-07-08 13:19:16 -07:00
|
|
|
# Spec file for vswitch and related programs.
|
|
|
|
|
2010-01-08 10:41:48 -08:00
|
|
|
# Copyright (C) 2009, 2010 Nicira Networks, Inc.
|
2009-07-08 13:19:16 -07:00
|
|
|
#
|
|
|
|
# Copying and distribution of this file, with or without modification,
|
|
|
|
# are permitted in any medium without royalty provided the copyright
|
|
|
|
# notice and this notice are preserved. This file is offered as-is,
|
|
|
|
# without warranty of any kind.
|
|
|
|
|
|
|
|
# When building, the rpmbuild command line should define
|
|
|
|
# vswitch_version, xen_version, and build_number using -D arguments.
|
|
|
|
# for example:
|
|
|
|
#
|
|
|
|
# rpmbuild -D "vswitch_version 0.8.9~1+build123" -D "xen_version 2.6.18-128.1.1.el5.xs5.1.0.483.1000xen" -D "build_number --with-build-number=123" -bb /usr/src/redhat/SPECS/vswitch-xen.spec
|
|
|
|
#
|
|
|
|
%define version %{vswitch_version}-%{xen_version}
|
|
|
|
|
|
|
|
Name: vswitch
|
|
|
|
Summary: Virtual switch
|
|
|
|
Group: System Environment/Daemons
|
2009-06-08 17:29:37 -07:00
|
|
|
URL: http://www.openvswitch.org/
|
2009-07-08 13:19:16 -07:00
|
|
|
Version: %{vswitch_version}
|
2009-07-29 23:37:28 -07:00
|
|
|
|
|
|
|
# The entire source code is ASL 2.0 except datapath/ which is GPLv2
|
|
|
|
License: ASL 2.0 and GPLv2
|
2009-07-08 13:19:16 -07:00
|
|
|
Release: 1
|
|
|
|
Source: openvswitch-%{vswitch_version}.tar.gz
|
|
|
|
Buildroot: /tmp/vswitch-xen-rpm
|
2009-06-05 12:24:58 -07:00
|
|
|
Requires: kernel-xen = %(echo '%{xen_version}' | sed 's/xen$//')
|
2009-09-08 13:20:35 -07:00
|
|
|
# The following Conflicts prevents the "vswitch" package generated by
|
|
|
|
# this spec file from installing at the same time as the "openvswitch"
|
|
|
|
# package shipped with XenServer 5.5.900. In fact, the packages
|
|
|
|
# contain some files with identical names anyhow, so they will not
|
|
|
|
# coexist, but adding an explicit Conflicts makes this conflict more
|
|
|
|
# obvious.
|
|
|
|
Conflicts: openvswitch
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
|
|
%description
|
|
|
|
The vswitch provides standard network bridging functions augmented with
|
|
|
|
support for the OpenFlow protocol for remote per-flow control of
|
|
|
|
traffic.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q -n openvswitch-%{vswitch_version}
|
|
|
|
|
|
|
|
%build
|
2009-10-07 10:19:31 -07:00
|
|
|
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} --with-l26=/lib/modules/%{xen_version}/build --enable-ssl %{build_number}
|
2009-06-09 13:49:49 -07:00
|
|
|
make %{_smp_mflags}
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
|
|
%install
|
|
|
|
rm -rf $RPM_BUILD_ROOT
|
2009-09-11 15:13:08 -07:00
|
|
|
make install DESTDIR=$RPM_BUILD_ROOT
|
2009-07-08 13:19:16 -07:00
|
|
|
install -d -m 755 $RPM_BUILD_ROOT/etc
|
|
|
|
install -d -m 755 $RPM_BUILD_ROOT/etc/init.d
|
|
|
|
install -m 755 xenserver/etc_init.d_vswitch \
|
|
|
|
$RPM_BUILD_ROOT/etc/init.d/vswitch
|
|
|
|
install -m 755 xenserver/etc_init.d_vswitch-xapi-update \
|
|
|
|
$RPM_BUILD_ROOT/etc/init.d/vswitch-xapi-update
|
|
|
|
install -d -m 755 $RPM_BUILD_ROOT/etc/sysconfig
|
|
|
|
install -d -m 755 $RPM_BUILD_ROOT/etc/logrotate.d
|
|
|
|
install -m 755 xenserver/etc_logrotate.d_vswitch \
|
|
|
|
$RPM_BUILD_ROOT/etc/logrotate.d/vswitch
|
|
|
|
install -d -m 755 $RPM_BUILD_ROOT/etc/profile.d
|
|
|
|
install -m 755 xenserver/etc_profile.d_vswitch.sh \
|
|
|
|
$RPM_BUILD_ROOT/etc/profile.d/vswitch.sh
|
|
|
|
install -d -m 755 $RPM_BUILD_ROOT/etc/xapi.d/plugins
|
|
|
|
install -m 755 xenserver/etc_xapi.d_plugins_vswitch-cfg-update \
|
|
|
|
$RPM_BUILD_ROOT/etc/xapi.d/plugins/vswitch-cfg-update
|
2009-09-11 15:13:08 -07:00
|
|
|
install -d -m 755 $RPM_BUILD_ROOT/usr/share/vswitch/scripts
|
2010-01-26 11:46:43 -08:00
|
|
|
install -m 644 vswitchd/vswitch.ovsschema \
|
|
|
|
$RPM_BUILD_ROOT/usr/share/vswitch/vswitch.ovsschema
|
2009-07-08 13:19:16 -07:00
|
|
|
install -m 755 xenserver/opt_xensource_libexec_interface-reconfigure \
|
2009-09-11 15:13:08 -07:00
|
|
|
$RPM_BUILD_ROOT/usr/share/vswitch/scripts/interface-reconfigure
|
2010-02-05 17:43:57 -08:00
|
|
|
install -m 644 xenserver/opt_xensource_libexec_InterfaceReconfigure.py \
|
2010-01-22 12:55:37 -08:00
|
|
|
$RPM_BUILD_ROOT/usr/share/vswitch/scripts/InterfaceReconfigure.py
|
2010-02-05 17:43:57 -08:00
|
|
|
install -m 644 xenserver/opt_xensource_libexec_InterfaceReconfigureBridge.py \
|
2010-01-22 12:55:37 -08:00
|
|
|
$RPM_BUILD_ROOT/usr/share/vswitch/scripts/InterfaceReconfigureBridge.py
|
2010-02-05 17:43:57 -08:00
|
|
|
install -m 644 xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py \
|
2010-01-22 12:55:37 -08:00
|
|
|
$RPM_BUILD_ROOT/usr/share/vswitch/scripts/InterfaceReconfigureVswitch.py
|
2009-07-08 13:19:16 -07:00
|
|
|
install -m 755 xenserver/etc_xensource_scripts_vif \
|
2009-09-11 15:13:08 -07:00
|
|
|
$RPM_BUILD_ROOT/usr/share/vswitch/scripts/vif
|
|
|
|
install -m 755 xenserver/usr_share_vswitch_scripts_dump-vif-details \
|
|
|
|
$RPM_BUILD_ROOT/usr/share/vswitch/scripts/dump-vif-details
|
2009-10-22 17:43:28 -07:00
|
|
|
install -m 755 xenserver/usr_share_vswitch_scripts_refresh-xs-network-uuids \
|
|
|
|
$RPM_BUILD_ROOT/usr/share/vswitch/scripts/refresh-xs-network-uuids
|
2009-08-05 16:02:19 -07:00
|
|
|
install -m 755 xenserver/usr_sbin_xen-bugtool \
|
2009-09-11 15:13:08 -07:00
|
|
|
$RPM_BUILD_ROOT/usr/share/vswitch/scripts/xen-bugtool
|
xenserver: Fix "brctl show" compatibility by introducing "brctl" wrapper.
Bug NIC-19, which reported that "brctl show" did not format its output in
the way expected by Citrix QA scripts, was believed fixed by commit
35c979bff4 "vswitchd: Support creating fake bond device interfaces."
Unfortunately, this commit was not tested on a XenServer before it was
committed. Due to differences in the actual test environment and the
XenServer environment, which have different versions of the bridge-utils
package that contains brctl, that commit did not fix the problem observed
by Citrix QA. In particular, the XenServer brctl uses sysfs to obtain
the information displayed by "brctl show", but the previous commit only
fixed up the information output by the bridge ioctls.
The natural way to fix this problem would be to fix up the sysfs support
as well. I started out along that path, but became bogged down in all
the details of the kernel sysfs.
This commit takes an alternate approach, by introducing a wrapper around
the system brctl binary that implements "brctl show" itself and delegates
all other functionality to the original binary (in a different location).
This will not fix tools that do not call into brctl, but to the best of
my knowledge there are no such tools used in the Citrix QA process.
Thanks to Justin and Reid for much feedback.
Bug NIC-19.
2009-08-19 14:14:40 -07:00
|
|
|
install -m 755 xenserver/usr_sbin_brctl \
|
2009-09-11 15:13:08 -07:00
|
|
|
$RPM_BUILD_ROOT/usr/share/vswitch/scripts/brctl
|
|
|
|
install -m 755 xenserver/usr_share_vswitch_scripts_sysconfig.template \
|
|
|
|
$RPM_BUILD_ROOT/usr/share/vswitch/scripts/sysconfig.template
|
2009-06-18 14:17:32 -07:00
|
|
|
install -m 644 \
|
2009-07-08 13:19:16 -07:00
|
|
|
xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py \
|
2009-09-11 15:13:08 -07:00
|
|
|
$RPM_BUILD_ROOT/usr/share/vswitch/scripts/XSFeatureVSwitch.py
|
2009-07-08 13:19:16 -07:00
|
|
|
|
2009-08-27 14:45:36 -07:00
|
|
|
install -d -m 755 $RPM_BUILD_ROOT/lib/modules/%{xen_version}/kernel/net/vswitch
|
|
|
|
find datapath/linux-2.6 -name *.ko -exec install -m 755 \{\} $RPM_BUILD_ROOT/lib/modules/%{xen_version}/kernel/net/vswitch \;
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
|
|
# Get rid of stuff we don't want to make RPM happy.
|
2009-09-11 15:13:08 -07:00
|
|
|
rm \
|
|
|
|
$RPM_BUILD_ROOT/usr/bin/ovs-controller \
|
|
|
|
$RPM_BUILD_ROOT/usr/bin/ovs-discover \
|
|
|
|
$RPM_BUILD_ROOT/usr/bin/ovs-kill \
|
|
|
|
$RPM_BUILD_ROOT/usr/bin/ovs-openflowd \
|
|
|
|
$RPM_BUILD_ROOT/usr/bin/ovs-pki \
|
|
|
|
$RPM_BUILD_ROOT/usr/bin/ovs-wdt \
|
|
|
|
$RPM_BUILD_ROOT/usr/sbin/ovs-monitor \
|
|
|
|
$RPM_BUILD_ROOT/usr/share/man/man8/ovs-controller.8 \
|
|
|
|
$RPM_BUILD_ROOT/usr/share/man/man8/ovs-discover.8 \
|
|
|
|
$RPM_BUILD_ROOT/usr/share/man/man8/ovs-kill.8 \
|
|
|
|
$RPM_BUILD_ROOT/usr/share/man/man8/ovs-openflowd.8 \
|
|
|
|
$RPM_BUILD_ROOT/usr/share/man/man8/ovs-pki.8
|
2009-08-27 14:45:36 -07:00
|
|
|
rm -f $RPM_BUILD_ROOT/lib/modules/%{xen_version}/kernel/net/vswitch/veth_mod.ko
|
2009-07-08 13:19:16 -07:00
|
|
|
|
2009-09-11 14:41:39 -07:00
|
|
|
install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
|
|
|
|
|
2009-07-08 13:19:16 -07:00
|
|
|
%clean
|
|
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
|
2009-09-11 14:41:39 -07:00
|
|
|
%post
|
2009-07-08 13:19:16 -07:00
|
|
|
if [ ! -f /etc/xensource-inventory ]; then
|
|
|
|
printf "XenSource inventory not present in /etc/xensource-inventory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "1" ]; then
|
2009-09-08 13:18:13 -07:00
|
|
|
if md5sum -c --status <<EOF
|
|
|
|
ca141d60061dcfdade73e75abc6529b5 /usr/sbin/brctl
|
2009-07-08 13:19:16 -07:00
|
|
|
b8e9835862ef1a9cec2a3f477d26c989 /etc/xensource/scripts/vif
|
|
|
|
51970ad613a3996d5997e18e44db47da /opt/xensource/libexec/interface-reconfigure
|
2009-08-05 16:02:19 -07:00
|
|
|
5654c8c36699fcc8744ca9cd5b855414 /usr/sbin/xen-bugtool
|
2009-07-08 13:19:16 -07:00
|
|
|
EOF
|
|
|
|
then
|
2009-09-08 13:18:13 -07:00
|
|
|
printf "\nVerified host scripts from XenServer 5.5.0.\n\n"
|
|
|
|
elif md5sum -c --status <<EOF
|
|
|
|
ca141d60061dcfdade73e75abc6529b5 /usr/sbin/brctl
|
|
|
|
b8e9835862ef1a9cec2a3f477d26c989 /etc/xensource/scripts/vif
|
2010-01-29 15:54:47 -05:00
|
|
|
51970ad613a3996d5997e18e44db47da /opt/xensource/libexec/interface-reconfigure
|
|
|
|
f6519085c2fc5f7bc4eccc294ed62000 /usr/sbin/xen-bugtool
|
|
|
|
EOF
|
|
|
|
then
|
|
|
|
printf "\nVerified host scripts from XenServer 5.5.0-24648p (Update 1)\n"
|
|
|
|
printf "or 5.5.0-25727p (Update 2).\n\n"
|
|
|
|
elif md5sum -c --status <<EOF
|
|
|
|
ca141d60061dcfdade73e75abc6529b5 /usr/sbin/brctl
|
|
|
|
b8e9835862ef1a9cec2a3f477d26c989 /etc/xensource/scripts/vif
|
2009-09-08 13:18:13 -07:00
|
|
|
ce451d3c985fd1db6497a363f0d9dedb /opt/xensource/libexec/interface-reconfigure
|
|
|
|
2b53f500431fcba5276c896e9e4281b9 /usr/sbin/xen-bugtool
|
|
|
|
EOF
|
2009-09-11 13:13:37 -07:00
|
|
|
then
|
2009-09-08 13:18:13 -07:00
|
|
|
printf "\nVerified host scripts from XenServer 5.5.900.\n\n"
|
|
|
|
else
|
xenserver: Fix "brctl show" compatibility by introducing "brctl" wrapper.
Bug NIC-19, which reported that "brctl show" did not format its output in
the way expected by Citrix QA scripts, was believed fixed by commit
35c979bff4 "vswitchd: Support creating fake bond device interfaces."
Unfortunately, this commit was not tested on a XenServer before it was
committed. Due to differences in the actual test environment and the
XenServer environment, which have different versions of the bridge-utils
package that contains brctl, that commit did not fix the problem observed
by Citrix QA. In particular, the XenServer brctl uses sysfs to obtain
the information displayed by "brctl show", but the previous commit only
fixed up the information output by the bridge ioctls.
The natural way to fix this problem would be to fix up the sysfs support
as well. I started out along that path, but became bogged down in all
the details of the kernel sysfs.
This commit takes an alternate approach, by introducing a wrapper around
the system brctl binary that implements "brctl show" itself and delegates
all other functionality to the original binary (in a different location).
This will not fix tools that do not call into brctl, but to the best of
my knowledge there are no such tools used in the Citrix QA process.
Thanks to Justin and Reid for much feedback.
Bug NIC-19.
2009-08-19 14:14:40 -07:00
|
|
|
cat <<EOF
|
|
|
|
|
2009-09-08 13:18:13 -07:00
|
|
|
The original XenServer scripts replaced by this package are not those
|
|
|
|
of any supported version of XenServer. This could lead to unexpected
|
|
|
|
behavior of your server. Unless you are sure you know what you are
|
|
|
|
doing, it is highly recommended that you remove this package
|
|
|
|
immediately after the install completes, which will restore the
|
|
|
|
XenServer scripts that you were previously using.
|
xenserver: Fix "brctl show" compatibility by introducing "brctl" wrapper.
Bug NIC-19, which reported that "brctl show" did not format its output in
the way expected by Citrix QA scripts, was believed fixed by commit
35c979bff4 "vswitchd: Support creating fake bond device interfaces."
Unfortunately, this commit was not tested on a XenServer before it was
committed. Due to differences in the actual test environment and the
XenServer environment, which have different versions of the bridge-utils
package that contains brctl, that commit did not fix the problem observed
by Citrix QA. In particular, the XenServer brctl uses sysfs to obtain
the information displayed by "brctl show", but the previous commit only
fixed up the information output by the bridge ioctls.
The natural way to fix this problem would be to fix up the sysfs support
as well. I started out along that path, but became bogged down in all
the details of the kernel sysfs.
This commit takes an alternate approach, by introducing a wrapper around
the system brctl binary that implements "brctl show" itself and delegates
all other functionality to the original binary (in a different location).
This will not fix tools that do not call into brctl, but to the best of
my knowledge there are no such tools used in the Citrix QA process.
Thanks to Justin and Reid for much feedback.
Bug NIC-19.
2009-08-19 14:14:40 -07:00
|
|
|
|
|
|
|
EOF
|
|
|
|
fi
|
2009-07-08 13:19:16 -07:00
|
|
|
fi
|
|
|
|
|
2010-01-26 10:35:11 -08:00
|
|
|
if test ! -e /var/xapi/network.dbcache; then
|
2009-07-08 13:19:16 -07:00
|
|
|
if test "$1" = 1; then
|
|
|
|
printf "Creating xapi database cache... "
|
|
|
|
else
|
|
|
|
printf "warning: Open vSwitch is being re-installed or upgraded,\n"
|
|
|
|
printf " but the xapi database cache is missing.\n"
|
|
|
|
printf "Re-creating xapi database cache... "
|
|
|
|
fi
|
|
|
|
|
2009-09-15 10:07:23 -07:00
|
|
|
if /usr/share/vswitch/scripts/interface-reconfigure rewrite; then
|
2009-07-08 13:19:16 -07:00
|
|
|
printf "done.\n"
|
|
|
|
else
|
|
|
|
printf "FAILED\n"
|
|
|
|
printf "Open vSwitch can only be installed on a XenServer that\n"
|
|
|
|
printf "has connectivity to xapi on the pool master. Please\n"
|
|
|
|
printf "fix connectivity to the pool master, then try again.\n"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2009-08-27 14:45:36 -07:00
|
|
|
# Ensure that modprobe will find our modules.
|
|
|
|
depmod %{xen_version}
|
|
|
|
|
2009-07-28 15:44:58 -07:00
|
|
|
if grep -F net.ipv4.conf.all.arp_filter /etc/sysctl.conf >/dev/null 2>&1; then :; else
|
|
|
|
cat >>/etc/sysctl.conf <<EOF
|
|
|
|
# This works around an issue in xhad, which binds to a particular
|
|
|
|
# Ethernet device, which in turn causes ICMP port unreachable messages
|
|
|
|
# if packets are received are on the wrong interface, which in turn
|
|
|
|
# can happen if we send out ARP replies on every interface (as Linux
|
|
|
|
# does by default) instead of just on the interface that has the IP
|
|
|
|
# address being ARPed for, which this sysctl setting in turn works
|
|
|
|
# around.
|
|
|
|
#
|
|
|
|
# Bug #1378.
|
|
|
|
net.ipv4.conf.all.arp_filter = 1
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
2009-12-10 15:28:49 -08:00
|
|
|
if test ! -e /etc/ovs-vswitchd.conf.db; then
|
|
|
|
# Create ovs-vswitchd config database
|
2009-12-11 13:03:01 -08:00
|
|
|
ovsdb-tool -vANY:console:emer create /etc/ovs-vswitchd.conf.db \
|
2010-01-26 11:46:43 -08:00
|
|
|
/usr/share/vswitch/vswitch.ovsschema \
|
2009-12-10 15:28:49 -08:00
|
|
|
|
|
|
|
# Create initial table in config database
|
2009-12-11 13:03:01 -08:00
|
|
|
ovsdb-tool -vANY:console:emer transact /etc/ovs-vswitchd.conf.db \
|
2009-12-10 15:28:49 -08:00
|
|
|
'[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' \
|
|
|
|
> /dev/null
|
|
|
|
fi
|
2009-07-08 13:19:16 -07:00
|
|
|
|
2009-09-03 14:28:44 -07:00
|
|
|
# Create default or update existing /etc/sysconfig/vswitch.
|
|
|
|
SYSCONFIG=/etc/sysconfig/vswitch
|
2009-09-11 15:13:08 -07:00
|
|
|
TEMPLATE=/usr/share/vswitch/scripts/sysconfig.template
|
2009-09-03 14:28:44 -07:00
|
|
|
if [ ! -e $SYSCONFIG ]; then
|
|
|
|
cp $TEMPLATE $SYSCONFIG
|
|
|
|
else
|
|
|
|
for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE)
|
|
|
|
do
|
|
|
|
if ! grep $var $SYSCONFIG >/dev/null 2>&1; then
|
|
|
|
echo >> $SYSCONFIG
|
|
|
|
sed -n "/$var:/,/$var=/p" $TEMPLATE >> $SYSCONFIG
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
xenserver: Fix "brctl show" compatibility by introducing "brctl" wrapper.
Bug NIC-19, which reported that "brctl show" did not format its output in
the way expected by Citrix QA scripts, was believed fixed by commit
35c979bff4 "vswitchd: Support creating fake bond device interfaces."
Unfortunately, this commit was not tested on a XenServer before it was
committed. Due to differences in the actual test environment and the
XenServer environment, which have different versions of the bridge-utils
package that contains brctl, that commit did not fix the problem observed
by Citrix QA. In particular, the XenServer brctl uses sysfs to obtain
the information displayed by "brctl show", but the previous commit only
fixed up the information output by the bridge ioctls.
The natural way to fix this problem would be to fix up the sysfs support
as well. I started out along that path, but became bogged down in all
the details of the kernel sysfs.
This commit takes an alternate approach, by introducing a wrapper around
the system brctl binary that implements "brctl show" itself and delegates
all other functionality to the original binary (in a different location).
This will not fix tools that do not call into brctl, but to the best of
my knowledge there are no such tools used in the Citrix QA process.
Thanks to Justin and Reid for much feedback.
Bug NIC-19.
2009-08-19 14:14:40 -07:00
|
|
|
# Replace XenServer files by our versions.
|
2009-09-11 15:13:08 -07:00
|
|
|
mkdir -p /usr/lib/vswitch/xs-original \
|
2009-07-08 13:19:16 -07:00
|
|
|
|| printf "Could not create script backup directory.\n"
|
|
|
|
for f in \
|
|
|
|
/opt/xensource/libexec/interface-reconfigure \
|
2010-01-22 12:55:37 -08:00
|
|
|
/opt/xensource/libexec/InterfaceReconfigure.py \
|
|
|
|
/opt/xensource/libexec/InterfaceReconfigureBridge.py \
|
|
|
|
/opt/xensource/libexec/InterfaceReconfigureVswitch.py \
|
2009-08-05 16:02:19 -07:00
|
|
|
/etc/xensource/scripts/vif \
|
xenserver: Fix "brctl show" compatibility by introducing "brctl" wrapper.
Bug NIC-19, which reported that "brctl show" did not format its output in
the way expected by Citrix QA scripts, was believed fixed by commit
35c979bff4 "vswitchd: Support creating fake bond device interfaces."
Unfortunately, this commit was not tested on a XenServer before it was
committed. Due to differences in the actual test environment and the
XenServer environment, which have different versions of the bridge-utils
package that contains brctl, that commit did not fix the problem observed
by Citrix QA. In particular, the XenServer brctl uses sysfs to obtain
the information displayed by "brctl show", but the previous commit only
fixed up the information output by the bridge ioctls.
The natural way to fix this problem would be to fix up the sysfs support
as well. I started out along that path, but became bogged down in all
the details of the kernel sysfs.
This commit takes an alternate approach, by introducing a wrapper around
the system brctl binary that implements "brctl show" itself and delegates
all other functionality to the original binary (in a different location).
This will not fix tools that do not call into brctl, but to the best of
my knowledge there are no such tools used in the Citrix QA process.
Thanks to Justin and Reid for much feedback.
Bug NIC-19.
2009-08-19 14:14:40 -07:00
|
|
|
/usr/sbin/xen-bugtool \
|
|
|
|
/usr/sbin/brctl
|
2009-07-08 13:19:16 -07:00
|
|
|
do
|
|
|
|
s=$(basename "$f")
|
|
|
|
t=$(readlink "$f")
|
2010-01-22 12:55:37 -08:00
|
|
|
if [ -f "$f" ] && [ "$t" != "/usr/share/vswitch/scripts/$s" ]; then
|
2009-09-11 15:13:08 -07:00
|
|
|
mv "$f" /usr/lib/vswitch/xs-original/ \
|
2009-07-08 13:19:16 -07:00
|
|
|
|| printf "Could not save original XenServer $s script\n"
|
2009-09-11 15:13:08 -07:00
|
|
|
ln -s "/usr/share/vswitch/scripts/$s" "$f" \
|
2009-07-08 13:19:16 -07:00
|
|
|
|| printf "Could not link to vSwitch $s script\n"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Install xsconsole plugin
|
|
|
|
plugin=$(readlink /usr/lib/xsconsole/plugins-base/XSFeatureVSwitch.py)
|
2009-09-11 15:13:08 -07:00
|
|
|
if [ "$plugin" != "/usr/share/vswitch/scripts/XSFeatureVSwitch.py" ]; then
|
2009-07-08 13:19:16 -07:00
|
|
|
rm -f /usr/lib/xsconsole/plugins-base/XSFeatureVSwitch.py
|
2009-09-11 15:13:08 -07:00
|
|
|
ln -s /usr/share/vswitch/scripts/XSFeatureVSwitch.py /usr/lib/xsconsole/plugins-base/ || printf "Could not link to vSswitch xsconsole plugin.\n"
|
2009-07-08 13:19:16 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Ensure all required services are set to run
|
|
|
|
for s in vswitch vswitch-xapi-update; do
|
|
|
|
if chkconfig --list $s >/dev/null 2>&1; then
|
|
|
|
chkconfig --del $s || printf "Could not remove $s init script."
|
|
|
|
fi
|
|
|
|
chkconfig --add $s || printf "Could not add $s init script."
|
|
|
|
chkconfig $s on || printf "Could not enable $s init script."
|
|
|
|
done
|
|
|
|
|
2010-01-22 12:55:37 -08:00
|
|
|
# Configure system to use vswitch
|
|
|
|
echo vswitch > /etc/xensource/network.conf
|
|
|
|
|
2009-07-08 13:19:16 -07:00
|
|
|
if [ "$1" = "1" ]; then # $1 = 2 for upgrade
|
|
|
|
printf "\nYou MUST reboot the server NOW to complete the change to the\n"
|
|
|
|
printf "the vSwitch. Attempts to modify networking on the server\n"
|
|
|
|
printf "or any hosted VM will fail until after the reboot and could\n"
|
|
|
|
printf "leave the server in an state requiring manual recovery.\n\n"
|
|
|
|
else
|
|
|
|
printf "\nTo use the new vSwitch, you should reboot the server\n"
|
|
|
|
printf "now. Failure to do so may result in incorrect operation.\n\n"
|
|
|
|
fi
|
|
|
|
|
|
|
|
%preun
|
|
|
|
if [ "$1" = "0" ]; then # $1 = 1 for upgrade
|
|
|
|
for s in vswitch vswitch-xapi-update; do
|
|
|
|
chkconfig --del $s || printf "Could not remove $s init script."
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
%postun
|
|
|
|
if [ "$1" = "0" ]; then # $1 = 1 for upgrade
|
|
|
|
|
|
|
|
rm -f /usr/lib/xsconsole/plugins-base/XSFeatureVSwitch.py \
|
|
|
|
/usr/lib/xsconsole/plugins-base/XSFeatureVSwitch.pyc \
|
|
|
|
/usr/lib/xsconsole/plugins-base/XSFeatureVSwitch.pyo \
|
|
|
|
|| printf "Could not remove vSwitch xsconsole plugin.\n"
|
|
|
|
|
|
|
|
# Restore original XenServer scripts
|
|
|
|
for f in \
|
|
|
|
/opt/xensource/libexec/interface-reconfigure \
|
2009-08-05 16:02:19 -07:00
|
|
|
/etc/xensource/scripts/vif \
|
xenserver: Fix "brctl show" compatibility by introducing "brctl" wrapper.
Bug NIC-19, which reported that "brctl show" did not format its output in
the way expected by Citrix QA scripts, was believed fixed by commit
35c979bff4 "vswitchd: Support creating fake bond device interfaces."
Unfortunately, this commit was not tested on a XenServer before it was
committed. Due to differences in the actual test environment and the
XenServer environment, which have different versions of the bridge-utils
package that contains brctl, that commit did not fix the problem observed
by Citrix QA. In particular, the XenServer brctl uses sysfs to obtain
the information displayed by "brctl show", but the previous commit only
fixed up the information output by the bridge ioctls.
The natural way to fix this problem would be to fix up the sysfs support
as well. I started out along that path, but became bogged down in all
the details of the kernel sysfs.
This commit takes an alternate approach, by introducing a wrapper around
the system brctl binary that implements "brctl show" itself and delegates
all other functionality to the original binary (in a different location).
This will not fix tools that do not call into brctl, but to the best of
my knowledge there are no such tools used in the Citrix QA process.
Thanks to Justin and Reid for much feedback.
Bug NIC-19.
2009-08-19 14:14:40 -07:00
|
|
|
/usr/sbin/xen-bugtool \
|
|
|
|
/usr/sbin/brctl
|
2009-07-08 13:19:16 -07:00
|
|
|
do
|
|
|
|
s=$(basename "$f")
|
2009-09-11 15:13:08 -07:00
|
|
|
if [ ! -f "/usr/lib/vswitch/xs-original/$s" ]; then
|
|
|
|
printf "Original XenServer $s script not present in /usr/lib/vswitch/xs-original\n"
|
2009-07-08 13:19:16 -07:00
|
|
|
printf "Could not restore original XenServer script.\n"
|
|
|
|
else
|
|
|
|
(rm -f "$f" \
|
2009-09-11 15:13:08 -07:00
|
|
|
&& mv "/usr/lib/vswitch/xs-original/$s" "$f") \
|
2009-07-08 13:19:16 -07:00
|
|
|
|| printf "Could not restore original XenServer $s script.\n"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2009-08-27 14:36:06 -07:00
|
|
|
# Remove all configuration files
|
2009-12-07 18:18:29 -08:00
|
|
|
rm -f /etc/ovs-vswitchd.conf.db
|
2009-07-08 13:19:16 -07:00
|
|
|
rm -f /etc/sysconfig/vswitch
|
|
|
|
rm -f /etc/ovs-vswitchd.cacert
|
2010-01-26 10:35:11 -08:00
|
|
|
rm -f /var/xapi/network.dbcache
|
2009-07-08 13:19:16 -07:00
|
|
|
|
2010-01-22 12:55:37 -08:00
|
|
|
# Configure system to use bridge
|
|
|
|
echo bridge > /etc/xensource/network.conf
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
|
|
printf "\nYou MUST reboot the server now to complete the change to\n"
|
|
|
|
printf "standard Xen networking. Attempts to modify networking on the\n"
|
|
|
|
printf "server or any hosted VM will fail until after the reboot and\n"
|
|
|
|
printf "could leave the server in a state requiring manual recovery.\n\n"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
%files
|
|
|
|
%defattr(-,root,root)
|
|
|
|
/etc/init.d/vswitch
|
|
|
|
/etc/init.d/vswitch-xapi-update
|
|
|
|
/etc/xapi.d/plugins/vswitch-cfg-update
|
|
|
|
/etc/logrotate.d/vswitch
|
|
|
|
/etc/profile.d/vswitch.sh
|
2009-08-27 14:45:36 -07:00
|
|
|
/lib/modules/%{xen_version}/kernel/net/vswitch/openvswitch_mod.ko
|
|
|
|
/lib/modules/%{xen_version}/kernel/net/vswitch/brcompat_mod.ko
|
2009-12-06 15:10:35 -08:00
|
|
|
%if %(echo '%{xen_version}'|awk -F"." '{if ($3>=18) print 1; else print 0;}')
|
|
|
|
/lib/modules/%{xen_version}/kernel/net/vswitch/ip_gre_mod.ko
|
|
|
|
%endif
|
2009-09-11 15:13:08 -07:00
|
|
|
/usr/share/vswitch/scripts/dump-vif-details
|
2009-10-22 17:43:28 -07:00
|
|
|
/usr/share/vswitch/scripts/refresh-xs-network-uuids
|
2009-09-11 15:13:08 -07:00
|
|
|
/usr/share/vswitch/scripts/interface-reconfigure
|
2010-01-22 12:55:37 -08:00
|
|
|
/usr/share/vswitch/scripts/InterfaceReconfigure.py
|
|
|
|
/usr/share/vswitch/scripts/InterfaceReconfigureBridge.py
|
|
|
|
/usr/share/vswitch/scripts/InterfaceReconfigureVswitch.py
|
2009-09-11 15:13:08 -07:00
|
|
|
/usr/share/vswitch/scripts/vif
|
|
|
|
/usr/share/vswitch/scripts/xen-bugtool
|
|
|
|
/usr/share/vswitch/scripts/XSFeatureVSwitch.py
|
|
|
|
/usr/share/vswitch/scripts/brctl
|
|
|
|
/usr/share/vswitch/scripts/sysconfig.template
|
2010-01-26 11:46:43 -08:00
|
|
|
/usr/share/vswitch/vswitch.ovsschema
|
2009-09-11 15:13:08 -07:00
|
|
|
/usr/sbin/ovs-brcompatd
|
|
|
|
/usr/sbin/ovs-vswitchd
|
2009-12-03 15:03:38 -08:00
|
|
|
/usr/sbin/ovsdb-server
|
2009-09-11 15:13:08 -07:00
|
|
|
/usr/bin/ovs-appctl
|
|
|
|
/usr/bin/ovs-dpctl
|
|
|
|
/usr/bin/ovs-ofctl
|
2009-09-14 10:05:13 -07:00
|
|
|
/usr/bin/ovs-vsctl
|
2009-12-03 15:03:38 -08:00
|
|
|
/usr/bin/ovsdb-client
|
|
|
|
/usr/bin/ovsdb-tool
|
|
|
|
/usr/share/man/man1/ovsdb-client.1.gz
|
|
|
|
/usr/share/man/man1/ovsdb-server.1.gz
|
|
|
|
/usr/share/man/man1/ovsdb-tool.1.gz
|
2009-09-11 15:13:08 -07:00
|
|
|
/usr/share/man/man8/ovs-appctl.8.gz
|
|
|
|
/usr/share/man/man8/ovs-brcompatd.8.gz
|
|
|
|
/usr/share/man/man8/ovs-dpctl.8.gz
|
|
|
|
/usr/share/man/man8/ovs-ofctl.8.gz
|
2009-09-14 10:05:13 -07:00
|
|
|
/usr/share/man/man8/ovs-vsctl.8.gz
|
2009-09-11 15:13:08 -07:00
|
|
|
/usr/share/man/man8/ovs-vswitchd.8.gz
|
2009-09-11 14:41:39 -07:00
|
|
|
/var/lib/openvswitch
|
2010-02-05 18:15:08 -08:00
|
|
|
%exclude /usr/share/vswitch/scripts/*.pyc
|
|
|
|
%exclude /usr/share/vswitch/scripts/*.pyo
|