From 0f87c43e513bf8bdc9f26ba04031bcae6ef40a00 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 17 Sep 2009 11:04:00 +0200
Subject: [PATCH] =?UTF-8?q?Unify=20the=20=E2=80=9C--file-driver=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: Guido Trotter <ultrotter@google.com>
---
 lib/cli.py           | 6 ++++++
 scripts/gnt-backup   | 4 +---
 scripts/gnt-instance | 4 +---
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/cli.py b/lib/cli.py
index 0ff5b435e..949903f18 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -50,6 +50,7 @@ __all__ = [
   "DISK_TEMPLATE_OPT",
   "FIELDS_OPT",
   "FILESTORE_DIR_OPT",
+  "FILESTORE_DRIVER_OPT",
   "FORCE_OPT",
   "NOHDR_OPT",
   "NONICS_OPT",
@@ -493,6 +494,11 @@ FILESTORE_DIR_OPT = cli_option("--file-storage-dir", dest="file_storage_dir",
                                " file storage dir to store file-based disks",
                                default=None, metavar="<DIR>")
 
+FILESTORE_DRIVER_OPT = cli_option("--file-driver", dest="file_driver",
+                                  help="Driver to use for image files",
+                                  default="loop", metavar="<DRIVER>",
+                                  choices=list(constants.FILE_DRIVER))
+
 
 def _ParseArgs(argv, commands, aliases):
   """Parser for the command line arguments.
diff --git a/scripts/gnt-backup b/scripts/gnt-backup
index 2f030e5e8..d1591329b 100755
--- a/scripts/gnt-backup
+++ b/scripts/gnt-backup
@@ -246,9 +246,7 @@ import_opts = [
              " <NAME> iallocator plugin", default=None, type="string",
              completion_suggest=OPT_COMPL_ONE_IALLOCATOR),
   FILESTORE_DIR_OPT,
-  cli_option("--file-driver", dest="file_driver", help="Driver to use"
-             " for image files", default="loop", metavar="<DRIVER>",
-             choices=list(constants.FILE_DRIVER)),
+  FILESTORE_DRIVER_OPT,
   cli_option("-H", "--hypervisor", dest="hypervisor",
              help="Hypervisor and hypervisor options, in the format"
              " hypervisor:option=value,option=value,...", default=None,
diff --git a/scripts/gnt-instance b/scripts/gnt-instance
index 2598a7aa0..321bf207e 100755
--- a/scripts/gnt-instance
+++ b/scripts/gnt-instance
@@ -1397,9 +1397,7 @@ add_opts = [
              action="store_false", help="Don't check that the instance's IP"
              " is alive (only valid with --no-start)"),
   FILESTORE_DIR_OPT,
-  cli_option("--file-driver", dest="file_driver", help="Driver to use"
-             " for image files", default="loop", metavar="<DRIVER>",
-             choices=list(constants.FILE_DRIVER)),
+  FILESTORE_DRIVER_OPT,
   cli_option("-I", "--iallocator", metavar="<NAME>",
              help="Select nodes for the instance automatically using the"
              " <NAME> iallocator plugin", default=None, type="string",
-- 
GitLab