Commit 6ea815cf authored by Iustin Pop's avatar Iustin Pop

Change indentation style in commands definitions

Currently, the indentation level for a command's definition depends on
the command name length, and this makes the commands dict unpleasant to
the eye. This patch changes it so that a new line begins right after the
left parenthesis starting the command tuple.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 6d4e8ec0
......@@ -229,21 +229,23 @@ import_opts = [
]
commands = {
'list': (PrintExportList, ARGS_NONE,
[DEBUG_OPT, NODE_LIST_OPT],
"", "Lists instance exports available in the ganeti cluster"),
'export': (ExportInstance, ARGS_ONE_INSTANCE,
[DEBUG_OPT, FORCE_OPT, SINGLE_NODE_OPT, NOSHUTDOWN_OPT]
"-n <target_node> [opts...] <name>",
"Exports an instance to an image"),
'import': (ImportInstance, ARGS_ONE_INSTANCE, import_opts,
("[...] -t disk-type -n node[:secondary-node]"
" <name>"),
"Imports an instance from an exported image"),
'remove': (RemoveExport, [ArgUnknown(min=1, max=1)],
[DEBUG_OPT],
"<name>",
"Remove exports of named instance from the filesystem."),
'list': (
PrintExportList, ARGS_NONE,
[DEBUG_OPT, NODE_LIST_OPT],
"", "Lists instance exports available in the ganeti cluster"),
'export': (
ExportInstance, ARGS_ONE_INSTANCE,
[DEBUG_OPT, FORCE_OPT, SINGLE_NODE_OPT, NOSHUTDOWN_OPT],
"-n <target_node> [opts...] <name>",
"Exports an instance to an image"),
'import': (
ImportInstance, ARGS_ONE_INSTANCE, import_opts,
"[...] -t disk-type -n node[:secondary-node] <name>",
"Imports an instance from an exported image"),
'remove': (
RemoveExport, [ArgUnknown(min=1, max=1)],
[DEBUG_OPT],
"<name>", "Remove exports of named instance from the filesystem."),
}
......
......@@ -595,82 +595,84 @@ def WatcherOps(opts, args):
commands = {
'init': (InitCluster, [ArgHost(min=1, max=1)],
[DEBUG_OPT,
SECONDARY_IP_OPT,
MAC_PREFIX_OPT,
VG_NAME_OPT,
MASTER_NETDEV_OPT,
GLOBAL_FILEDIR_OPT,
NOLVM_STORAGE_OPT,
NOMODIFY_ETCHOSTS_OPT,
ENABLED_HV_OPT,
HVLIST_OPT,
BACKEND_OPT,
NIC_PARAMS_OPT,
CP_SIZE_OPT,
],
"[opts...] <cluster_name>",
"Initialises a new cluster configuration"),
'destroy': (DestroyCluster, ARGS_NONE,
[DEBUG_OPT, YES_DOIT_OPT],
"", "Destroy cluster"),
'rename': (RenameCluster, [ArgHost(min=1, max=1)],
[DEBUG_OPT, FORCE_OPT],
"<new_name>",
"Renames the cluster"),
'redist-conf': (RedistributeConfig, ARGS_NONE, [DEBUG_OPT, SUBMIT_OPT],
"",
"Forces a push of the configuration file and ssconf files"
" to the nodes in the cluster"),
'verify': (VerifyCluster, ARGS_NONE,
[DEBUG_OPT, VERBOSE_OPT, DEBUG_SIMERR_OPT,
ERROR_CODES_OPT, NONPLUS1_OPT],
"", "Does a check on the cluster configuration"),
'verify-disks': (VerifyDisks, ARGS_NONE, [DEBUG_OPT],
"", "Does a check on the cluster disk status"),
'repair-disk-sizes': (RepairDiskSizes, ARGS_MANY_INSTANCES, [DEBUG_OPT],
"", "Updates mismatches in recorded disk sizes"),
'masterfailover': (MasterFailover, ARGS_NONE, [DEBUG_OPT, NOVOTING_OPT],
"", "Makes the current node the master"),
'version': (ShowClusterVersion, ARGS_NONE, [DEBUG_OPT],
"", "Shows the cluster version"),
'getmaster': (ShowClusterMaster, ARGS_NONE, [DEBUG_OPT],
"", "Shows the cluster master"),
'copyfile': (ClusterCopyFile, [ArgFile(min=1, max=1)],
[DEBUG_OPT, NODE_LIST_OPT],
"[-n node...] <filename>",
"Copies a file to all (or only some) nodes"),
'command': (RunClusterCommand, [ArgCommand(min=1)],
[DEBUG_OPT, NODE_LIST_OPT],
"[-n node...] <command>",
"Runs a command on all (or only some) nodes"),
'info': (ShowClusterConfig, ARGS_NONE, [DEBUG_OPT],
"", "Show cluster configuration"),
'list-tags': (ListTags, ARGS_NONE,
[DEBUG_OPT], "", "List the tags of the cluster"),
'add-tags': (AddTags, [ArgUnknown()], [DEBUG_OPT, TAG_SRC_OPT],
"tag...", "Add tags to the cluster"),
'remove-tags': (RemoveTags, [ArgUnknown()], [DEBUG_OPT, TAG_SRC_OPT],
"tag...", "Remove tags from the cluster"),
'search-tags': (SearchTags, [ArgUnknown(min=1, max=1)],
[DEBUG_OPT], "", "Searches the tags on all objects on"
" the cluster for a given pattern (regex)"),
'queue': (QueueOps,
[ArgChoice(min=1, max=1, choices=["drain", "undrain", "info"])],
[DEBUG_OPT],
"drain|undrain|info", "Change queue properties"),
'watcher': (WatcherOps,
[ArgChoice(min=1, max=1,
choices=["pause", "continue", "info"]),
ArgSuggest(min=0, max=1, choices=["30m", "1h", "4h"])],
[DEBUG_OPT],
"{pause <timespec>|continue|info}", "Change watcher properties"),
'modify': (SetClusterParams, ARGS_NONE,
[DEBUG_OPT, BACKEND_OPT, CP_SIZE_OPT, ENABLED_HV_OPT, HVLIST_OPT,
NIC_PARAMS_OPT, NOLVM_STORAGE_OPT, VG_NAME_OPT],
"[opts...]",
"Alters the parameters of the cluster"),
'init': (
InitCluster, [ArgHost(min=1, max=1)],
[DEBUG_OPT, BACKEND_OPT, CP_SIZE_OPT, ENABLED_HV_OPT, GLOBAL_FILEDIR_OPT,
HVLIST_OPT, MAC_PREFIX_OPT, MASTER_NETDEV_OPT, NIC_PARAMS_OPT,
NOLVM_STORAGE_OPT, NOMODIFY_ETCHOSTS_OPT, SECONDARY_IP_OPT, VG_NAME_OPT],
"[opts...] <cluster_name>", "Initialises a new cluster configuration"),
'destroy': (
DestroyCluster, ARGS_NONE,
[DEBUG_OPT, YES_DOIT_OPT],
"", "Destroy cluster"),
'rename': (
RenameCluster, [ArgHost(min=1, max=1)],
[DEBUG_OPT, FORCE_OPT],
"<new_name>",
"Renames the cluster"),
'redist-conf': (
RedistributeConfig, ARGS_NONE, [DEBUG_OPT, SUBMIT_OPT],
"", "Forces a push of the configuration file and ssconf files"
" to the nodes in the cluster"),
'verify': (
VerifyCluster, ARGS_NONE,
[DEBUG_OPT, VERBOSE_OPT, DEBUG_SIMERR_OPT, ERROR_CODES_OPT, NONPLUS1_OPT],
"", "Does a check on the cluster configuration"),
'verify-disks': (
VerifyDisks, ARGS_NONE, [DEBUG_OPT],
"", "Does a check on the cluster disk status"),
'repair-disk-sizes': (
RepairDiskSizes, ARGS_MANY_INSTANCES, [DEBUG_OPT],
"", "Updates mismatches in recorded disk sizes"),
'masterfailover': (
MasterFailover, ARGS_NONE, [DEBUG_OPT, NOVOTING_OPT],
"", "Makes the current node the master"),
'version': (
ShowClusterVersion, ARGS_NONE, [DEBUG_OPT],
"", "Shows the cluster version"),
'getmaster': (
ShowClusterMaster, ARGS_NONE, [DEBUG_OPT],
"", "Shows the cluster master"),
'copyfile': (
ClusterCopyFile, [ArgFile(min=1, max=1)],
[DEBUG_OPT, NODE_LIST_OPT],
"[-n node...] <filename>", "Copies a file to all (or only some) nodes"),
'command': (
RunClusterCommand, [ArgCommand(min=1)],
[DEBUG_OPT, NODE_LIST_OPT],
"[-n node...] <command>", "Runs a command on all (or only some) nodes"),
'info': (
ShowClusterConfig, ARGS_NONE, [DEBUG_OPT],
"", "Show cluster configuration"),
'list-tags': (
ListTags, ARGS_NONE,
[DEBUG_OPT], "", "List the tags of the cluster"),
'add-tags': (
AddTags, [ArgUnknown()], [DEBUG_OPT, TAG_SRC_OPT],
"tag...", "Add tags to the cluster"),
'remove-tags': (
RemoveTags, [ArgUnknown()], [DEBUG_OPT, TAG_SRC_OPT],
"tag...", "Remove tags from the cluster"),
'search-tags': (
SearchTags, [ArgUnknown(min=1, max=1)],
[DEBUG_OPT], "", "Searches the tags on all objects on"
" the cluster for a given pattern (regex)"),
'queue': (
QueueOps,
[ArgChoice(min=1, max=1, choices=["drain", "undrain", "info"])],
[DEBUG_OPT], "drain|undrain|info", "Change queue properties"),
'watcher': (
WatcherOps,
[ArgChoice(min=1, max=1, choices=["pause", "continue", "info"]),
ArgSuggest(min=0, max=1, choices=["30m", "1h", "4h"])],
[DEBUG_OPT],
"{pause <timespec>|continue|info}", "Change watcher properties"),
'modify': (
SetClusterParams, ARGS_NONE,
[DEBUG_OPT, BACKEND_OPT, CP_SIZE_OPT, ENABLED_HV_OPT, HVLIST_OPT,
NIC_PARAMS_OPT, NOLVM_STORAGE_OPT, VG_NAME_OPT],
"[opts...]",
"Alters the parameters of the cluster"),
}
if __name__ == '__main__':
......
......@@ -154,59 +154,54 @@ def TestAllocator(opts, args):
commands = {
'delay': (Delay, [ArgUnknown(min=1, max=1)],
[DEBUG_OPT,
cli_option("--no-master", dest="on_master", default=True,
action="store_false",
help="Do not sleep in the master code"),
cli_option("-n", dest="on_nodes", default=[],
action="append",
help="Select nodes to sleep on"),
],
"[opts...] <duration>", "Executes a TestDelay OpCode"),
'submit-job': (GenericOpCodes, [ArgFile(min=1)],
[DEBUG_OPT, VERBOSE_OPT,
cli_option("--op-repeat", type="int", default="1",
dest="rep_op",
help="Repeat the opcode sequence this number"
" of times"),
cli_option("--job-repeat", type="int", default="1",
dest="rep_job",
help="Repeat the job this number"
" of times"),
cli_option("--timing-stats", default=False,
action="store_true",
help="Show timing stats"),
],
"<op_list_file...>", "Submits jobs built from json files"
" containing a list of serialized opcodes"),
'allocator': (TestAllocator, ARGS_ONE_INSTANCE,
[DEBUG_OPT,
cli_option("--dir", dest="direction",
default="in", choices=["in", "out"],
help="Show allocator input (in) or allocator"
" results (out)"),
IALLOCATOR_OPT,
cli_option("-m", "--mode", default="relocate",
choices=["relocate", "allocate"],
help="Request mode, either allocate or"
" relocate"),
cli_option("--mem", default=128, type="unit",
help="Memory size for the instance (MiB)"),
cli_option("--disks", default="4096,4096",
help="Comma separated list of disk sizes (MiB)"),
DISK_TEMPLATE_OPT,
cli_option("--nics", default="00:11:22:33:44:55",
help="Comma separated list of nics, each nic"
" definition is of form mac/ip/bridge, if"
" missing values are replace by None"),
OS_OPT,
cli_option("-p", "--vcpus", default=1, type="int",
help="Select number of VCPUs for the instance"),
cli_option("--tags", default=None,
help="Comma separated list of tags"),
],
"{opts...} <instance>", "Executes a TestAllocator OpCode"),
'delay': (
Delay, [ArgUnknown(min=1, max=1)],
[DEBUG_OPT,
cli_option("--no-master", dest="on_master", default=True,
action="store_false", help="Do not sleep in the master code"),
cli_option("-n", dest="on_nodes", default=[],
action="append", help="Select nodes to sleep on"),
],
"[opts...] <duration>", "Executes a TestDelay OpCode"),
'submit-job': (
GenericOpCodes, [ArgFile(min=1)],
[DEBUG_OPT, VERBOSE_OPT,
cli_option("--op-repeat", type="int", default="1", dest="rep_op",
help="Repeat the opcode sequence this number of times"),
cli_option("--job-repeat", type="int", default="1", dest="rep_job",
help="Repeat the job this number of times"),
cli_option("--timing-stats", default=False,
action="store_true", help="Show timing stats"),
],
"<op_list_file...>", "Submits jobs built from json files"
" containing a list of serialized opcodes"),
'allocator': (
TestAllocator, ARGS_ONE_INSTANCE,
[DEBUG_OPT,
cli_option("--dir", dest="direction",
default="in", choices=["in", "out"],
help="Show allocator input (in) or allocator"
" results (out)"),
IALLOCATOR_OPT,
cli_option("-m", "--mode", default="relocate",
choices=["relocate", "allocate"],
help="Request mode, either allocate or relocate"),
cli_option("--mem", default=128, type="unit",
help="Memory size for the instance (MiB)"),
cli_option("--disks", default="4096,4096",
help="Comma separated list of disk sizes (MiB)"),
DISK_TEMPLATE_OPT,
cli_option("--nics", default="00:11:22:33:44:55",
help="Comma separated list of nics, each nic"
" definition is of form mac/ip/bridge, if"
" missing values are replace by None"),
OS_OPT,
cli_option("-p", "--vcpus", default=1, type="int",
help="Select number of VCPUs for the instance"),
cli_option("--tags", default=None,
help="Comma separated list of tags"),
],
"{opts...} <instance>", "Executes a TestAllocator OpCode"),
}
......
......@@ -1377,125 +1377,122 @@ add_opts = [
]
commands = {
'add': (AddInstance, [ArgHost(min=1, max=1)], add_opts,
"[...] -t disk-type -n node[:secondary-node] -o os-type <name>",
"Creates and adds a new instance to the cluster"),
'batch-create': (BatchCreate, [ArgFile(min=1, max=1)],
[DEBUG_OPT],
"<instances_file.json>",
"Create a bunch of instances based on specs in the file."),
'console': (ConnectToInstanceConsole, ARGS_ONE_INSTANCE,
[DEBUG_OPT, SHOWCMD_OPT],
"[--show-cmd] <instance>",
"Opens a console on the specified instance"),
'failover': (FailoverInstance, ARGS_ONE_INSTANCE,
[DEBUG_OPT, FORCE_OPT, IGNORE_CONSIST_OPT, SUBMIT_OPT],
"[-f] <instance>",
"Stops the instance and starts it on the backup node, using"
" the remote mirror (only for instances of type drbd)"),
'migrate': (MigrateInstance, ARGS_ONE_INSTANCE,
[DEBUG_OPT, FORCE_OPT, NONLIVE_OPT, CLEANUP_OPT],
"[-f] <instance>",
"Migrate instance to its secondary node"
" (only for instances of type drbd)"),
'move': (MoveInstance, ARGS_ONE_INSTANCE,
[DEBUG_OPT, FORCE_OPT, SUBMIT_OPT, SINGLE_NODE_OPT],
"[-f] <instance>",
"Move instance to an arbitrary node"
" (only for instances of type file and lv)"),
'info': (ShowInstanceConfig, ARGS_MANY_INSTANCES,
[DEBUG_OPT, STATIC_OPT, ALL_OPT],
"[-s] {--all | <instance>...}",
"Show information on the specified instance(s)"),
'list': (ListInstances, ARGS_MANY_INSTANCES,
[DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT, SYNC_OPT],
"[<instance>...]",
"Lists the instances and their status. The available fields are"
" (see the man page for details): status, oper_state, oper_ram,"
" name, os, pnode, snodes, admin_state, admin_ram, disk_template,"
" ip, mac, mode, link, sda_size, sdb_size, vcpus, serial_no,"
" hypervisor."
" The default field"
" list is (in order): %s." % ", ".join(_LIST_DEF_FIELDS),
),
'reinstall': (ReinstallInstance, [ArgInstance(min=1)],
[DEBUG_OPT, FORCE_OPT, OS_OPT,
m_force_multi,
m_node_opt, m_pri_node_opt, m_sec_node_opt,
m_clust_opt, m_inst_opt,
SELECT_OS_OPT,
SUBMIT_OPT,
],
"[-f] <instance>", "Reinstall a stopped instance"),
'remove': (RemoveInstance, ARGS_ONE_INSTANCE,
[DEBUG_OPT, FORCE_OPT, IGNORE_FAILURES_OPT, SUBMIT_OPT],
"[-f] <instance>", "Shuts down the instance and removes it"),
'rename': (RenameInstance,
[ArgInstance(min=1, max=1), ArgHost(min=1, max=1)],
[DEBUG_OPT, NOIPCHECK_OPT, SUBMIT_OPT],
"<instance> <new_name>", "Rename the instance"),
'replace-disks': (ReplaceDisks, ARGS_ONE_INSTANCE,
[DEBUG_OPT,
NEW_SECONDARY_OPT,
ON_PRIMARY_OPT,
ON_SECONDARY_OPT,
AUTO_REPLACE_OPT,
DISKIDX_OPT,
IALLOCATOR_OPT,
SUBMIT_OPT,
],
"[-s|-p|-n NODE|-I NAME] <instance>",
"Replaces all disks for the instance"),
'modify': (SetInstanceParams, ARGS_ONE_INSTANCE,
[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,
m_clust_opt, m_inst_opt, m_force_multi,
SUBMIT_OPT,
],
"<instance>", "Stops an instance"),
'startup': (StartupInstance, [ArgInstance(min=1)],
[DEBUG_OPT, FORCE_OPT, m_force_multi,
m_node_opt, m_pri_node_opt, m_sec_node_opt,
m_clust_opt, m_inst_opt,
SUBMIT_OPT,
HVOPTS_OPT,
BACKEND_OPT,
],
"<instance>", "Starts an instance"),
'reboot': (RebootInstance, [ArgInstance(min=1)],
[DEBUG_OPT, m_force_multi, REBOOT_TYPE_OPT,
IGNORE_SECONDARIES_OPT, m_node_opt, m_pri_node_opt,
m_sec_node_opt, m_clust_opt, m_inst_opt, SUBMIT_OPT,
],
"<instance>", "Reboots an instance"),
'activate-disks': (ActivateDisks, ARGS_ONE_INSTANCE,
[DEBUG_OPT, SUBMIT_OPT, IGNORE_SIZE_OPT],
"<instance>",
"Activate an instance's disks"),
'deactivate-disks': (DeactivateDisks, ARGS_ONE_INSTANCE,
[DEBUG_OPT, SUBMIT_OPT],
"<instance>",
"Deactivate an instance's disks"),
'recreate-disks': (RecreateDisks, ARGS_ONE_INSTANCE,
[DEBUG_OPT, SUBMIT_OPT, DISKIDX_OPT],
"<instance>",
"Recreate an instance's disks"),
'grow-disk': (GrowDisk,
[ArgInstance(min=1, max=1), ArgUnknown(min=1, max=1),
ArgUnknown(min=1, max=1)],
[DEBUG_OPT, SUBMIT_OPT, NWSYNC_OPT],
"<instance> <disk> <size>", "Grow an instance's disk"),
'list-tags': (ListTags, ARGS_ONE_INSTANCE, [DEBUG_OPT],
"<instance_name>", "List the tags of the given instance"),
'add-tags': (AddTags, [ArgInstance(min=1, max=1), ArgUnknown()],
[DEBUG_OPT, TAG_SRC_OPT],
"<instance_name> tag...", "Add tags to the given instance"),
'remove-tags': (RemoveTags, [ArgInstance(min=1, max=1), ArgUnknown()],
[DEBUG_OPT, TAG_SRC_OPT],
"<instance_name> tag...", "Remove tags from given instance"),
'add': (
AddInstance, [ArgHost(min=1, max=1)], add_opts,
"[...] -t disk-type -n node[:secondary-node] -o os-type <name>",
"Creates and adds a new instance to the cluster"),
'batch-create': (
BatchCreate, [ArgFile(min=1, max=1)],
[DEBUG_OPT],
"<instances.json>",
"Create a bunch of instances based on specs in the file."),
'console': (
ConnectToInstanceConsole, ARGS_ONE_INSTANCE,
[DEBUG_OPT, SHOWCMD_OPT],
"[--show-cmd] <instance>", "Opens a console on the specified instance"),
'failover': (
FailoverInstance, ARGS_ONE_INSTANCE,
[DEBUG_OPT, FORCE_OPT, IGNORE_CONSIST_OPT, SUBMIT_OPT],
"[-f] <instance>", "Stops the instance and starts it on the backup node,"
" using the remote mirror (only for instances of type drbd)"),
'migrate': (
MigrateInstance, ARGS_ONE_INSTANCE,
[DEBUG_OPT, FORCE_OPT, NONLIVE_OPT, CLEANUP_OPT],
"[-f] <instance>", "Migrate instance to its secondary node"
" (only for instances of type drbd)"),
'move': (
MoveInstance, ARGS_ONE_INSTANCE,
[DEBUG_OPT, FORCE_OPT, SUBMIT_OPT, SINGLE_NODE_OPT],
"[-f] <instance>", "Move instance to an arbitrary node"
" (only for instances of type file and lv)"),
'info': (
ShowInstanceConfig, ARGS_MANY_INSTANCES,
[DEBUG_OPT, STATIC_OPT, ALL_OPT],
"[-s] {--all | <instance>...}",
"Show information on the specified instance(s)"),
'list': (
ListInstances, ARGS_MANY_INSTANCES,
[DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT, SYNC_OPT],
"[<instance>...]",
"Lists the instances and their status. The available fields are"
" (see the man page for details): status, oper_state, oper_ram,"
" name, os, pnode, snodes, admin_state, admin_ram, disk_template,"
" ip, mac, mode, link, sda_size, sdb_size, vcpus, serial_no,"
" hypervisor."
" The default field"
" list is (in order): %s." % ", ".join(_LIST_DEF_FIELDS),
),
'reinstall': (
ReinstallInstance, [ArgInstance(min=1)],
[DEBUG_OPT, FORCE_OPT, OS_OPT, m_force_multi, m_node_opt, m_pri_node_opt,
m_sec_node_opt, m_clust_opt, m_inst_opt, SELECT_OS_OPT, SUBMIT_OPT],
"[-f] <instance>", "Reinstall a stopped instance"),
'remove': (
RemoveInstance, ARGS_ONE_INSTANCE,
[DEBUG_OPT, FORCE_OPT, IGNORE_FAILURES_OPT, SUBMIT_OPT],
"[-f] <instance>", "Shuts down the instance and removes it"),
'rename': (
RenameInstance,
[ArgInstance(min=1, max=1), ArgHost(min=1, max=1)],
[DEBUG_OPT, NOIPCHECK_OPT, SUBMIT_OPT],
"<instance> <new_name>", "Rename the instance"),
'replace-disks': (
ReplaceDisks, ARGS_ONE_INSTANCE,
[DEBUG_OPT, AUTO_REPLACE_OPT, DISKIDX_OPT, IALLOCATOR_OPT,
NEW_SECONDARY_OPT, ON_PRIMARY_OPT, ON_SECONDARY_OPT, SUBMIT_OPT],
"[-s|-p|-n NODE|-I NAME] <instance>",
"Replaces all disks for the instance"),
'modify': (
SetInstanceParams, ARGS_ONE_INSTANCE,
[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, m_clust_opt,
m_inst_opt, m_force_multi, SUBMIT_OPT],
"<instance>", "Stops an instance"),
'startup': (
StartupInstance, [ArgInstance(min=1)],
[DEBUG_OPT, FORCE_OPT, m_force_multi, m_node_opt, m_pri_node_opt,
m_sec_node_opt, m_clust_opt, m_inst_opt, SUBMIT_OPT, HVOPTS_OPT,
BACKEND_OPT],
"<instance>", "Starts an instance"),
'reboot': (
RebootInstance, [ArgInstance(min=1)],
[DEBUG_OPT, m_force_multi, REBOOT_TYPE_OPT, IGNORE_SECONDARIES_OPT,
m_node_opt, m_pri_node_opt, m_sec_node_opt, m_clust_opt, m_inst_opt,
SUBMIT_OPT],
"<instance>", "Reboots an instance"),
'activate-disks': (
ActivateDisks, ARGS_ONE_INSTANCE,
[DEBUG_OPT, SUBMIT_OPT, IGNORE_SIZE_OPT],
"<instance>", "Activate an instance's disks"),
'deactivate-disks': (
DeactivateDisks, ARGS_ONE_INSTANCE,
[DEBUG_OPT, SUBMIT_OPT],
"<instance>", "Deactivate an instance's disks"),
'recreate-disks': (
RecreateDisks, ARGS_ONE_INSTANCE,
[DEBUG_OPT, SUBMIT_OPT, DISKIDX_OPT],
"<instance>", "Recreate an instance's disks"),
'grow-disk': (
GrowDisk,
[ArgInstance(min=1, max=1), ArgUnknown(min=1, max=1),
ArgUnknown(min=1, max=1)],
[DEBUG_OPT, SUBMIT_OPT, NWSYNC_OPT],
"<instance> <disk> <size>", "Grow an instance's disk"),
'list-tags': (
ListTags, ARGS_ONE_INSTANCE, [DEBUG_OPT],
"<instance_name>", "List the tags of the given instance"),
'add-tags': (
AddTags, [ArgInstance(min=1, max=1), ArgUnknown()],
[DEBUG_OPT, TAG_SRC_OPT],
"<instance_name> tag...", "Add tags to the given instance"),
'remove-tags': (
RemoveTags, [ArgInstance(min=1, max=1), ArgUnknown()],
[DEBUG_OPT, TAG_SRC_OPT],
"<instance_name> tag...", "Remove tags from given instance"),
}
#: dictionary with aliases for commands
......
......@@ -343,31 +343,33 @@ def WatchJob(opts, args):
commands = {
'list': (ListJobs, [ArgJobId()],
[DEBUG_OPT, NOHDR_OPT, SEP_OPT, FIELDS_OPT],
"[job_id ...]",
"List the jobs and their status. The available fields are"
" (see the man page for details): id, status, op_list,"
" op_status, op_result."
" The default field"
" list is (in order): %s." % ", ".join(_LIST_DEF_FIELDS)),
'archive': (ArchiveJobs, [ArgJobId(min=1)], [DEBUG_OPT],
"<job-id> [<job-id> ...]",
"Archive specified jobs"),
'autoarchive': (AutoArchiveJobs,
[ArgSuggest(min=1, max=1, choices=["1d", "1w", "4w"])],
[DEBUG_OPT],
"<age>",
"Auto archive jobs older than the given age"),
'cancel': (CancelJobs, [ArgJobId(min=1)], [DEBUG_OPT],
"<job-id> [<job-id> ...]",
"Cancel specified jobs"),
'info': (ShowJobs, [ArgJobId(min=1)], [DEBUG_OPT],
"<job-id> [<job-id> ...]",
"Show detailed information about the specified jobs"),
'watch': (WatchJob, [ArgJobId(min=1, max=1)], [DEBUG_OPT],
"<job-id>",
"Follows a job and prints its output as it arrives"),
'list': (
ListJobs, [ArgJobId()],
[DEBUG_OPT, NOHDR_OPT, SEP_OPT, FIELDS_OPT],
"[job_id ...]",
"List the jobs and their status. The available fields are"
" (see the man page for details): id, status, op_list,"
" op_status, op_result."
" The default field"
" list is (in order): %s." % ", ".join(_LIST_DEF_FIELDS)),
'archive': (
ArchiveJobs, [ArgJobId(min=1)], [DEBUG_OPT],
"<job-id> [<job-id> ...]", "Archive specified jobs"),
'autoarchive': (
AutoArchiveJobs,
[ArgSuggest(min=1, max=1, choices=["1d", "1w", "4w"])],
[DEBUG_OPT],
"<age>", "Auto archive jobs older than the given age"),
'cancel': (
CancelJobs, [ArgJobId(min=1)], [DEBUG_OPT],
"<job-id> [<job-id> ...]", "Cancel specified jobs"),