reviewed OBS-URL: https://build.opensuse.org/request/show/57888 OBS-URL: https://build.opensuse.org/package/show/network/openvswitch?expand=0&rev=2
187 lines
6.1 KiB
Diff
187 lines
6.1 KiB
Diff
openvswitch init script modifications for kvm and lxc hosts
|
|
|
|
From: Patrick Mullaney <pm.mullaney@gmail.com>
|
|
|
|
Signed-off-by: Patrick Mullaney <pm.mullaney@gmail.com>
|
|
---
|
|
|
|
xenserver/automake.mk | 1
|
|
xenserver/etc_init.d_openvswitch | 79 +++++++++++++++++++++-----
|
|
xenserver/etc_init.d_openvswitch-xapi-update | 9 +++
|
|
xenserver/etc_sysconfig_openvswitch | 11 ++++
|
|
4 files changed, 86 insertions(+), 14 deletions(-)
|
|
create mode 100644 xenserver/etc_sysconfig_openvswitch
|
|
|
|
|
|
diff --git a/xenserver/automake.mk b/xenserver/automake.mk
|
|
index fc23a76..a6c7989 100644
|
|
--- a/xenserver/automake.mk
|
|
+++ b/xenserver/automake.mk
|
|
@@ -27,4 +27,5 @@ EXTRA_DIST += \
|
|
xenserver/usr_share_openvswitch_scripts_ovs-external-ids \
|
|
xenserver/usr_share_openvswitch_scripts_refresh-xs-network-uuids \
|
|
xenserver/usr_share_openvswitch_scripts_sysconfig.template \
|
|
+ xenserver/etc_sysconfig_openvswitch \
|
|
xenserver/uuid.py
|
|
diff --git a/xenserver/etc_init.d_openvswitch b/xenserver/etc_init.d_openvswitch
|
|
index 5f18196..79de6f0 100755
|
|
--- a/xenserver/etc_init.d_openvswitch
|
|
+++ b/xenserver/etc_init.d_openvswitch
|
|
@@ -18,13 +18,46 @@
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
+### BEGIN INIT INFO
|
|
+# Provides: vswitch
|
|
+# Required-Start: $local_fs
|
|
+# Required-Stop: $local_fs
|
|
+# Default-Start: 2 3 5
|
|
+# Default-Stop:
|
|
+# Short-Description: vswitch
|
|
+# Description: virtual switch
|
|
+### END INIT INFO
|
|
+
|
|
+#. /etc/init.d/functions
|
|
+# source function library
|
|
+if [ -f /etc/init.d/functions ]; then
|
|
+ . /etc/init.d/functions
|
|
+elif [ -f /etc/rc.d/init.d/functions ]; then
|
|
+ . /etc/rc.d/init.d/functions
|
|
+elif [ -f /lib/lsb/init-functions ]; then
|
|
+ . /lib/lsb/init-functions
|
|
+else
|
|
+ exit 0
|
|
+fi
|
|
|
|
-. /etc/init.d/functions
|
|
+# Ugh, SUSE doesn't implement action
|
|
+action() {
|
|
+ STRING=$1
|
|
+ shift
|
|
+ "$@"
|
|
+ rc=$?
|
|
+ if [ $rc -eq 0 ] ; then
|
|
+ log_success_msg $"$STRING "
|
|
+ else
|
|
+ log_failure_msg $"$STRING "
|
|
+ fi
|
|
+ return $rc
|
|
+}
|
|
|
|
-. /etc/xensource-inventory
|
|
test -e /etc/sysconfig/openvswitch && . /etc/sysconfig/openvswitch
|
|
|
|
-NETWORK_MODE=$(cat /etc/xensource/network.conf)
|
|
+test -e /etc/xensource-inventory && . /etc/xensource-inventory
|
|
+
|
|
case $NETWORK_MODE in
|
|
vswitch|openvswitch)
|
|
;;
|
|
@@ -38,14 +71,19 @@ case $NETWORK_MODE in
|
|
esac
|
|
|
|
# General config variables in /etc/sysconfig/openvswitch
|
|
-if test "$PRODUCT_VERSION" = "5.5.0"; then
|
|
- # XenServer 5.5.0 needs ovs-brcompatd and /proc/net simulation.
|
|
+if [ -f /etc/xensource-inventory ]; then
|
|
+ if test "$PRODUCT_VERSION" = "5.5.0"; then
|
|
+ # XenServer 5.5.0 needs ovs-brcompatd and /proc/net simulation.
|
|
+ : ${ENABLE_BRCOMPAT:=y}
|
|
+ : ${ENABLE_FAKE_PROC_NET:=y}
|
|
+ else
|
|
+ # Later versions don't need them.
|
|
+ : ${ENABLE_BRCOMPAT:=n}
|
|
+ : ${ENABLE_FAKE_PROC_NET:=n}
|
|
+ fi
|
|
+else
|
|
: ${ENABLE_BRCOMPAT:=y}
|
|
: ${ENABLE_FAKE_PROC_NET:=y}
|
|
-else
|
|
- # Later versions don't need them.
|
|
- : ${ENABLE_BRCOMPAT:=n}
|
|
- : ${ENABLE_FAKE_PROC_NET:=n}
|
|
fi
|
|
: ${ENABLE_MONITOR:=y}
|
|
: ${FORCE_COREFILES:=y}
|
|
@@ -297,6 +335,7 @@ EOF
|
|
}
|
|
|
|
function set_system_ids {
|
|
+
|
|
if [ -f /etc/xensource-inventory ]; then
|
|
action "Configuring Open vSwitch system IDs" true
|
|
$vsctl --no-wait --timeout=5 set Open_vSwitch . \
|
|
@@ -305,7 +344,17 @@ function set_system_ids {
|
|
external-ids:system-id="$INSTALLATION_UUID" \
|
|
external-ids:xs-system-uuid="$INSTALLATION_UUID"
|
|
else
|
|
- action "Configuring Open vSwitch system IDs" false
|
|
+
|
|
+ if [ -f /etc/openvswitch/install_uuid.conf ]; then
|
|
+ . /etc/openvswitch/install_uuid.conf
|
|
+ else
|
|
+ INSTALLATION_UUID=`uuidgen`
|
|
+ echo "INSTALLATION_UUID=$INSTALLATION_UUID" > /etc/openvswitch/install_uuid.conf
|
|
+ fi
|
|
+ $vsctl --no-wait --timeout=5 set Open_vSwitch . \
|
|
+ external-ids:system-id="$INSTALLATION_UUID" \
|
|
+ external-ids:xs-system-uuid="$INSTALLATION_UUID"
|
|
+ action "Configuring Open vSwitch system IDs" true
|
|
fi
|
|
}
|
|
|
|
@@ -350,10 +399,12 @@ function start {
|
|
start_brcompatd
|
|
fi
|
|
|
|
- # Start daemon to monitor external ids
|
|
- PYTHONPATH=/usr/share/openvswitch/python \
|
|
- /usr/share/openvswitch/scripts/ovs-external-ids \
|
|
- --pidfile --detach $monitor_opt "$VSWITCHD_OVSDB_SERVER"
|
|
+ if [ -f /etc/xensource-inventory ]; then
|
|
+ # Start daemon to monitor external ids
|
|
+ PYTHONPATH=/usr/share/openvswitch/python \
|
|
+ /usr/share/openvswitch/scripts/ovs-external-ids \
|
|
+ --pidfile --detach $monitor_opt "$VSWITCHD_OVSDB_SERVER"
|
|
+ fi
|
|
|
|
touch /var/lock/subsys/openvswitch
|
|
}
|
|
diff --git a/xenserver/etc_init.d_openvswitch-xapi-update b/xenserver/etc_init.d_openvswitch-xapi-update
|
|
index bc62ba2..e2e8e98 100755
|
|
--- a/xenserver/etc_init.d_openvswitch-xapi-update
|
|
+++ b/xenserver/etc_init.d_openvswitch-xapi-update
|
|
@@ -18,6 +18,15 @@
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
+### BEGIN INIT INFO
|
|
+# Provides: openvswitch-api-update
|
|
+# Required-Start: $network $remote_fs
|
|
+# Required-Stop: $network
|
|
+# Default-Start: 3 5
|
|
+# Default-Stop:
|
|
+# Short-Description: openvswitch-api-update
|
|
+# Description: virtual switch-api-update
|
|
+### END INIT INFO
|
|
|
|
. /etc/init.d/functions
|
|
|
|
diff --git a/xenserver/etc_sysconfig_openvswitch b/xenserver/etc_sysconfig_openvswitch
|
|
new file mode 100644
|
|
index 0000000..16f915f
|
|
--- /dev/null
|
|
+++ b/xenserver/etc_sysconfig_openvswitch
|
|
@@ -0,0 +1,11 @@
|
|
+### Configuration options for openvswitch
|
|
+
|
|
+# Copyright (C) 2009, 2010 Nicira Networks, Inc.
|
|
+#
|
|
+# 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.
|
|
+
|
|
+NETWORK_MODE=openvswitch
|
|
+
|