---
lib/cli.py | 4 ++++
scripts/gnt-backup | 5 +----
scripts/gnt-instance | 17 +++--------------
3 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/lib/cli.py b/lib/cli.py
index 7d69b70..dd8f375 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -49,6 +49,7 @@ __all__ = [
"DEBUG_OPT",
"DEBUG_SIMERR_OPT",
"DISK_TEMPLATE_OPT",
+ "DISK_OPT",
"FIELDS_OPT",
"FILESTORE_DIR_OPT",
"FILESTORE_DRIVER_OPT",
@@ -544,6 +545,9 @@ NET_OPT = cli_option("--net",
help="NIC parameters", default=[],
dest="nics", action="append", type="identkeyval")
+DISK_OPT = cli_option("--disk", help="Disk parameters", default=[],
+ dest="disks", action="append", type="identkeyval")
+
def _ParseArgs(argv, commands, aliases):
"""Parser for the command line arguments.
diff --git a/scripts/gnt-backup b/scripts/gnt-backup
index cdcddac..242de2e 100755
--- a/scripts/gnt-backup
+++ b/scripts/gnt-backup
@@ -217,10 +217,7 @@ import_opts = [
completion_suggest=OPT_COMPL_INST_ADD_NODES),
BACKEND_OPT,
DISK_TEMPLATE_OPT,
- cli_option("--disk", help="Disk information",
- default=[], dest="disks",
- action="append",
- type="identkeyval"),
+ DISK_OPT,
cli_option("-s", "--os-size", dest="sd_size", help="Disk size for a"
" single-disk configuration, when not using the --disk option,"
" in MiB unless a suffix is used",
diff --git a/scripts/gnt-instance b/scripts/gnt-instance
index b042f0f..cd1e651 100755
--- a/scripts/gnt-instance
+++ b/scripts/gnt-instance
@@ -1374,10 +1374,7 @@ add_opts = [
" single-disk configuration, when not using the --disk option,"
" in MiB unless a suffix is used",
default=None, type="unit", metavar="<size>"),
- cli_option("--disk", help="Disk information",
- default=[], dest="disks",
- action="append",
- type="identkeyval"),
+ DISK_OPT,
NET_OPT,
NONICS_OPT,
NWSYNC_OPT,
@@ -1525,16 +1522,8 @@ commands = {
"[-s|-p|-n NODE|-I NAME] <instance>",
"Replaces all disks for the instance"),
'modify': (SetInstanceParams, ARGS_ONE_INSTANCE,
- [DEBUG_OPT, FORCE_OPT,
- HVOPTS_OPT,
- BACKEND_OPT,
- cli_option("--disk", help="Disk changes",
- default=[], dest="disks",
- action="append",
- type="identkeyval"),
- NET_OPT,
- SUBMIT_OPT,
- ],
+ [BACKEND_OPT, DEBUG_OPT, DISK_OPT, FORCE_OPT, HVOPTS_OPT,
+ NET_OPT, SUBMIT_OPT],
"<instance>", "Alters the parameters of an instance"),
'shutdown': (ShutdownInstance, [ArgInstance(min=1)],
[DEBUG_OPT, m_node_opt, m_pri_node_opt, m_sec_node_opt,
--
1.6.3.3