Commit 9a033156 authored by Iustin Pop's avatar Iustin Pop

Revert "CLI: remove command opts/args in "gnt-X""

This reverts commit 976.

Reviewed-by: ultrotter
parent 57d0151e
...@@ -251,15 +251,16 @@ def _ParseArgs(argv, commands, aliases): ...@@ -251,15 +251,16 @@ def _ParseArgs(argv, commands, aliases):
"\n%(bin)s <command> --help to see details, or" "\n%(bin)s <command> --help to see details, or"
" man %(bin)s\n" % {"bin": binary}) " man %(bin)s\n" % {"bin": binary})
# compute the max line length for cmd + usage # compute the max line length for cmd + usage
mlen = max([len(" %s" % cmd) for cmd in commands]) mlen = max([len(" %s %s" % (cmd, commands[cmd][3])) for cmd in commands])
mlen = min(60, mlen) # should not get here... mlen = min(60, mlen) # should not get here...
# and format a nice command list # and format a nice command list
print "Commands:" print "Commands:"
for cmd in sortedcmds: for cmd in sortedcmds:
cmdstr = " %s" % (cmd,) cmdstr = " %s %s" % (cmd, commands[cmd][3])
help_text = commands[cmd][3] help_text = commands[cmd][4]
help_lines = textwrap.wrap(help_text, 79-3-mlen) help_lines = textwrap.wrap(help_text, 79-3-mlen)
print "%-*s - %s" % (mlen, cmdstr, help_lines.pop(0)) print "%-*s - %s" % (mlen, cmdstr,
help_lines.pop(0))
for line in help_lines: for line in help_lines:
print "%-*s %s" % (mlen, "", line) print "%-*s %s" % (mlen, "", line)
print print
......
...@@ -177,7 +177,7 @@ commands = { ...@@ -177,7 +177,7 @@ commands = {
help="List only backups stored on this node" help="List only backups stored on this node"
" (can be used multiple times)"), " (can be used multiple times)"),
], ],
"Lists instance exports available in the ganeti cluster"), "", "Lists instance exports available in the ganeti cluster"),
'export': (ExportInstance, ARGS_ONE, 'export': (ExportInstance, ARGS_ONE,
[DEBUG_OPT, FORCE_OPT, [DEBUG_OPT, FORCE_OPT,
make_option("-n", "--node", dest="node", help="Target node", make_option("-n", "--node", dest="node", help="Target node",
...@@ -185,11 +185,13 @@ commands = { ...@@ -185,11 +185,13 @@ commands = {
make_option("","--noshutdown", dest="shutdown", make_option("","--noshutdown", dest="shutdown",
action="store_false", default=True, action="store_false", default=True,
help="Don't shutdown the instance (unsafe)"), ], help="Don't shutdown the instance (unsafe)"), ],
"-n <target_node> [opts...] <name>",
"Exports an instance to an image"), "Exports an instance to an image"),
'import': (ImportInstance, ARGS_ONE, import_opts, 'import': (ImportInstance, ARGS_ONE, import_opts, "[opts...] <name>",
"Imports an instance from an exported image"), "Imports an instance from an exported image"),
'remove': (RemoveExport, ARGS_ONE, 'remove': (RemoveExport, ARGS_ONE,
[DEBUG_OPT], [DEBUG_OPT],
"<name>",
"Remove exports of named instance from the filesystem."), "Remove exports of named instance from the filesystem."),
} }
......
...@@ -359,6 +359,7 @@ commands = { ...@@ -359,6 +359,7 @@ commands = {
" (cluster-wide)", " (cluster-wide)",
action="store_false", default=True,), action="store_false", default=True,),
], ],
"[opts...] <cluster_name>",
"Initialises a new cluster configuration"), "Initialises a new cluster configuration"),
'destroy': (DestroyCluster, ARGS_NONE, 'destroy': (DestroyCluster, ARGS_NONE,
[DEBUG_OPT, [DEBUG_OPT,
...@@ -366,8 +367,9 @@ commands = { ...@@ -366,8 +367,9 @@ commands = {
help="Destroy cluster", help="Destroy cluster",
action="store_true"), action="store_true"),
], ],
"Destroy cluster"), "", "Destroy cluster"),
'rename': (RenameCluster, ARGS_ONE, [DEBUG_OPT, FORCE_OPT], 'rename': (RenameCluster, ARGS_ONE, [DEBUG_OPT, FORCE_OPT],
"<new_name>",
"Renames the cluster"), "Renames the cluster"),
'verify': (VerifyCluster, ARGS_NONE, [DEBUG_OPT, 'verify': (VerifyCluster, ARGS_NONE, [DEBUG_OPT,
make_option("--no-nplus1-mem", dest="skip_nplusone_mem", make_option("--no-nplus1-mem", dest="skip_nplusone_mem",
...@@ -375,29 +377,31 @@ commands = { ...@@ -375,29 +377,31 @@ commands = {
action="store_true", action="store_true",
default=False,), default=False,),
], ],
"Does a check on the cluster configuration"), "", "Does a check on the cluster configuration"),
'verify-disks': (VerifyDisks, ARGS_NONE, [DEBUG_OPT], 'verify-disks': (VerifyDisks, ARGS_NONE, [DEBUG_OPT],
"Does a check on the cluster disk status"), "", "Does a check on the cluster disk status"),
'masterfailover': (MasterFailover, ARGS_NONE, [DEBUG_OPT], 'masterfailover': (MasterFailover, ARGS_NONE, [DEBUG_OPT],
"Makes the current node the master"), "", "Makes the current node the master"),
'version': (ShowClusterVersion, ARGS_NONE, [DEBUG_OPT], 'version': (ShowClusterVersion, ARGS_NONE, [DEBUG_OPT],
"Shows the cluster version"), "", "Shows the cluster version"),
'getmaster': (ShowClusterMaster, ARGS_NONE, [DEBUG_OPT], 'getmaster': (ShowClusterMaster, ARGS_NONE, [DEBUG_OPT],
"Shows the cluster master"), "", "Shows the cluster master"),
'copyfile': (ClusterCopyFile, ARGS_ONE, [DEBUG_OPT, node_option], 'copyfile': (ClusterCopyFile, ARGS_ONE, [DEBUG_OPT, node_option],
"[-n node...] <filename>",
"Copies a file to all (or only some) nodes"), "Copies a file to all (or only some) nodes"),
'command': (RunClusterCommand, ARGS_ATLEAST(1), [DEBUG_OPT, node_option], 'command': (RunClusterCommand, ARGS_ATLEAST(1), [DEBUG_OPT, node_option],
"[-n node...] <command>",
"Runs a command on all (or only some) nodes"), "Runs a command on all (or only some) nodes"),
'info': (ShowClusterConfig, ARGS_NONE, [DEBUG_OPT], 'info': (ShowClusterConfig, ARGS_NONE, [DEBUG_OPT],
"Show cluster configuration"), "", "Show cluster configuration"),
'list-tags': (ListTags, ARGS_NONE, 'list-tags': (ListTags, ARGS_NONE,
[DEBUG_OPT], "List the tags of the cluster"), [DEBUG_OPT], "", "List the tags of the cluster"),
'add-tags': (AddTags, ARGS_ANY, [DEBUG_OPT, TAG_SRC_OPT], 'add-tags': (AddTags, ARGS_ANY, [DEBUG_OPT, TAG_SRC_OPT],
"Add tags to the cluster"), "tag...", "Add tags to the cluster"),
'remove-tags': (RemoveTags, ARGS_ANY, [DEBUG_OPT, TAG_SRC_OPT], 'remove-tags': (RemoveTags, ARGS_ANY, [DEBUG_OPT, TAG_SRC_OPT],
"Remove tags from the cluster"), "tag...", "Remove tags from the cluster"),
'search-tags': (SearchTags, ARGS_ONE, 'search-tags': (SearchTags, ARGS_ONE,
[DEBUG_OPT], "Searches the tags on all objects on" [DEBUG_OPT], "", "Searches the tags on all objects on"
" the cluster for a given pattern (regex)"), " the cluster for a given pattern (regex)"),
'modify': (SetClusterParams, ARGS_NONE, 'modify': (SetClusterParams, ARGS_NONE,
[DEBUG_OPT, [DEBUG_OPT,
......
...@@ -148,11 +148,11 @@ commands = { ...@@ -148,11 +148,11 @@ commands = {
action="append", action="append",
help="Select nodes to sleep on"), help="Select nodes to sleep on"),
], ],
"Executes a TestDelay OpCode"), "[opts...] <duration>", "Executes a TestDelay OpCode"),
'submit-job': (GenericOpCodes, ARGS_ONE, 'submit-job': (GenericOpCodes, ARGS_ONE,
[DEBUG_OPT, [DEBUG_OPT,
], ],
"Submits a job built from a json-file" "<op_list_file>", "Submits a job built from a json-file"
" with a list of serialized opcodes"), " with a list of serialized opcodes"),
'allocator': (TestAllocator, ARGS_ONE, 'allocator': (TestAllocator, ARGS_ONE,
[DEBUG_OPT, [DEBUG_OPT,
...@@ -184,7 +184,7 @@ commands = { ...@@ -184,7 +184,7 @@ commands = {
make_option("--tags", default=None, make_option("--tags", default=None,
help="Comma separated list of tags"), help="Comma separated list of tags"),
], ],
"Executes a TestAllocator OpCode"), "{opts...} <instance>", "Executes a TestAllocator OpCode"),
} }
......
...@@ -795,12 +795,14 @@ add_opts = [ ...@@ -795,12 +795,14 @@ add_opts = [
commands = { commands = {
'add': (AddInstance, ARGS_ONE, add_opts, 'add': (AddInstance, ARGS_ONE, add_opts,
"[opts...] <name>",
"Creates and adds a new instance to the cluster"), "Creates and adds a new instance to the cluster"),
'console': (ConnectToInstanceConsole, ARGS_ONE, 'console': (ConnectToInstanceConsole, ARGS_ONE,
[DEBUG_OPT, [DEBUG_OPT,
make_option("--show-cmd", dest="show_command", make_option("--show-cmd", dest="show_command",
action="store_true", default=False, action="store_true", default=False,
help=("Show command instead of executing it"))], help=("Show command instead of executing it"))],
"[--show-cmd] <instance>",
"Opens a console on the specified instance"), "Opens a console on the specified instance"),
'failover': (FailoverInstance, ARGS_ONE, 'failover': (FailoverInstance, ARGS_ONE,
[DEBUG_OPT, FORCE_OPT, [DEBUG_OPT, FORCE_OPT,
...@@ -809,12 +811,13 @@ commands = { ...@@ -809,12 +811,13 @@ commands = {
help="Ignore the consistency of the disks on" help="Ignore the consistency of the disks on"
" the secondary"), " the secondary"),
], ],
"[-f] <instance>",
"Stops the instance and starts it on the backup node, using" "Stops the instance and starts it on the backup node, using"
" the remote mirror (only for instances of type drbd)"), " the remote mirror (only for instances of type drbd)"),
'info': (ShowInstanceConfig, ARGS_ANY, [DEBUG_OPT], 'info': (ShowInstanceConfig, ARGS_ANY, [DEBUG_OPT], "[<instance>...]",
"Show information on the specified instance"), "Show information on the specified instance"),
'list': (ListInstances, ARGS_NONE, 'list': (ListInstances, ARGS_NONE,
[DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT], [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT], "",
"Lists the instances and their status. The available fields are" "Lists the instances and their status. The available fields are"
" (see the man page for details): status, oper_state, oper_ram," " (see the man page for details): status, oper_state, oper_ram,"
" name, os, pnode, snodes, admin_state, admin_ram, disk_template," " name, os, pnode, snodes, admin_state, admin_ram, disk_template,"
...@@ -822,7 +825,7 @@ commands = { ...@@ -822,7 +825,7 @@ commands = {
" list is (in order): %s." % ", ".join(_LIST_DEF_FIELDS), " list is (in order): %s." % ", ".join(_LIST_DEF_FIELDS),
), ),
'reinstall': (ReinstallInstance, ARGS_ONE, [DEBUG_OPT, FORCE_OPT, os_opt], 'reinstall': (ReinstallInstance, ARGS_ONE, [DEBUG_OPT, FORCE_OPT, os_opt],
"Reinstall a stopped instance"), "[-f] <instance>", "Reinstall a stopped instance"),
'remove': (RemoveInstance, ARGS_ONE, 'remove': (RemoveInstance, ARGS_ONE,
[DEBUG_OPT, FORCE_OPT, [DEBUG_OPT, FORCE_OPT,
make_option("--ignore-failures", dest="ignore_failures", make_option("--ignore-failures", dest="ignore_failures",
...@@ -831,7 +834,7 @@ commands = { ...@@ -831,7 +834,7 @@ commands = {
" if there are failures during the removal" " if there are failures during the removal"
" process (shutdown, disk removal, etc.)")), " process (shutdown, disk removal, etc.)")),
], ],
"Shuts down the instance and removes it"), "[-f] <instance>", "Shuts down the instance and removes it"),
'rename': (RenameInstance, ARGS_FIXED(2), 'rename': (RenameInstance, ARGS_FIXED(2),
[DEBUG_OPT, [DEBUG_OPT,
make_option("--no-ip-check", dest="ignore_ip", make_option("--no-ip-check", dest="ignore_ip",
...@@ -839,7 +842,7 @@ commands = { ...@@ -839,7 +842,7 @@ commands = {
" is alive", " is alive",
default=False, action="store_true"), default=False, action="store_true"),
], ],
"Rename the instance"), "<instance> <new_name>", "Rename the instance"),
'replace-disks': (ReplaceDisks, ARGS_ONE, 'replace-disks': (ReplaceDisks, ARGS_ONE,
[DEBUG_OPT, [DEBUG_OPT,
make_option("-n", "--new-secondary", dest="new_secondary", make_option("-n", "--new-secondary", dest="new_secondary",
...@@ -864,6 +867,7 @@ commands = { ...@@ -864,6 +867,7 @@ commands = {
" secondary node replacement)", " secondary node replacement)",
default=None, type="string"), default=None, type="string"),
], ],
"[-s|-p|-n NODE] <instance>",
"Replaces all disks for the instance"), "Replaces all disks for the instance"),
'modify': (SetInstanceParams, ARGS_ONE, 'modify': (SetInstanceParams, ARGS_ONE,
[DEBUG_OPT, FORCE_OPT, [DEBUG_OPT, FORCE_OPT,
...@@ -895,11 +899,11 @@ commands = { ...@@ -895,11 +899,11 @@ commands = {
"(either one or more of [acdn] or 'default')", "(either one or more of [acdn] or 'default')",
default=None, type="string", metavar="<BOOTORDER>"), default=None, type="string", metavar="<BOOTORDER>"),
], ],
"Alters the parameters of an instance"), "<instance>", "Alters the parameters of an instance"),
'shutdown': (ShutdownInstance, ARGS_ANY, 'shutdown': (ShutdownInstance, ARGS_ANY,
[DEBUG_OPT, m_node_opt, m_pri_node_opt, m_sec_node_opt, [DEBUG_OPT, m_node_opt, m_pri_node_opt, m_sec_node_opt,
m_clust_opt, m_inst_opt, m_force_multi], m_clust_opt, m_inst_opt, m_force_multi],
"Stops an instance"), "<instance>", "Stops an instance"),
'startup': (StartupInstance, ARGS_ANY, 'startup': (StartupInstance, ARGS_ANY,
[DEBUG_OPT, FORCE_OPT, m_force_multi, [DEBUG_OPT, FORCE_OPT, m_force_multi,
make_option("-e", "--extra", dest="extra_args", make_option("-e", "--extra", dest="extra_args",
...@@ -908,7 +912,7 @@ commands = { ...@@ -908,7 +912,7 @@ commands = {
m_node_opt, m_pri_node_opt, m_sec_node_opt, m_node_opt, m_pri_node_opt, m_sec_node_opt,
m_clust_opt, m_inst_opt, m_clust_opt, m_inst_opt,
], ],
"Starts an instance"), "<instance>", "Starts an instance"),
'reboot': (RebootInstance, ARGS_ANY, 'reboot': (RebootInstance, ARGS_ANY,
[DEBUG_OPT, m_force_multi, [DEBUG_OPT, m_force_multi,
...@@ -925,17 +929,19 @@ commands = { ...@@ -925,17 +929,19 @@ commands = {
m_node_opt, m_pri_node_opt, m_sec_node_opt, m_node_opt, m_pri_node_opt, m_sec_node_opt,
m_clust_opt, m_inst_opt, m_clust_opt, m_inst_opt,
], ],
"Reboots an instance"), "<instance>", "Reboots an instance"),
'activate-disks': (ActivateDisks, ARGS_ONE, [DEBUG_OPT], 'activate-disks': (ActivateDisks, ARGS_ONE, [DEBUG_OPT],
"<instance>",
"Activate an instance's disks"), "Activate an instance's disks"),
'deactivate-disks': (DeactivateDisks, ARGS_ONE, [DEBUG_OPT], 'deactivate-disks': (DeactivateDisks, ARGS_ONE, [DEBUG_OPT],
"<instance>",
"Deactivate an instance's disks"), "Deactivate an instance's disks"),
'list-tags': (ListTags, ARGS_ONE, [DEBUG_OPT], 'list-tags': (ListTags, ARGS_ONE, [DEBUG_OPT],
"List the tags of the given instance"), "<node_name>", "List the tags of the given instance"),
'add-tags': (AddTags, ARGS_ATLEAST(1), [DEBUG_OPT, TAG_SRC_OPT], 'add-tags': (AddTags, ARGS_ATLEAST(1), [DEBUG_OPT, TAG_SRC_OPT],
"Add tags to the given instance"), "<node_name> tag...", "Add tags to the given instance"),
'remove-tags': (RemoveTags, ARGS_ATLEAST(1), [DEBUG_OPT, TAG_SRC_OPT], 'remove-tags': (RemoveTags, ARGS_ATLEAST(1), [DEBUG_OPT, TAG_SRC_OPT],
"Remove tags from given instance"), "<node_name> tag...", "Remove tags from given instance"),
} }
aliases = { aliases = {
......
...@@ -95,8 +95,8 @@ def ListJobs(opts, args): ...@@ -95,8 +95,8 @@ def ListJobs(opts, args):
commands = { commands = {
'list': (ListJobs, ARGS_NONE, 'list': (ListJobs, ARGS_NONE,
[DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT], [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT],
"List the jobs and their status. The available fields are" "", "List the jobs and their status. The available fields are"
" (see the man page for details): id, status, op_list," " (see the man page for details): id, status, op_list,"
" op_status, op_result." " op_status, op_result."
" The default field" " The default field"
......
...@@ -295,9 +295,10 @@ commands = { ...@@ -295,9 +295,10 @@ commands = {
default=False, action="store_true", default=False, action="store_true",
help="Readd old node after replacing it"), help="Readd old node after replacing it"),
], ],
"Add a node to the cluster"), "[-s ip] <node_name>", "Add a node to the cluster"),
'evacuate': (EvacuateNode, ARGS_FIXED(2), 'evacuate': (EvacuateNode, ARGS_FIXED(2),
[DEBUG_OPT, FORCE_OPT], [DEBUG_OPT, FORCE_OPT],
"[-f] <src> <dst>",
"Relocate the secondary instances from the first node" "Relocate the secondary instances from the first node"
" to the second one (only for instances of type remote_raid1" " to the second one (only for instances of type remote_raid1"
" drbd)"), " drbd)"),
...@@ -308,29 +309,30 @@ commands = { ...@@ -308,29 +309,30 @@ commands = {
help="Ignore the consistency of the disks on" help="Ignore the consistency of the disks on"
" the secondary"), " the secondary"),
], ],
"[-f] <node>",
"Stops the primary instances on a node and start them on their" "Stops the primary instances on a node and start them on their"
" secondary node (only for instances of type remote_raid1)"), " secondary node (only for instances of type remote_raid1)"),
'info': (ShowNodeConfig, ARGS_ANY, [DEBUG_OPT], 'info': (ShowNodeConfig, ARGS_ANY, [DEBUG_OPT],
"Show information about the node(s)"), "[<node_name>...]", "Show information about the node(s)"),
'list': (ListNodes, ARGS_NONE, 'list': (ListNodes, ARGS_NONE,
[DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT], [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT],
"Lists the nodes in the cluster. The available fields" "", "Lists the nodes in the cluster. The available fields"
" are (see the man page for details): name, pinst_cnt, pinst_list," " are (see the man page for details): name, pinst_cnt, pinst_list,"
" sinst_cnt, sinst_list, pip, sip, dtotal, dfree, mtotal, mnode," " sinst_cnt, sinst_list, pip, sip, dtotal, dfree, mtotal, mnode,"
" mfree, bootid, cpu_count. The default field list is" " mfree, bootid, cpu_count. The default field list is"
" (in order): %s." % ", ".join(_LIST_DEF_FIELDS), " (in order): %s." % ", ".join(_LIST_DEF_FIELDS),
), ),
'remove': (RemoveNode, ARGS_ONE, [DEBUG_OPT], 'remove': (RemoveNode, ARGS_ONE, [DEBUG_OPT],
"Removes a node from the cluster"), "<node_name>", "Removes a node from the cluster"),
'volumes': (ListVolumes, ARGS_ANY, 'volumes': (ListVolumes, ARGS_ANY,
[DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT], [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT],
"List logical volumes on node(s)"), "[<node_name>...]", "List logical volumes on node(s)"),
'list-tags': (ListTags, ARGS_ONE, [DEBUG_OPT], 'list-tags': (ListTags, ARGS_ONE, [DEBUG_OPT],
"List the tags of the given node"), "<node_name>", "List the tags of the given node"),
'add-tags': (AddTags, ARGS_ATLEAST(1), [DEBUG_OPT, TAG_SRC_OPT], 'add-tags': (AddTags, ARGS_ATLEAST(1), [DEBUG_OPT, TAG_SRC_OPT],
"Add tags to the given node"), "<node_name> tag...", "Add tags to the given node"),
'remove-tags': (RemoveTags, ARGS_ATLEAST(1), [DEBUG_OPT, TAG_SRC_OPT], 'remove-tags': (RemoveTags, ARGS_ATLEAST(1), [DEBUG_OPT, TAG_SRC_OPT],
"Remove tags from the given node"), "<node_name> tag...", "Remove tags from the given node"),
} }
......
...@@ -116,9 +116,9 @@ def DiagnoseOS(opts, args): ...@@ -116,9 +116,9 @@ def DiagnoseOS(opts, args):
commands = { commands = {
'list': (ListOS, ARGS_NONE, [DEBUG_OPT, NOHDR_OPT], 'list': (ListOS, ARGS_NONE, [DEBUG_OPT, NOHDR_OPT], "",
"Lists all valid OSes on the master"), "Lists all valid OSes on the master"),
'diagnose': (DiagnoseOS, ARGS_NONE, [DEBUG_OPT], 'diagnose': (DiagnoseOS, ARGS_NONE, [DEBUG_OPT], "",
"Diagnose all OSes"), "Diagnose all OSes"),
} }
......
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