Catalli's threaded switch
[sliver-openvswitch.git] / xenserver / etc_init.d_openvswitch
index c52864e..0508445 100755 (executable)
@@ -290,12 +290,16 @@ EOF
     esac
 }
 
-function set_system_uuid {
-    if test -n "$INSTALLATION_UUID"; then
-        action "Configuring Open vSwitch system UUID" true
-        $vsctl --no-wait set Open_vSwitch . external-ids:system-uuid="$INSTALLATION_UUID"
+function set_system_ids {
+    if [ -f /etc/xensource-inventory ]; then
+        action "Configuring Open vSwitch system IDs" true
+        $vsctl --no-wait set Open_vSwitch . \
+            external-ids:system-type="$PRODUCT_BRAND" \
+            external-ids:system-version="$PRODUCT_VERSION-$BUILD_NUMBER" \
+            external-ids:system-id="$INSTALLATION_UUID" \
+            external-ids:xs-system-uuid="$INSTALLATION_UUID"
     else
-        action "Configuring Open vSwitch system UUID" false
+        action "Configuring Open vSwitch system IDs" false
     fi
 }
 
@@ -333,12 +337,18 @@ function start {
         done
     fi
 
-    set_system_uuid
+    set_system_ids
 
     start_vswitchd
     if [ "${ENABLE_BRCOMPAT}" = "y" ] ; then
         start_brcompatd
     fi
+
+    # Start daemon to monitor external ids
+    PYTHONPATH=/usr/share/openvswitch/python \
+               /usr/share/openvswitch/scripts/monitor-external-ids \
+               --pidfile --detach "$VSWITCHD_OVSDB_SERVER"
+
     touch /var/lock/subsys/openvswitch
 }
 
@@ -346,6 +356,9 @@ function stop {
     stop_daemon BRCOMPATD "$brcompatd"
     stop_daemon VSWITCHD "$vswitchd"
     stop_daemon OVSDB_SERVER "$ovsdb_server"
+    if [ -e /var/run/openvswitch/monitor-external-ids.pid ]; then
+        kill `cat /var/run/openvswitch/monitor-external-ids.pid`
+    fi
     rm -f /var/lock/subsys/openvswitch
 }