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 <s...@fs.ei.tum.de>
---
 lib/client/gnt_cluster.py | 9 ++++++++-
 lib/constants.py          | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py
index ba0d594..6e3f885 100644
--- a/lib/client/gnt_cluster.py
+++ b/lib/client/gnt_cluster.py
@@ -121,7 +121,14 @@ 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
+      opts.nicparams[constants.NIC_LINK] = constants.DEFAULT_OVS
 
   hvlist = opts.enabled_hypervisors
   if hvlist is None:
diff --git a/lib/constants.py b/lib/constants.py
index 98f0618..bf7c457 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -719,6 +719,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