Unify the “--no-wait-for-sync” option
authorIustin Pop <iustin@google.com>
Thu, 17 Sep 2009 08:57:03 +0000 (10:57 +0200)
committerIustin Pop <iustin@google.com>
Fri, 18 Sep 2009 10:53:40 +0000 (12:53 +0200)
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

lib/cli.py
scripts/gnt-backup
scripts/gnt-instance

index 26a4b4d..bbe5158 100644 (file)
@@ -50,6 +50,7 @@ __all__ = [
   "FIELDS_OPT",
   "FORCE_OPT",
   "NOHDR_OPT",
+  "NWSYNC_OPT",
   "SEP_OPT",
   "SUBMIT_OPT",
   "SYNC_OPT",
@@ -470,6 +471,10 @@ DEBUG_SIMERR_OPT = cli_option("--debug-simulate-errors", default=False,
                               help="Debugging option that makes the operation"
                               " treat most runtime checks as failed")
 
+NWSYNC_OPT = cli_option("--no-wait-for-sync", dest="wait_for_sync",
+                        default=True, action="store_false",
+                        help="Don't wait for sync (DANGEROUS!)")
+
 
 def _ParseArgs(argv, commands, aliases):
   """Parser for the command line arguments.
index 12a667d..a45256f 100755 (executable)
@@ -236,8 +236,7 @@ import_opts = [
              type="identkeyval"),
   cli_option("--no-nics", default=False, action="store_true",
              help="Do not create any network cards for the instance"),
-  cli_option("--no-wait-for-sync", dest="wait_for_sync", default=True,
-             action="store_false", help="Don't wait for sync (DANGEROUS!)"),
+  NWSYNC_OPT,
   cli_option("--src-node", dest="src_node", help="Source node",
              metavar="<node>",
              completion_suggest=OPT_COMPL_ONE_NODE),
index 4980614..256b39a 100755 (executable)
@@ -1393,8 +1393,7 @@ add_opts = [
              type="identkeyval"),
   cli_option("--no-nics", default=False, action="store_true",
              help="Do not create any network cards for the instance"),
-  cli_option("--no-wait-for-sync", dest="wait_for_sync", default=True,
-             action="store_false", help="Don't wait for sync (DANGEROUS!)"),
+  NWSYNC_OPT,
   cli_option("--no-start", dest="start", default=True,
              action="store_false", help="Don't start the instance after"
              " creation"),
@@ -1642,12 +1641,7 @@ commands = {
   'grow-disk': (GrowDisk,
                 [ArgInstance(min=1, max=1), ArgUnknown(min=1, max=1),
                  ArgUnknown(min=1, max=1)],
-                [DEBUG_OPT, SUBMIT_OPT,
-                 cli_option("--no-wait-for-sync",
-                            dest="wait_for_sync", default=True,
-                            action="store_false",
-                            help="Don't wait for sync (DANGEROUS!)"),
-                 ],
+                [DEBUG_OPT, SUBMIT_OPT, NWSYNC_OPT],
                 "<instance> <disk> <size>", "Grow an instance's disk"),
   'list-tags': (ListTags, ARGS_ONE_INSTANCE, [DEBUG_OPT],
                 "<instance_name>", "List the tags of the given instance"),