From 8d82362966463294aaf0989eddce1f3bc224bc82 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 17 Sep 2009 13:45:21 +0200
Subject: [PATCH] =?UTF-8?q?Unify=20the=20=E2=80=9C--secondary-ip=E2=80=9D?=
 =?UTF-8?q?=20option?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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

diff --git a/lib/cli.py b/lib/cli.py
index eb20e118c..affcd01c4 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -79,6 +79,7 @@ __all__ = [
   "ON_SECONDARY_OPT",
   "OS_OPT",
   "OS_SIZE_OPT",
+  "SECONDARY_IP_OPT",
   "SELECT_OS_OPT",
   "SEP_OPT",
   "SHOWCMD_OPT",
@@ -676,6 +677,10 @@ SRC_NODE_OPT = cli_option("--src-node", dest="src_node", help="Source node",
 SRC_DIR_OPT = cli_option("--src-dir", dest="src_dir", help="Source directory",
                          metavar="<dir>")
 
+SECONDARY_IP_OPT = cli_option("-s", "--secondary-ip", dest="secondary_ip",
+                              help="Specify the secondary ip for the node",
+                              metavar="ADDRESS", default=None)
+
 
 def _ParseArgs(argv, commands, aliases):
   """Parser for the command line arguments.
diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster
index f939e30cd..2ff7a525d 100755
--- a/scripts/gnt-cluster
+++ b/scripts/gnt-cluster
@@ -589,11 +589,7 @@ def WatcherOps(opts, args):
 commands = {
   'init': (InitCluster, [ArgHost(min=1, max=1)],
            [DEBUG_OPT,
-            cli_option("-s", "--secondary-ip", dest="secondary_ip",
-                       help="Specify the secondary ip for this node;"
-                       " if given, the entire cluster must have secondary"
-                       " addresses",
-                       metavar="ADDRESS", default=None),
+            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",
diff --git a/scripts/gnt-node b/scripts/gnt-node
index 75dca8666..4e5e41946 100755
--- a/scripts/gnt-node
+++ b/scripts/gnt-node
@@ -624,9 +624,7 @@ def SetNodeParams(opts, args):
 commands = {
   'add': (AddNode, [ArgHost(min=1, max=1)],
           [DEBUG_OPT,
-           cli_option("-s", "--secondary-ip", dest="secondary_ip",
-                      help="Specify the secondary ip for the node",
-                      metavar="ADDRESS", default=None),
+           SECONDARY_IP_OPT,
            cli_option("--readd", dest="readd",
                       default=False, action="store_true",
                       help="Readd old node after replacing it"),
-- 
GitLab