This commit adds functionality to gnt_cluster to set the default
master-netdev for openvswitch, when openvswitch mode is configured,
instead of DEFAULT_BRIDGE.

Signed-off-by: Sebastian Gebhard <[email protected]>
---
 lib/client/gnt_cluster.py | 8 +++++++-
 lib/constants.py          | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py
index bd61469..b90ec68 100644
--- a/lib/client/gnt_cluster.py
+++ b/lib/client/gnt_cluster.py
@@ -121,7 +121,13 @@ def InitCluster(opts, args):
 
   master_netdev = opts.master_netdev
   if master_netdev is None:
-    master_netdev = constants.DEFAULT_BRIDGE
+    if not opts.nicparams[constants.NIC_MODE]:
+      # default case, use bridging
+      master_netdev = constants.DEFAULT_BRIDGE
+    elif opts.nicparams[constants.NIC_MODE] and \
+         opts.nicparams[constants.NIC_MODE] == constants.NIC_MODE_OVS:
+      # default ovs is different from default bridge
+      master_netdev = constants.DEFAULT_OVS
 
   hvlist = opts.enabled_hypervisors
   if hvlist is None:
diff --git a/lib/constants.py b/lib/constants.py
index 9866ed5..18c8781 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -720,6 +720,7 @@ MAX_TAGS_PER_OBJ = 4096
 
 # others
 DEFAULT_BRIDGE = "xen-br0"
+DEFAULT_OVS = "switch1"
 CLASSIC_DRBD_SYNC_SPEED = 60 * 1024  # 60 MiB, expressed in KiB
 IP4_ADDRESS_LOCALHOST = "127.0.0.1"
 IP4_ADDRESS_ANY = "0.0.0.0"
-- 
1.8.1.2

Reply via email to