Commit 087ed2ed authored by Iustin Pop's avatar Iustin Pop
Browse files

Unify the “--backend-parameters” option



This is not straight-forward. First, gnt-cluster had
“--backend-parameters” wheres the rest of the script had just
“--backend”. I settled on the full form, since one can always abbreviate
options, but not vice-versa.

Second, the help in some cases was different, e.g. start instance
had “Temporary backend parameters” and modify had “Change backend
parameters”. I think this kind of distinctions are better served in the
man page. Alternatively, if we could copy options easily, one could
re-instantiate them with a changed help line.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent d3ed23ff
......@@ -44,6 +44,7 @@ from optparse import (OptionParser, TitledHelpFormatter,
__all__ = [
# Command line options
"BACKEND_OPT",
"CONFIRM_OPT",
"DEBUG_OPT",
"DEBUG_SIMERR_OPT",
......@@ -511,6 +512,10 @@ OS_OPT = cli_option("-o", "--os-type", dest="os", help="What OS to run",
metavar="<os>",
completion_suggest=OPT_COMPL_ONE_OS)
BACKEND_OPT = cli_option("-B", "--backend-parameters", dest="beparams",
type="keyval", default={},
help="Backend parameters")
def _ParseArgs(argv, commands, aliases):
"""Parser for the command line arguments.
......
......@@ -215,9 +215,7 @@ import_opts = [
help="Target node and optional secondary node",
metavar="<pnode>[:<snode>]",
completion_suggest=OPT_COMPL_INST_ADD_NODES),
cli_option("-B", "--backend", dest="beparams",
type="keyval", default={},
help="Backend parameters"),
BACKEND_OPT,
DISK_TEMPLATE_OPT,
cli_option("--disk", help="Disk information",
default=[], dest="disks",
......
......@@ -641,9 +641,7 @@ commands = {
default=[],
action="append",
type="identkeyval"),
cli_option("-B", "--backend-parameters", dest="beparams",
type="keyval", default={},
help="Backend parameters"),
BACKEND_OPT,
cli_option("-N", "--nic-parameters", dest="nicparams",
type="keyval", default={},
help="NIC parameters"),
......@@ -743,9 +741,7 @@ commands = {
default=[],
action="append",
type="identkeyval"),
cli_option("-B", "--backend-parameters", dest="beparams",
type="keyval", default={},
help="Backend parameters"),
BACKEND_OPT,
cli_option("-N", "--nic-parameters", dest="nicparams",
type="keyval", default={},
help="NIC parameters"),
......
......@@ -1368,9 +1368,7 @@ add_opts = [
metavar="<pnode>[:<snode>]",
completion_suggest=OPT_COMPL_INST_ADD_NODES),
OS_OPT,
cli_option("-B", "--backend", dest="beparams",
type="keyval", default={},
help="Backend parameters"),
BACKEND_OPT,
DISK_TEMPLATE_OPT,
cli_option("-s", "--os-size", dest="sd_size", help="Disk size for a"
" single-disk configuration, when not using the --disk option,"
......@@ -1545,9 +1543,7 @@ commands = {
cli_option("-H", "--hypervisor", type="keyval",
default={}, dest="hypervisor",
help="Change hypervisor parameters"),
cli_option("-B", "--backend", type="keyval",
default={}, dest="beparams",
help="Change backend parameters"),
BACKEND_OPT,
cli_option("--disk", help="Disk changes",
default=[], dest="disks",
action="append",
......@@ -1573,9 +1569,7 @@ commands = {
cli_option("-H", "--hypervisor", type="keyval",
default={}, dest="hvparams",
help="Temporary hypervisor parameters"),
cli_option("-B", "--backend", type="keyval",
default={}, dest="beparams",
help="Temporary backend parameters"),
BACKEND_OPT,
],
"<instance>", "Starts an instance"),
'reboot': (RebootInstance, [ArgInstance(min=1)],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment