[ovs-dev] [PATCH] xenserver: Make Open vSwitch disable itself in "bridge" mode.

Ben Pfaff blp at nicira.com
Tue May 4 17:21:00 UTC 2010


When /etc/xensource/network.conf contains the word "bridge", the system
is supposed to use the Linux bridge, not Open vSwitch.  This commit makes
OVS honor this setting, which until now it has mainly ignored.

Reported-by: Reid Price <reid at nicira.com>
---
 xenserver/etc_init.d_openvswitch |    6 ++++++
 xenserver/usr_sbin_brctl         |   11 ++++++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/xenserver/etc_init.d_openvswitch b/xenserver/etc_init.d_openvswitch
index 2ce9e77..a15ab2b 100755
--- a/xenserver/etc_init.d_openvswitch
+++ b/xenserver/etc_init.d_openvswitch
@@ -24,6 +24,12 @@
 . /etc/xensource-inventory
 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
+
 # General config variables in /etc/sysconfig/openvswitch
 if test "$PRODUCT_VERSION" = "5.5.0"; then
     # XenServer 5.5.0 needs ovs-brcompatd and /proc/net simulation.
diff --git a/xenserver/usr_sbin_brctl b/xenserver/usr_sbin_brctl
index 2035a4f..7fecc56 100755
--- a/xenserver/usr_sbin_brctl
+++ b/xenserver/usr_sbin_brctl
@@ -1,6 +1,6 @@
 #! /usr/bin/python
 #
-# Copyright (c) 2009 Nicira Networks.
+# Copyright (c) 2009, 2010 Nicira Networks.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -99,6 +99,15 @@ def cmd_show():
             print "\t\t\t\t\t\t\t%s" % port
 
 def main():
+    # Check the network configuration mode.
+    try:
+        network_mode = read_first_line_of_file('/etc/xensource/network.conf')
+        if network_mode == 'bridge':
+            delegate()
+    except:
+        # File probably doesn't exist
+        pass
+
     # Parse the command line.
     try:
         options, args = getopt.gnu_getopt(sys.argv[1:],
-- 
1.6.6.1





More information about the dev mailing list