From f2a0828c11df7b95c3c4097148bbe18139a0a190 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 17 Sep 2009 12:54:03 +0200
Subject: [PATCH] =?UTF-8?q?Unify=20the=20=E2=80=9C--non-live=E2=80=9D=20op?=
 =?UTF-8?q?tion?=
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           | 7 +++++++
 scripts/gnt-instance | 8 +-------
 scripts/gnt-node     | 9 +--------
 3 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/lib/cli.py b/lib/cli.py
index 28c486f26..9062c2ec8 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -64,6 +64,7 @@ __all__ = [
   "NOHDR_OPT",
   "NOIPCHECK_OPT",
   "NONICS_OPT",
+  "NONLIVE_OPT",
   "NWSYNC_OPT",
   "OS_OPT",
   "OS_SIZE_OPT",
@@ -567,6 +568,12 @@ IGNORE_CONSIST_OPT = cli_option("--ignore-consistency",
                                 help="Ignore the consistency of the disks on"
                                 " the secondary")
 
+NONLIVE_OPT = cli_option("--non-live", dest="live",
+                         default=True, action="store_false",
+                         help="Do a non-live migration (this usually means"
+                         " freeze the instance, save the state, transfer and"
+                         " only then resume running on the secondary node)")
+
 
 def _ParseArgs(argv, commands, aliases):
   """Parser for the command line arguments.
diff --git a/scripts/gnt-instance b/scripts/gnt-instance
index 7a293da80..84a17e436 100755
--- a/scripts/gnt-instance
+++ b/scripts/gnt-instance
@@ -1407,13 +1407,7 @@ commands = {
                "Stops the instance and starts it on the backup node, using"
                " the remote mirror (only for instances of type drbd)"),
   'migrate': (MigrateInstance, ARGS_ONE_INSTANCE,
-               [DEBUG_OPT, FORCE_OPT,
-                cli_option("--non-live", dest="live",
-                           default=True, action="store_false",
-                           help="Do a non-live migration (this usually means"
-                           " freeze the instance, save the state,"
-                           " transfer and only then resume running on the"
-                           " secondary node)"),
+               [DEBUG_OPT, FORCE_OPT, NONLIVE_OPT,
                 cli_option("--cleanup", dest="cleanup",
                            default=False, action="store_true",
                            help="Instead of performing the migration, try to"
diff --git a/scripts/gnt-node b/scripts/gnt-node
index 15dd03a19..baf46f108 100755
--- a/scripts/gnt-node
+++ b/scripts/gnt-node
@@ -652,14 +652,7 @@ commands = {
                "Stops the primary instances on a node and start them on their"
                " secondary node (only for instances with drbd disk template)"),
   'migrate': (MigrateNode, ARGS_ONE_NODE,
-               [DEBUG_OPT, FORCE_OPT,
-                cli_option("--non-live", dest="live",
-                           default=True, action="store_false",
-                           help="Do a non-live migration (this usually means"
-                           " freeze the instance, save the state,"
-                           " transfer and only then resume running on the"
-                           " secondary node)"),
-                ],
+               [DEBUG_OPT, FORCE_OPT, NONLIVE_OPT],
                "[-f] <node>",
                "Migrate all the primary instance on a node away from it"
                " (only for instances of type drbd)"),
-- 
GitLab