From e3646f22cfc3b5cb66b8bd14719b2f9830885ad3 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 17 Sep 2009 14:37:06 +0200
Subject: [PATCH] =?UTF-8?q?Move=20the=20=E2=80=9C--mac-prefix=E2=80=9D=20o?=
 =?UTF-8?q?ption=20to=20cli.py?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The default has also been changed to None as this will be useful once
cluster modify will be able to change this setting too.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/cli.py          | 7 +++++++
 scripts/gnt-cluster | 9 ++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib/cli.py b/lib/cli.py
index 3c735432d..233376060 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -69,6 +69,7 @@ __all__ = [
   "IGNORE_FAILURES_OPT",
   "IGNORE_SIZE_OPT",
   "FORCE_OPT",
+  "MAC_PREFIX_OPT",
   "MC_OPT",
   "NET_OPT",
   "NEW_SECONDARY_OPT",
@@ -752,6 +753,12 @@ NOVOTING_OPT = cli_option("--no-voting", dest="no_voting",
                           help="Skip node agreement check (dangerous)",
                           action="store_true", default=False)
 
+MAC_PREFIX_OPT = cli_option("-m", "--mac-prefix", dest="mac_prefix",
+                            help="Specify the mac prefix for the instance IP"
+                            " addresses, in the format XX:XX:XX",
+                            metavar="PREFIX",
+                            default=None)
+
 
 def _ParseArgs(argv, commands, aliases):
   """Parser for the command line arguments.
diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster
index e931032b7..bf4420243 100755
--- a/scripts/gnt-cluster
+++ b/scripts/gnt-cluster
@@ -84,6 +84,9 @@ def InitCluster(opts, args):
   if opts.candidate_pool_size is None:
     opts.candidate_pool_size = constants.MASTER_POOL_SIZE_DEFAULT
 
+  if opts.mac_prefix is None:
+    opts.mac_prefix = constants.DEFAULT_MAC_PREFIX
+
   bootstrap.InitCluster(cluster_name=args[0],
                         secondary_ip=opts.secondary_ip,
                         vg_name=vg_name,
@@ -595,11 +598,7 @@ commands = {
   'init': (InitCluster, [ArgHost(min=1, max=1)],
            [DEBUG_OPT,
             SECONDARY_IP_OPT,
-            cli_option("-m", "--mac-prefix", dest="mac_prefix",
-                       help="Specify the mac prefix for the instance IP"
-                       " addresses, in the format XX:XX:XX",
-                       metavar="PREFIX",
-                       default=constants.DEFAULT_MAC_PREFIX,),
+            MAC_PREFIX_OPT,
             VG_NAME_OPT,
             cli_option("--master-netdev", dest="master_netdev",
                        help="Specify the node interface (cluster-wide)"
-- 
GitLab