[ovs-dev] [PATCH] xenserver: Don't start OVS if network.conf isn't "openvswitch"

Justin Pettit jpettit at nicira.com
Tue Jun 8 17:38:00 UTC 2010


On Jun 8, 2010, at 9:44 AM, Ben Pfaff wrote:

> On Mon, Jun 07, 2010 at 11:31:53PM -0700, Justin Pettit wrote:
>> The OVS processes would start as long as "/etc/xensource/network.conf"
>> didn't contain "bridge".  The other OVS scripts, however, would complain
>> (and not run) if it wasn't "vswitch" or "openvswitch".  This commit will
>> only start the OVS processes if a value of "vswitch" or "openvswitch" is
>> present, so some consistency is provided.
> 
> Looks good to me.
> 
> The code would be more beautiful written as a "case" statement.


Is the following patch more in line with your sense of aesthetics?

--Justin


-=-=-=-=-=-=-=-=-=-=-=-
The OVS processes would start as long as "/etc/xensource/network.conf"
didn't contain "bridge".  The other OVS scripts, however, would complain
(and not run) if it wasn't "vswitch" or "openvswitch".  This commit will
only start the OVS processes if a value of "vswitch" or "openvswitch" is
present, so some consistency is provided.

(If "/etc/xensource/network.conf" is not "bridge", "vswitch", or
"openvswitch", then XAPI will refuse to run anyway, so not much is going
to happen on the system.)
---
 xenserver/etc_init.d_openvswitch |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/xenserver/etc_init.d_openvswitch b/xenserver/etc_init.d_openvswitch
index ce75480..b7624aa 100755
--- a/xenserver/etc_init.d_openvswitch
+++ b/xenserver/etc_init.d_openvswitch
@@ -25,10 +25,14 @@
 test -e /etc/sysconfig/openvswitch && . /etc/sysconfig/openvswitch

 NETWORK_MODE=$(cat /etc/xensource/network.conf)
-if test "$NETWORK_MODE" = bridge; then
-    echo "Open vSwitch disabled (/etc/xensource/network.conf is 'bridge')" >&2
-    exit 0
-fi
+case "$NETWORK_MODE" in
+    vswitch|openvswitch)
+        ;;
+    *)
+        echo "Open vSwitch disabled (/etc/xensource/network.conf is not 'openvswitch')" >&2
+        exit 0
+        ;;
+esac

 # General config variables in /etc/sysconfig/openvswitch
 if test "$PRODUCT_VERSION" = "5.5.0"; then







More information about the dev mailing list