Don't check for master netdev when using OVS
authorSebastian Gebhard <sege@fs.ei.tum.de>
Mon, 14 Oct 2013 13:50:42 +0000 (13:50 +0000)
committerKlaus Aehlig <aehlig@google.com>
Wed, 30 Oct 2013 09:35:10 +0000 (10:35 +0100)
This patch disables checking if the given master_netdev exists during cluster
init.
When OVS is used, the needed Open vSwitch will be created later on (with
OpClusterPostInit) and is thus not available at this point of time.

Signed-off-by: Sebastian Gebhard <sege@fs.ei.tum.de>
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

lib/bootstrap.py

index cb2f0f4..eacd8f2 100644 (file)
@@ -614,11 +614,14 @@ def InitCluster(cluster_name, mac_prefix, # pylint: disable=R0913, R0914
     raise errors.OpPrereqError("Invalid mac prefix given '%s'" % mac_prefix,
                                errors.ECODE_INVAL)
 
-  result = utils.RunCmd(["ip", "link", "show", "dev", master_netdev])
-  if result.failed:
-    raise errors.OpPrereqError("Invalid master netdev given (%s): '%s'" %
-                               (master_netdev,
-                                result.output.strip()), errors.ECODE_INVAL)
+  if not nicparams.get('mode', None) == "openvswitch":
+    # Do not do this check if mode=openvswitch, since the openvswitch is not
+    # created yet
+    result = utils.RunCmd(["ip", "link", "show", "dev", master_netdev])
+    if result.failed:
+      raise errors.OpPrereqError("Invalid master netdev given (%s): '%s'" %
+                                 (master_netdev,
+                                  result.output.strip()), errors.ECODE_INVAL)
 
   dirs = [(pathutils.RUN_DIR, constants.RUN_DIRS_MODE)]
   utils.EnsureDirs(dirs)