Commit a52ba89d authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Add more bash completion metadata for options


Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarOlivier Tharan <olive@google.com>
parent 63d44c55
......@@ -238,7 +238,8 @@ import_opts = [
cli_option("--no-wait-for-sync", dest="wait_for_sync", default=True,
action="store_false", help="Don't wait for sync (DANGEROUS!)"),
cli_option("--src-node", dest="src_node", help="Source node",
metavar="<node>"),
metavar="<node>",
completion_suggest=OPT_COMPL_ONE_NODE),
cli_option("--src-dir", dest="src_dir", help="Source directory",
metavar="<dir>"),
cli_option("--no-ip-check", dest="ip_check", default=True,
......@@ -246,7 +247,8 @@ import_opts = [
" is alive"),
cli_option("-I", "--iallocator", metavar="<NAME>",
help="Select nodes for the instance automatically using the"
" <NAME> iallocator plugin", default=None, type="string"),
" <NAME> iallocator plugin", default=None, type="string",
completion_suggest=OPT_COMPL_ONE_IALLOCATOR),
cli_option("--file-storage-dir", dest="file_storage_dir",
help="Relative path under default cluster-wide file storage dir"
" to store file-based disks", default=None,
......@@ -265,13 +267,15 @@ commands = {
[DEBUG_OPT,
cli_option("--node", dest="nodes", default=[], action="append",
help="List only backups stored on this node"
" (can be used multiple times)"),
" (can be used multiple times)",
completion_suggest=OPT_COMPL_ONE_NODE),
],
"", "Lists instance exports available in the ganeti cluster"),
'export': (ExportInstance, ARGS_ONE_INSTANCE,
[DEBUG_OPT, FORCE_OPT,
cli_option("-n", "--node", dest="node", help="Target node",
metavar="<node>"),
metavar="<node>",
completion_suggest=OPT_COMPL_ONE_NODE),
cli_option("","--noshutdown", dest="shutdown",
action="store_false", default=True,
help="Don't shutdown the instance (unsafe)"), ],
......
......@@ -150,7 +150,8 @@ commands = {
" results (out)"),
cli_option("--algorithm", dest="allocator",
default=None,
help="Allocator algorithm name"),
help="Allocator algorithm name",
completion_suggest=OPT_COMPL_ONE_IALLOCATOR),
cli_option("-m", "--mode", default="relocate",
choices=["relocate", "allocate"],
help="Request mode, either allocate or"
......@@ -167,7 +168,8 @@ commands = {
" definition is of form mac/ip/bridge, if"
" missing values are replace by None"),
cli_option("-o", "--os-type", default=None,
help="Select os for the instance"),
help="Select os for the instance",
completion_suggest=OPT_COMPL_ONE_OS),
cli_option("-p", "--vcpus", default=1, type="int",
help="Select number of VCPUs for the instance"),
cli_option("--tags", default=None,
......
......@@ -1332,10 +1332,12 @@ def SetInstanceParams(opts, args):
# options used in more than one cmd
node_opt = cli_option("-n", "--node", dest="node", help="Target node",
metavar="<node>")
metavar="<node>",
completion_suggest=OPT_COMPL_ONE_NODE)
os_opt = cli_option("-o", "--os-type", dest="os", help="What OS to run",
metavar="<os>")
metavar="<os>",
completion_suggest=OPT_COMPL_ONE_OS)
# multi-instance selection options
m_force_multi = cli_option("--force-multiple", dest="force_multi",
......@@ -1409,7 +1411,8 @@ add_opts = [
choices=list(constants.FILE_DRIVER)),
cli_option("-I", "--iallocator", metavar="<NAME>",
help="Select nodes for the instance automatically using the"
" <NAME> iallocator plugin", default=None, type="string"),
" <NAME> iallocator plugin", default=None, type="string",
completion_suggest=OPT_COMPL_ONE_IALLOCATOR),
cli_option("-H", "--hypervisor", dest="hypervisor",
help="Hypervisor and hypervisor options, in the format"
" hypervisor:option=value,option=value,...", default=None,
......@@ -1467,7 +1470,8 @@ commands = {
[DEBUG_OPT, FORCE_OPT, SUBMIT_OPT,
cli_option("-n", "--new-node", dest="target_node",
help="Destinattion node", metavar="NODE",
default=None),
default=None,
completion_suggest=OPT_COMPL_ONE_NODE),
],
"[-f] <instance>",
"Move instance to an arbitrary node"
......@@ -1531,7 +1535,8 @@ commands = {
cli_option("-n", "--new-secondary", dest="new_secondary",
help=("New secondary node (for secondary"
" node change)"), metavar="NODE",
default=None),
default=None,
completion_suggest=OPT_COMPL_ONE_NODE),
cli_option("-p", "--on-primary", dest="on_primary",
default=False, action="store_true",
help=("Replace the disk(s) on the primary"
......@@ -1553,7 +1558,8 @@ commands = {
" automatically using the"
" <NAME> iallocator plugin (enables"
" secondary node replacement)",
default=None, type="string"),
default=None, type="string",
completion_suggest=OPT_COMPL_ONE_IALLOCATOR),
SUBMIT_OPT,
],
"[-s|-p|-n NODE|-I NAME] <instance>",
......@@ -1601,7 +1607,8 @@ commands = {
cli_option("-t", "--type", dest="reboot_type",
help="Type of reboot: soft/hard/full",
default=constants.INSTANCE_REBOOT_HARD,
type="string", metavar="<REBOOT>"),
metavar="<REBOOT>",
choices=list(constants.REBOOT_TYPES)),
cli_option("--ignore-secondaries", dest="ignore_secondaries",
default=False, action="store_true",
help="Ignore errors from secondaries"),
......
......@@ -640,12 +640,14 @@ commands = {
[DEBUG_OPT, FORCE_OPT,
cli_option("-n", "--new-secondary", dest="dst_node",
help="New secondary node", metavar="NODE",
default=None),
default=None,
completion_suggest=OPT_COMPL_ONE_NODE),
cli_option("-I", "--iallocator", metavar="<NAME>",
help="Select new secondary for the instance"
" automatically using the"
" <NAME> iallocator plugin",
default=None, type="string"),
default=None, type="string",
completion_suggest=OPT_COMPL_ONE_IALLOCATOR),
],
"[-f] {-I <iallocator> | -n <dst>} <node>",
"Relocate the secondary instances from a node"
......
......@@ -101,7 +101,8 @@ class SimpleOpener(urllib.FancyURLopener):
OPTIONS = [
cli.cli_option("-o", "--os", dest="os", default=None,
help="OS to use during burnin",
metavar="<OS>"),
metavar="<OS>",
completion_suggest=cli.OPT_COMPL_ONE_OS),
cli.cli_option("--disk-size", dest="disk_size",
help="Disk size (determines disk count)",
default="128m", type="string", metavar="<size,size,...>",
......@@ -165,13 +166,15 @@ OPTIONS = [
help="Disk template (diskless, file, plain or drbd) [drbd]"),
cli.cli_option("-n", "--nodes", dest="nodes", default="",
help=("Comma separated list of nodes to perform"
" the burnin on (defaults to all nodes)")),
" the burnin on (defaults to all nodes)"),
completion_suggest=cli.OPT_COMPL_MANY_NODES),
cli.cli_option("-I", "--iallocator", dest="iallocator",
default=None, type="string",
help=("Perform the allocation using an iallocator"
" instead of fixed node spread (node restrictions no"
" longer apply, therefore -n/--nodes must not be"
" used")),
" used"),
completion_suggest=cli.OPT_COMPL_ONE_IALLOCATOR),
cli.cli_option("-p", "--parallel", default=False, action="store_true",
dest="parallel",
help=("Enable parallelization of some operations in"
......
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