From baef337d80a07d7eaa2352b8db283cde0ed2ec4e Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 17 Sep 2009 13:28:16 +0200
Subject: [PATCH] =?UTF-8?q?Move=20the=20=E2=80=9C--cleanup=E2=80=9D=20opti?=
 =?UTF-8?q?on=20to=20cli.py?=
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           | 10 ++++++++++
 scripts/gnt-instance | 11 +----------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/lib/cli.py b/lib/cli.py
index 776c42a44..ce3ef3e63 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -45,6 +45,7 @@ from optparse import (OptionParser, TitledHelpFormatter,
 __all__ = [
   # Command line options
   "BACKEND_OPT",
+  "CLEANUP_OPT",
   "CONFIRM_OPT",
   "DEBUG_OPT",
   "DEBUG_SIMERR_OPT",
@@ -602,6 +603,15 @@ SHOWCMD_OPT = cli_option("--show-cmd", dest="show_command",
                          action="store_true", default=False,
                          help="Show command instead of executing it")
 
+CLEANUP_OPT = cli_option("--cleanup", dest="cleanup",
+                         default=False, action="store_true",
+                         help="Instead of performing the migration, try to"
+                         " recover from a failed cleanup. This is safe"
+                         " to run even if the instance is healthy, but it"
+                         " will create extra replication traffic and "
+                         " disrupt briefly the replication (like during the"
+                         " migration")
+
 
 def _ParseArgs(argv, commands, aliases):
   """Parser for the command line arguments.
diff --git a/scripts/gnt-instance b/scripts/gnt-instance
index 3c1a8a0ae..e67504e95 100755
--- a/scripts/gnt-instance
+++ b/scripts/gnt-instance
@@ -1394,16 +1394,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, NONLIVE_OPT,
-                cli_option("--cleanup", dest="cleanup",
-                           default=False, action="store_true",
-                           help="Instead of performing the migration, try to"
-                           " recover from a failed cleanup. This is safe"
-                           " to run even if the instance is healthy, but it"
-                           " will create extra replication traffic and "
-                           " disrupt briefly the replication (like during the"
-                           " migration"),
-                ],
+               [DEBUG_OPT, FORCE_OPT, NONLIVE_OPT, CLEANUP_OPT],
                "[-f] <instance>",
                "Migrate instance to its secondary node"
                " (only for instances of type drbd)"),
-- 
GitLab