xenserver: Don't require /etc/xensource/network.conf if not on XenServer.
authorPatrick Mullaney <pm.mullaney@gmail.com>
Wed, 15 Dec 2010 18:39:08 +0000 (10:39 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 7 Jan 2011 18:31:29 +0000 (10:31 -0800)
On XenServer systems, the "network mode" (that is, whether the network
uses OpenvSwitch or the Linux bridge) is stored in
/etc/xensource/network.conf.  On other systems, we can't expect it to be
there.  This changes the init script to tolerate its absence, treating that
as meaning that Open vSwitch should be used (otherwise, why did the admin
install it?).

NETWORK_MODE can always be overridden in /etc/sysconfig/openvswitch anyway.

Signed-off-by: Patrick Mullaney <pm.mullaney@gmail.com>
[changed back to read /etc/xensource/network.conf if present]
Signed-off-by: Ben Pfaff <blp@nicira.com>
xenserver/etc_init.d_openvswitch

index 31aa3fbc1252f21ee506476db8fd1ce1c246551c..b0f8f620d43ad2a560f320d6357d5bce056ab650 100755 (executable)
@@ -57,11 +57,13 @@ else
     }
 fi
 
-. /etc/xensource-inventory
+test -e /etc/xensource-inventory && . /etc/xensource-inventory
 test -e /etc/sysconfig/openvswitch && . /etc/sysconfig/openvswitch
+if test -e /etc/xensource/network.conf; then
+    NETWORK_MODE=$(cat /etc/xensource/network.conf)
+fi
 
-NETWORK_MODE=$(cat /etc/xensource/network.conf)
-case $NETWORK_MODE in
+case ${NETWORK_MODE:=openvswitch} in
     vswitch|openvswitch)
         ;;
     bridge)