---
lib/cli.py | 8 +++++++-
scripts/gnt-instance | 12 ++----------
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/lib/cli.py b/lib/cli.py
index dd8f375..ac72c34 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -48,8 +48,9 @@ __all__ = [
"CONFIRM_OPT",
"DEBUG_OPT",
"DEBUG_SIMERR_OPT",
- "DISK_TEMPLATE_OPT",
+ "DISKIDX_OPT",
"DISK_OPT",
+ "DISK_TEMPLATE_OPT",
"FIELDS_OPT",
"FILESTORE_DIR_OPT",
"FILESTORE_DRIVER_OPT",
@@ -548,6 +549,11 @@ NET_OPT = cli_option("--net",
DISK_OPT = cli_option("--disk", help="Disk parameters", default=[],
dest="disks", action="append", type="identkeyval")
+DISKIDX_OPT = cli_option("--disks", dest="disks", default=None,
+ help="Comma-separated list of disks"
+ " indices to act on (e.g. 0,2) (optional,"
+ " defaults to all disks)")
+
def _ParseArgs(argv, commands, aliases):
"""Parser for the command line arguments.
diff --git a/scripts/gnt-instance b/scripts/gnt-instance
index cd1e651..b825dda 100755
--- a/scripts/gnt-instance
+++ b/scripts/gnt-instance
@@ -1512,10 +1512,7 @@ commands = {
default=False, action="store_true",
help=("Automatically replace faulty disks"
" (only for the drbd template)")),
- cli_option("--disks", dest="disks", default=None,
- help="Comma-separated list of disks"
- " indices to replace (e.g. 0,2) (optional,"
- " defaults to all disks)"),
+ DISKIDX_OPT,
IALLOCATOR_OPT,
SUBMIT_OPT,
],
@@ -1570,12 +1567,7 @@ commands = {
"<instance>",
"Deactivate an instance's disks"),
'recreate-disks': (RecreateDisks, ARGS_ONE_INSTANCE,
- [DEBUG_OPT, SUBMIT_OPT,
- cli_option("--disks", dest="disks", default=None,
- help="Comma-separated list of disks"
- " indices to replace (e.g. 0,2) (optional,"
- " defaults to all disks)"),
- ],
+ [DEBUG_OPT, SUBMIT_OPT, DISKIDX_OPT],
"<instance>",
"Recreate an instance's disks"),
'grow-disk': (GrowDisk,
--
1.6.3.3