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.
---
scripts/gnt-backup | 32 ++++---
scripts/gnt-cluster | 154 +++++++++++++++++----------------
scripts/gnt-debug | 101 ++++++++++-----------
scripts/gnt-instance | 235 +++++++++++++++++++++++++-------------------------
scripts/gnt-job | 52 ++++++------
scripts/gnt-node | 154 +++++++++++++++++----------------
scripts/gnt-os | 9 +-
7 files changed, 372 insertions(+), 365 deletions(-)
diff --git a/scripts/gnt-backup b/scripts/gnt-backup
index 71ecfc7..306928f 100755
--- a/scripts/gnt-backup
+++ b/scripts/gnt-backup
@@ -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."),
}
diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster
index 38dc5ad..2f35bd9 100755
--- a/scripts/gnt-cluster
+++ b/scripts/gnt-cluster
@@ -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__':
diff --git a/scripts/gnt-debug b/scripts/gnt-debug
index e8be29f..1514c16 100755
--- a/scripts/gnt-debug
+++ b/scripts/gnt-debug
@@ -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"),
}
diff --git a/scripts/gnt-instance b/scripts/gnt-instance
index 6bd2f2c..62da443 100755
--- a/scripts/gnt-instance
+++ b/scripts/gnt-instance
@@ -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
diff --git a/scripts/gnt-job b/scripts/gnt-job
index e6fcea5..84de3ae 100755
--- a/scripts/gnt-job
+++ b/scripts/gnt-job
@@ -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"),
+ '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"),
}
diff --git a/scripts/gnt-node b/scripts/gnt-node
index f35bc04..2c18bea 100755
--- a/scripts/gnt-node
+++ b/scripts/gnt-node
@@ -622,79 +622,87 @@ def SetNodeParams(opts, args):
commands = {
- 'add': (AddNode, [ArgHost(min=1, max=1)],
- [DEBUG_OPT,
- SECONDARY_IP_OPT,
- READD_OPT,
- NOSSH_KEYCHECK_OPT,
- ],
- "[-s ip] [--readd] [--no-ssh-key-check] <node_name>",
- "Add a node to the cluster"),
- 'evacuate': (EvacuateNode, ARGS_ONE_NODE,
- [DEBUG_OPT, FORCE_OPT, IALLOCATOR_OPT, NEW_SECONDARY_OPT],
- "[-f] {-I <iallocator> | -n <dst>} <node>",
- "Relocate the secondary instances from a node"
- " to other nodes (only for instances with drbd disk template)"),
- 'failover': (FailoverNode, ARGS_ONE_NODE,
- [DEBUG_OPT, FORCE_OPT, IGNORE_CONSIST_OPT],
- "[-f] <node>",
- "Stops the primary instances on a node and start them on their"
- " secondary node (only for instances with drbd disk template)"),
- 'migrate': (MigrateNode, ARGS_ONE_NODE,
- [DEBUG_OPT, FORCE_OPT, NONLIVE_OPT],
- "[-f] <node>",
- "Migrate all the primary instance on a node away from it"
- " (only for instances of type drbd)"),
- 'info': (ShowNodeConfig, ARGS_MANY_NODES, [DEBUG_OPT],
- "[<node_name>...]", "Show information about the node(s)"),
- 'list': (ListNodes, ARGS_MANY_NODES,
- [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT, SYNC_OPT],
- "[nodes...]",
- "Lists the nodes in the cluster. The available fields"
- " are (see the man page for details): %s"
- " The default field list is (in order): %s." %
- (", ".join(_LIST_HEADERS), ", ".join(_LIST_DEF_FIELDS))),
- 'modify': (SetNodeParams, ARGS_ONE_NODE,
- [DEBUG_OPT, FORCE_OPT,
- SUBMIT_OPT, MC_OPT, DRAINED_OPT, OFFLINE_OPT],
- "<node_name>", "Alters the parameters of a node"),
- 'powercycle': (PowercycleNode, ARGS_ONE_NODE,
- [DEBUG_OPT, FORCE_OPT, CONFIRM_OPT],
- "<node_name>", "Tries to forcefully powercycle a node"),
- 'remove': (RemoveNode, ARGS_ONE_NODE, [DEBUG_OPT],
- "<node_name>", "Removes a node from the cluster"),
- 'volumes': (ListVolumes, [ArgNode()],
- [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT],
- "[<node_name>...]", "List logical volumes on node(s)"),
- 'physical-volumes': (ListPhysicalVolumes, ARGS_MANY_NODES,
- [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT,
- FIELDS_OPT, _STORAGE_TYPE_OPT],
- "[<node_name>...]",
- "List physical volumes on node(s)"),
- 'modify-volume': (ModifyVolume,
- [ArgNode(min=1, max=1),
- ArgChoice(min=1, max=1,
- choices=_MODIFIABLE_STORAGE_TYPES),
- ArgFile(min=1, max=1)],
- [DEBUG_OPT, ALLOCATABLE_OPT],
- "<node_name> <storage_type> <name>",
- "Modify storage volume on a node"),
- 'repair-volume': (RepairVolume,
- [ArgNode(min=1, max=1),
- ArgChoice(min=1, max=1,
- choices=_REPAIRABLE_STORAGE_TYPES),
- ArgFile(min=1, max=1)],
- [DEBUG_OPT],
- "<node_name> <storage_type> <name>",
- "Repairs a storage volume on a node"),
- 'list-tags': (ListTags, ARGS_ONE_NODE, [DEBUG_OPT],
- "<node_name>", "List the tags of the given node"),
- 'add-tags': (AddTags, [ArgNode(min=1, max=1), ArgUnknown()],
- [DEBUG_OPT, TAG_SRC_OPT],
- "<node_name> tag...", "Add tags to the given node"),
- 'remove-tags': (RemoveTags, [ArgNode(min=1, max=1), ArgUnknown()],
- [DEBUG_OPT, TAG_SRC_OPT],
- "<node_name> tag...", "Remove tags from the given node"),
+ 'add': (
+ AddNode, [ArgHost(min=1, max=1)],
+ [DEBUG_OPT, SECONDARY_IP_OPT, READD_OPT, NOSSH_KEYCHECK_OPT],
+ "[-s ip] [--readd] [--no-ssh-key-check] <node_name>",
+ "Add a node to the cluster"),
+ 'evacuate': (
+ EvacuateNode, ARGS_ONE_NODE,
+ [DEBUG_OPT, FORCE_OPT, IALLOCATOR_OPT, NEW_SECONDARY_OPT],
+ "[-f] {-I <iallocator> | -n <dst>} <node>",
+ "Relocate the secondary instances from a node"
+ " to other nodes (only for instances with drbd disk template)"),
+ 'failover': (
+ FailoverNode, ARGS_ONE_NODE,
+ [DEBUG_OPT, FORCE_OPT, IGNORE_CONSIST_OPT],
+ "[-f] <node>",
+ "Stops the primary instances on a node and start them on their"
+ " secondary node (only for instances with drbd disk template)"),
+ 'migrate': (
+ MigrateNode, ARGS_ONE_NODE,
+ [DEBUG_OPT, FORCE_OPT, NONLIVE_OPT],
+ "[-f] <node>",
+ "Migrate all the primary instance on a node away from it"
+ " (only for instances of type drbd)"),
+ 'info': (
+ ShowNodeConfig, ARGS_MANY_NODES, [DEBUG_OPT],
+ "[<node_name>...]", "Show information about the node(s)"),
+ 'list': (
+ ListNodes, ARGS_MANY_NODES,
+ [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT, SYNC_OPT],
+ "[nodes...]",
+ "Lists the nodes in the cluster. The available fields are (see the man"
+ " page for details): %s. The default field list is (in order): %s." %
+ (", ".join(_LIST_HEADERS), ", ".join(_LIST_DEF_FIELDS))),
+ 'modify': (
+ SetNodeParams, ARGS_ONE_NODE,
+ [DEBUG_OPT, FORCE_OPT, SUBMIT_OPT, MC_OPT, DRAINED_OPT, OFFLINE_OPT],
+ "<node_name>", "Alters the parameters of a node"),
+ 'powercycle': (
+ PowercycleNode, ARGS_ONE_NODE,
+ [DEBUG_OPT, FORCE_OPT, CONFIRM_OPT],
+ "<node_name>", "Tries to forcefully powercycle a node"),
+ 'remove': (
+ RemoveNode, ARGS_ONE_NODE, [DEBUG_OPT],
+ "<node_name>", "Removes a node from the cluster"),
+ 'volumes': (
+ ListVolumes, [ArgNode()],
+ [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT],
+ "[<node_name>...]", "List logical volumes on node(s)"),
+ 'physical-volumes': (
+ ListPhysicalVolumes, ARGS_MANY_NODES,
+ [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT,
+ FIELDS_OPT, _STORAGE_TYPE_OPT],
+ "[<node_name>...]",
+ "List physical volumes on node(s)"),
+ 'modify-volume': (
+ ModifyVolume,
+ [ArgNode(min=1, max=1),
+ ArgChoice(min=1, max=1, choices=_MODIFIABLE_STORAGE_TYPES),
+ ArgFile(min=1, max=1)],
+ [DEBUG_OPT, ALLOCATABLE_OPT],
+ "<node_name> <storage_type> <name>",
+ "Modify storage volume on a node"),
+ 'repair-volume': (
+ RepairVolume,
+ [ArgNode(min=1, max=1),
+ ArgChoice(min=1, max=1, choices=_REPAIRABLE_STORAGE_TYPES),
+ ArgFile(min=1, max=1)],
+ [DEBUG_OPT],
+ "<node_name> <storage_type> <name>",
+ "Repairs a storage volume on a node"),
+ 'list-tags': (
+ ListTags, ARGS_ONE_NODE, [DEBUG_OPT],
+ "<node_name>", "List the tags of the given node"),
+ 'add-tags': (
+ AddTags, [ArgNode(min=1, max=1), ArgUnknown()],
+ [DEBUG_OPT, TAG_SRC_OPT],
+ "<node_name> tag...", "Add tags to the given node"),
+ 'remove-tags': (
+ RemoveTags, [ArgNode(min=1, max=1), ArgUnknown()],
+ [DEBUG_OPT, TAG_SRC_OPT],
+ "<node_name> tag...", "Remove tags from the given node"),
}
diff --git a/scripts/gnt-os b/scripts/gnt-os
index 1e2550f..4d566b1 100755
--- a/scripts/gnt-os
+++ b/scripts/gnt-os
@@ -145,10 +145,11 @@ def DiagnoseOS(opts, args):
commands = {
- 'list': (ListOS, ARGS_NONE, [DEBUG_OPT, NOHDR_OPT], "",
- "Lists all valid OSes on the master"),
- 'diagnose': (DiagnoseOS, ARGS_NONE, [DEBUG_OPT], "",
- "Diagnose all OSes"),
+ 'list': (
+ ListOS, ARGS_NONE, [DEBUG_OPT, NOHDR_OPT],
+ "", "Lists all valid OSes on the master"),
+ 'diagnose': (
+ DiagnoseOS, ARGS_NONE, [DEBUG_OPT], "", "Diagnose all OSes"),
}
if __name__ == '__main__':
--
1.6.3.3