xenserver: Ditch ovs-xenserverd even on XenServer 5.5.0.
authorBen Pfaff <blp@nicira.com>
Fri, 4 Jun 2010 17:52:43 +0000 (10:52 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 8 Jun 2010 17:31:37 +0000 (10:31 -0700)
Examining the XAPI source code shows that at startup it invokes a script
named /opt/xensource/libexec/xapi-startup-script, if one exists.  Testing
shows that this was also true in XenServer 5.5.0.  No such script is
installed by default.  Searching for "xapi-startup-script" on Google (with
the quotes) has only one hit, which is documentation on XAPI startup.  So
it seems that we're pretty safe in taking advantage of this hook ourselves.

This commit changes the RPM scripts to install refresh-network-uuids as
the XAPI startup hook on XenServer 5.5.0.

CC: Rob Hoes <rob.hoes@citrix.com>
xenserver/openvswitch-xen.spec

index 3418dae..5e7175d 100644 (file)
@@ -115,6 +115,7 @@ if [ ! -f /etc/xensource-inventory ]; then
     printf "XenSource inventory not present in /etc/xensource-inventory"
     exit 1
 fi
+. /etc/xensource-inventory
 
 if [ "$1" = "1" ]; then
     if md5sum -c --status <<EOF
@@ -159,6 +160,21 @@ EOF
     fi
 fi
 
+# On XenServer 5.5.0, we need refresh-network-uuids to run whenever
+# XAPI starts or restarts.  (On XenServer 5.6.0, XAPI calls the
+# "update" method of the vswitch-cfg-update plugin whenever it starts
+# or restarts, so this is no longer necessary.)
+if test "$PRODUCT_VERSION" = "5.5.0"; then
+    RNU=/usr/share/openvswitch/scripts/refresh-network-uuids
+    XSS=/opt/xensource/libexec/xapi-startup-script
+    if test -e $XSS && (test ! -L $XSS || test "`readlink $XSS`" != $RNU); then
+        echo "$XSS is already in use, refusing to overwrite"
+        exit 1
+    fi
+    rm -f $XSS
+    ln -s $RNU $XSS
+fi
+
 if test ! -e /var/xapi/network.dbcache; then
     if test "$1" = 1; then
         printf "Creating xapi database cache...  "
@@ -280,6 +296,11 @@ fi
 
 %postun
 if [ "$1" = "0" ]; then     # $1 = 1 for upgrade
+    . /etc/xensource-inventory
+    if test "$PRODUCT_VERSION" = "5.5.0"; then
+        XSS=/opt/xensource/libexec/xapi-startup-script
+        rm -f $XSS
+    fi
 
     rm -f /usr/lib/xsconsole/plugins-base/XSFeatureVSwitch.pyc \
         /usr/lib/xsconsole/plugins-base/XSFeatureVSwitch.pyo