- '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,
- cli_option("--show-cmd", dest="show_command",
- action="store_true", default=False,
- help=("Show command instead of executing it"))],
- "[--show-cmd] <instance>",
- "Opens a console on the specified instance"),
- 'failover': (FailoverInstance, ARGS_ONE_INSTANCE,
- [DEBUG_OPT, FORCE_OPT,
- cli_option("--ignore-consistency", dest="ignore_consistency",
- action="store_true", default=False,
- help="Ignore the consistency of the disks on"
- " the secondary"),
- 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,
- cli_option("--non-live", dest="live",
- default=True, action="store_false",
- help="Do a non-live migration (this usually means"
- " freeze the instance, save the state,"
- " transfer and only then resume running on the"
- " secondary node)"),
- cli_option("--cleanup", dest="cleanup",
- default=False, action="store_true",
- help="Instead of performing the migration, try to"
- " recover from a failed cleanup. This is safe"
- " to run even if the instance is healthy, but it"
- " will create extra replication traffic and "
- " disrupt briefly the replication (like during the"
- " migration"),
- ],
- "[-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,
- cli_option("-n", "--new-node", dest="target_node",
- help="Destinattion node", metavar="NODE",
- default=None,
- completion_suggest=OPT_COMPL_ONE_NODE),
- ],
- "[-f] <instance>",
- "Move instance to an arbitrary node"
- " (only for instances of type file and lv)"),
- 'info': (ShowInstanceConfig, ARGS_MANY_INSTANCES,
- [DEBUG_OPT,
- cli_option("-s", "--static", dest="static",
- action="store_true", default=False,
- help="Only show configuration data, not runtime data"),
- cli_option("--all", dest="show_all",
- default=False, action="store_true",
- help="Show info on all instances on the cluster."
- " This can take a long time to run, use wisely."),
- ], "[-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,
- cli_option("--select-os", dest="select_os",
- action="store_true", default=False,
- help="Interactive OS reinstall, lists available"
- " OS templates for selection"),
- SUBMIT_OPT,
- ],
- "[-f] <instance>", "Reinstall a stopped instance"),
- 'remove': (RemoveInstance, ARGS_ONE_INSTANCE,
- [DEBUG_OPT, FORCE_OPT,
- cli_option("--ignore-failures", dest="ignore_failures",
- action="store_true", default=False,
- help=("Remove the instance from the cluster even"
- " if there are failures during the removal"
- " process (shutdown, disk removal, etc.)")),
- 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,
- cli_option("--no-ip-check", dest="ignore_ip",
- help="Do not check that the IP of the new name"
- " is alive",
- default=False, action="store_true"),
- SUBMIT_OPT,
- ],
- "<instance> <new_name>", "Rename the instance"),
- 'replace-disks': (ReplaceDisks, ARGS_ONE_INSTANCE,
- [DEBUG_OPT,
- cli_option("-n", "--new-secondary", dest="new_secondary",
- help=("New secondary node (for secondary"
- " node change)"), metavar="NODE",
- 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"
- " node (only for the drbd template)")),
- cli_option("-s", "--on-secondary", dest="on_secondary",
- default=False, action="store_true",
- help=("Replace the disk(s) on the secondary"
- " node (only for the drbd template)")),
- cli_option("-a", "--auto", dest="auto",
- default=False, action="store_true",
- help=("Automatically replace faulty disks"
- " (only for the drbd template)")),
- cli_option("--disks", dest="disks", default=None,
- help="Comma-separated list of disks"
- " indices to replace (e.g. 0,2) (optional,"
- " defaults to all disks)"),
- IALLOCATOR_OPT,
- SUBMIT_OPT,
- ],
- "[-s|-p|-n NODE|-I NAME] <instance>",
- "Replaces all disks for the instance"),
- 'modify': (SetInstanceParams, ARGS_ONE_INSTANCE,
- [DEBUG_OPT, FORCE_OPT,
- HVOPTS_OPT,
- BACKEND_OPT,
- cli_option("--disk", help="Disk changes",
- default=[], dest="disks",
- action="append",
- type="identkeyval"),
- cli_option("--net", help="NIC changes",
- default=[], dest="nics",
- action="append",
- type="identkeyval"),
- 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,
- cli_option("-t", "--type", dest="reboot_type",
- help="Type of reboot: soft/hard/full",
- default=constants.INSTANCE_REBOOT_HARD,
- metavar="<REBOOT>",
- choices=list(constants.REBOOT_TYPES)),
- cli_option("--ignore-secondaries", dest="ignore_secondaries",
- default=False, action="store_true",
- help="Ignore errors from secondaries"),
- 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,
- cli_option("--ignore-size", dest="ignore_size",
- default=False, action="store_true",
- help="Ignore current recorded size"
- " (useful for forcing activation when"
- " the recorded size is wrong)"),
- ],
- "<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,
- cli_option("--disks", dest="disks", default=None,
- help="Comma-separated list of disks"
- " indices to replace (e.g. 0,2) (optional,"
- " defaults to all disks)"),
- ],
- "<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)], [],
+ "<instances.json>",
+ "Create a bunch of instances based on specs in the file."),
+ 'console': (
+ ConnectToInstanceConsole, ARGS_ONE_INSTANCE,
+ [SHOWCMD_OPT],
+ "[--show-cmd] <instance>", "Opens a console on the specified instance"),
+ 'failover': (
+ FailoverInstance, ARGS_ONE_INSTANCE,
+ [FORCE_OPT, IGNORE_CONSIST_OPT, SUBMIT_OPT, SHUTDOWN_TIMEOUT_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,
+ [FORCE_OPT, NONLIVE_OPT, MIGRATION_MODE_OPT, CLEANUP_OPT],
+ "[-f] <instance>", "Migrate instance to its secondary node"
+ " (only for instances of type drbd)"),
+ 'move': (
+ MoveInstance, ARGS_ONE_INSTANCE,
+ [FORCE_OPT, SUBMIT_OPT, SINGLE_NODE_OPT, SHUTDOWN_TIMEOUT_OPT],
+ "[-f] <instance>", "Move instance to an arbitrary node"
+ " (only for instances of type file and lv)"),
+ 'info': (
+ ShowInstanceConfig, ARGS_MANY_INSTANCES,
+ [STATIC_OPT, ALL_OPT, ROMAN_OPT],
+ "[-s] {--all | <instance>...}",
+ "Show information on the specified instance(s)"),
+ 'list': (
+ ListInstances, ARGS_MANY_INSTANCES,
+ [NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT, SYNC_OPT, ROMAN_OPT],
+ "[<instance>...]",
+ "Lists the instances and their status. The available fields are"
+ " (see the man page for details): status, oper_state, oper_ram,"
+ " oper_vcpus, name, os, pnode, snodes, admin_state, admin_ram,"
+ " disk_template, ip, mac, nic_mode, nic_link, sda_size, sdb_size,"
+ " vcpus, serial_no,"
+ " nic.count, nic.mac/N, nic.ip/N, nic.mode/N, nic.link/N,"
+ " nic.macs, nic.ips, nic.modes, nic.links,"
+ " disk.count, disk.size/N, disk.sizes,"
+ " hv/NAME, be/memory, be/vcpus, be/auto_balance,"
+ " hypervisor."
+ " The default field"
+ " list is (in order): %s." % utils.CommaJoin(_LIST_DEF_FIELDS),
+ ),
+ 'reinstall': (
+ ReinstallInstance, [ArgInstance()],
+ [FORCE_OPT, OS_OPT, FORCE_VARIANT_OPT, m_force_multi, m_node_opt,
+ m_pri_node_opt, m_sec_node_opt, m_clust_opt, m_inst_opt, m_node_tags_opt,
+ m_pri_node_tags_opt, m_sec_node_tags_opt, m_inst_tags_opt, SELECT_OS_OPT,
+ SUBMIT_OPT],
+ "[-f] <instance>", "Reinstall a stopped instance"),
+ 'remove': (
+ RemoveInstance, ARGS_ONE_INSTANCE,
+ [FORCE_OPT, SHUTDOWN_TIMEOUT_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)],
+ [NOIPCHECK_OPT, NONAMECHECK_OPT, SUBMIT_OPT],
+ "<instance> <new_name>", "Rename the instance"),
+ 'replace-disks': (
+ ReplaceDisks, ARGS_ONE_INSTANCE,
+ [AUTO_REPLACE_OPT, DISKIDX_OPT, IALLOCATOR_OPT, EARLY_RELEASE_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, DISK_OPT, FORCE_OPT, HVOPTS_OPT, NET_OPT, SUBMIT_OPT,
+ DISK_TEMPLATE_OPT, SINGLE_NODE_OPT, OS_OPT, FORCE_VARIANT_OPT,
+ OSPARAMS_OPT],
+ "<instance>", "Alters the parameters of an instance"),
+ 'shutdown': (
+ GenericManyOps("shutdown", _ShutdownInstance), [ArgInstance()],
+ [m_node_opt, m_pri_node_opt, m_sec_node_opt, m_clust_opt,
+ m_node_tags_opt, m_pri_node_tags_opt, m_sec_node_tags_opt,
+ m_inst_tags_opt, m_inst_opt, m_force_multi, TIMEOUT_OPT, SUBMIT_OPT],
+ "<instance>", "Stops an instance"),
+ 'startup': (
+ GenericManyOps("startup", _StartupInstance), [ArgInstance()],
+ [FORCE_OPT, m_force_multi, m_node_opt, m_pri_node_opt, m_sec_node_opt,
+ m_node_tags_opt, m_pri_node_tags_opt, m_sec_node_tags_opt,
+ m_inst_tags_opt, m_clust_opt, m_inst_opt, SUBMIT_OPT, HVOPTS_OPT,
+ BACKEND_OPT],
+ "<instance>", "Starts an instance"),
+ 'reboot': (
+ GenericManyOps("reboot", _RebootInstance), [ArgInstance()],
+ [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,
+ m_node_tags_opt, m_pri_node_tags_opt, m_sec_node_tags_opt,
+ m_inst_tags_opt, SHUTDOWN_TIMEOUT_OPT],
+ "<instance>", "Reboots an instance"),
+ 'activate-disks': (
+ ActivateDisks, ARGS_ONE_INSTANCE, [SUBMIT_OPT, IGNORE_SIZE_OPT],
+ "<instance>", "Activate an instance's disks"),
+ 'deactivate-disks': (
+ DeactivateDisks, ARGS_ONE_INSTANCE, [SUBMIT_OPT],
+ "<instance>", "Deactivate an instance's disks"),
+ 'recreate-disks': (
+ RecreateDisks, ARGS_ONE_INSTANCE, [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)],
+ [SUBMIT_OPT, NWSYNC_OPT],
+ "<instance> <disk> <size>", "Grow an instance's disk"),
+ 'list-tags': (
+ ListTags, ARGS_ONE_INSTANCE, [],
+ "<instance_name>", "List the tags of the given instance"),
+ 'add-tags': (
+ AddTags, [ArgInstance(min=1, max=1), ArgUnknown()],
+ [TAG_SRC_OPT],
+ "<instance_name> tag...", "Add tags to the given instance"),
+ 'remove-tags': (
+ RemoveTags, [ArgInstance(min=1, max=1), ArgUnknown()],
+ [TAG_SRC_OPT],
+ "<instance_name> tag...", "Remove tags from given instance"),