vswitchd: Enable in-band control to managers.
[openvswitch] / xenserver / etc_init.d_openvswitch
index 0101562ff1c622d0f82c6bc65f90f9dde5c7305a..926ce5236204349fd2e7596f22723fb3973e5497 100755 (executable)
 
 . /etc/init.d/functions
 
+. /etc/xensource-inventory
 test -e /etc/sysconfig/openvswitch && . /etc/sysconfig/openvswitch
 
 # General config variables in /etc/sysconfig/openvswitch
-: ${ENABLE_BRCOMPAT:=y}
-: ${ENABLE_FAKE_PROC_NET:=y}
+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
 : ${ENABLE_MONITOR:=y}
 : ${FORCE_COREFILES:=y}
 
@@ -115,11 +123,11 @@ function insert_modules_if_required {
         action "Inserting llc module" modprobe llc
         action "Inserting openvswitch module" modprobe openvswitch_mod
     fi
-    if [ -n "$BRCOMPATD_PIDFILE" ] && ! lsmod | grep -q "brcompat_mod"; then
+    if [ "$ENABLE_BRCOMPAT" = "y" ] && [ -n "$BRCOMPATD_PIDFILE" ] && ! lsmod | grep -q "brcompat_mod"; then
         action "Inserting brcompat module" modprobe brcompat_mod
     fi
-    if [ -f "/lib/modules/`uname -r`/kernel/net/openvswitch/ip_gre_mod.ko" ] && ! lsmod | grep -q "ip_gre_mod"; then
-        action "Inserting ip_gre module" modprobe ip_gre_mod
+    if [ -f "/lib/modules/`uname -r`/kernel/extra/openvswitch/veth_mod.ko" ] && ! lsmod | grep -q "veth_mod"; then
+        action "Inserting veth module" modprobe veth_mod
     fi
 }
 
@@ -130,9 +138,6 @@ function remove_modules {
     if lsmod | grep -q "openvswitch_mod"; then
         action "Removing openvswitch module" rmmod openvswitch_mod.ko
     fi
-    if lsmod | grep -q "ip_gre_mod"; then
-        action "Removing ip_gre module" rmmod ip_gre_mod.ko
-    fi
 }
 
 function start_ovsdb_server {
@@ -338,10 +343,9 @@ EOF
 }
 
 function set_system_uuid {
-    system_uuid=$(. /etc/xensource-inventory && echo $INSTALLATION_UUID)
-    if test -n "$system_uuid"; then
+    if test -n "$INSTALLATION_UUID"; then
         action "Configuring Open vSwitch system UUID" true
-        $vsctl --no-wait set Open_vSwitch . external-ids:system-uuid="$system_uuid"
+        $vsctl --no-wait set Open_vSwitch . external-ids:system-uuid="$INSTALLATION_UUID"
     else
         action "Configuring Open vSwitch system UUID" false
     fi
@@ -423,11 +427,10 @@ case "$1" in
         strace -p $(cat "$BRCOMPATD_PIDFILE") "$@"
         ;;
     status)
-        status -p "$OVSDB_SERVER_PIDFILE" ovsdb-server
-        status -p "$VSWITCHD_PIDFILE" ovs-vswitchd
-        if [ "$ENABLE_BRCOMPAT" = "y" ] ; then
-            status -p ovs-brcompatd.pid ovs-brcompatd
-        fi
+        status -p "$OVSDB_SERVER_PIDFILE" ovsdb-server &&
+        status -p "$VSWITCHD_PIDFILE" ovs-vswitchd &&
+        (test "$ENABLE_BRCOMPAT" != "y" || 
+            status -p "$BRCOMPATD_PIDFILE" ovs-brcompatd)
         ;;
     version)
         /usr/sbin/ovsdb-server -V