Package ganeti :: Module cli
[hide private]
[frames] | no frames]

Module cli

source code

Module dealing with command line parsing

Classes [hide private]
  _Argument
  ArgSuggest
Suggesting argument.
  ArgChoice
Choice argument.
  ArgUnknown
Unknown argument to program (e.g.
  ArgInstance
Instances argument.
  ArgNode
Node argument.
  ArgNetwork
Network argument.
  ArgGroup
Node group argument.
  ArgJobId
Job ID argument.
  ArgFile
File path argument.
  ArgCommand
Command argument.
  ArgHost
Host argument.
  ArgOs
OS argument.
  ArgExtStorage
ExtStorage argument.
  CliOption
Custom option class for optparse.
  cli_option
Custom option class for optparse.
  _ShowUsage
Exception class for _ParseArgs.
  _ShowVersion
Exception class for _ParseArgs.
  JobSubmittedException
Job was submitted, client should exit.
  JobPollCbBase
Base class for GenericPollJob callbacks.
  JobPollReportCbBase
Base class for GenericPollJob reporting callbacks.
  _LuxiJobPollCb
  FeedbackFnJobPollReportCb
  StdioJobPollReportCb
  _RunWhileClusterStoppedHelper
Helper class for RunWhileClusterStopped to simplify state management
  _QueryColumnFormatter
Callable class for formatting fields of a query.
  TableColumn
Describes a column for FormatTable.
  JobExecutor
Class which manages the submission and execution of multiple jobs.
Functions [hide private]
 
_ExtractTagsObject(opts, args)
Extract the tag type object.
source code
 
_ExtendTags(opts, args)
Extend the args if a source file has been given.
source code
 
ListTags(opts, args)
List the tags on a given object.
source code
 
AddTags(opts, args)
Add tags on a given object.
source code
 
RemoveTags(opts, args)
Remove tags from a given object.
source code
 
check_unit(option, opt, value)
OptParsers custom converter for units.
source code
dict
_SplitKeyVal(opt, data, parse_prefixes)
Convert a KeyVal string into a dict.
source code
tuple
_SplitIdentKeyVal(opt, value, parse_prefixes)
Helper function to parse "ident:key=val,key=val" options.
source code
 
check_ident_key_val(option, opt, value)
Custom parser for ident:key=val,key=val options.
source code
 
check_key_val(option, opt, value)
Custom parser class for key=val,key=val options.
source code
 
_SplitListKeyVal(opt, value) source code
list of dictionary
check_multilist_ident_key_val(_, opt, value)
Custom parser for "ident:key=val,key=val/ident:key=val//ident:.." options.
source code
 
check_bool(option, opt, value)
Custom parser for yes/no options.
source code
 
check_list(option, opt, value)
Custom parser for comma-separated lists.
source code
 
check_maybefloat(option, opt, value)
Custom parser for float numbers which might be also defaults.
source code
 
_PriorityOptionCb(option, _, value, parser)
Callback for processing --priority option.
source code
 
_ParseArgs(binary, argv, commands, aliases, env_override)
Parser for the command line arguments.
source code
 
_FormatUsage(binary, commands)
Generates a nice description of all commands.
source code
 
_CheckArguments(cmd, args_def, args)
Verifies the arguments using the argument definition.
source code
 
SplitNodeOption(value)
Splits the value of a --node option.
source code
list
CalculateOSNames(os_name, os_variants)
Calculates all the names an OS can be called, according to its variants.
source code
 
ParseFields(selected, default)
Parses the values of "--field"-like options.
source code
 
UsesRPC(fn)
RPC-wrapper decorator.
source code
 
AskUser(text, choices=None)
Ask the user a question.
source code
 
SendJob(ops, cl=None)
Function to submit an opcode without waiting for the results.
source code
 
GenericPollJob(job_id, cbs, report_cbs)
Generic job-polling function.
source code
 
FormatLogMessage(log_type, log_msg)
Formats a job message according to its type.
source code
 
PollJob(job_id, cl=None, feedback_fn=None, reporter=None)
Function to poll for the result of a job.
source code
 
SubmitOpCode(op, cl=None, feedback_fn=None, opts=None, reporter=None)
Legacy function to submit an opcode.
source code
 
SubmitOrSend(op, opts, cl=None, feedback_fn=None)
Wrapper around SubmitOpCode or SendJob.
source code
 
_InitReasonTrail(op, opts)
Builds the first part of the reason trail
source code
 
SetGenericOpcodeOpts(opcode_list, options)
Processor for generic options.
source code
 
GetClient(query=False)
Connects to the a luxi socket and returns a client.
source code
 
FormatError(err)
Return a formatted error message for a given error.
source code
 
GenericMain(commands, override=None, aliases=None, env_override=frozenset())
Generic main function for all the gnt-* commands.
source code
 
ParseNicOption(optvalue)
Parses the value of the --net option(s).
source code
 
FixHvParams(hvparams) source code
int
GenericInstanceCreate(mode, opts, args)
Add an instance to the cluster via either creation or import.
source code
 
RunWhileClusterStopped(feedback_fn, fn, *args)
Calls a function while all cluster daemons are stopped.
source code
 
GenerateTable(headers, fields, separator, data, numfields=None, unitfields=None, units=None)
Prints a table with headers and different fields.
source code
 
_FormatBool(value)
Formats a boolean value as a string.
source code
tuple; (callable, bool)
_GetColumnFormatter(fdef, override, unit)
Returns formatting function for a field.
source code
 
FormatResultError(status, verbose)
Formats result status other than constants.RS_NORMAL.
source code
 
FormatQueryResult(result, unit=None, format_override=None, separator=None, header=False, verbose=False)
Formats data in objects.QueryResponse.
source code
 
_GetUnknownFields(fdefs)
Returns list of unknown fields included in fdefs.
source code
 
_WarnUnknownFields(fdefs)
Prints a warning to stderr if a query included unknown fields.
source code
 
GenericList(resource, fields, names, unit, separator, header, cl=None, format_override=None, verbose=False, force_filter=False, namefield=None, qfilter=None, isnumeric=False)
Generic implementation for listing all items of a resource.
source code
list
_FieldDescValues(fdef)
Helper function for GenericListFields to get query field description.
source code
 
GenericListFields(resource, fields, separator, header, cl=None)
Generic implementation for listing fields for a resource.
source code
 
_GetColFormatString(width, align_right)
Returns the format string for a field.
source code
 
FormatTable(rows, columns, header, separator)
Formats data as a table.
source code
string
FormatTimestamp(ts)
Formats a given timestamp.
source code
 
ParseTimespec(value)
Parse a time specification.
source code
 
GetOnlineNodes(nodes, cl=None, nowarn=False, secondary_ips=False, filter_master=False, nodegroup=None)
Returns the names of online nodes.
source code
 
_ToStream(stream, txt, *args)
Write a message to a stream, bypassing the logging system
source code
 
ToStdout(txt, *args)
Write a message to stdout only, bypassing the logging system
source code
 
ToStderr(txt, *args)
Write a message to stderr only, bypassing the logging system
source code
dict
FormatParamsDictInfo(param_dict, actual)
Formats a parameter dictionary.
source code
 
_FormatListInfoDefault(data, def_data) source code
list of pairs
FormatPolicyInfo(custom_ipolicy, eff_ipolicy, iscluster)
Formats an instance policy.
source code
 
_PrintSpecsParameters(buf, specs) source code
 
PrintIPolicyCommand(buf, ipolicy, isgroup)
Print the command option used to generate the given instance policy.
source code
boolean
ConfirmOperation(names, list_type, text, extra="")
Ask the user to confirm an operation on a list of list_type.
source code
 
_MaybeParseUnit(elements)
Parses and returns an array of potential values with units.
source code
 
_InitISpecsFromSplitOpts(ipolicy, ispecs_mem_size, ispecs_cpu_count, ispecs_disk_count, ispecs_disk_size, ispecs_nic_count, group_ipolicy, fill_all) source code
 
_ParseSpecUnit(spec, keyname) source code
 
_ParseISpec(spec, keyname, required) source code
 
_GetISpecsInAllowedValues(minmax_ispecs, allowed_values) source code
 
_InitISpecsFromFullOpts(ipolicy_out, minmax_ispecs, std_ispecs, group_ipolicy, allowed_values) source code
 
CreateIPolicyFromOpts(ispecs_mem_size=None, ispecs_cpu_count=None, ispecs_disk_count=None, ispecs_disk_size=None, ispecs_nic_count=None, minmax_ispecs=None, std_ispecs=None, ipolicy_disk_templates=None, ipolicy_vcpu_ratio=None, ipolicy_spindle_ratio=None, group_ipolicy=False, allowed_values=None, fill_all=False)
Creation of instance policy based on command line options.
source code
 
_SerializeGenericInfo(buf, data, level, afterkey=False)
Formatting core of PrintGenericInfo.
source code
 
PrintGenericInfo(data)
Print information formatted according to the hierarchy.
source code
Variables [hide private]
  NO_PREFIX = "no_"
  UN_PREFIX = "-"
  _PRIORITY_NAMES = [("low", constants.OP_PRIO_LOW), ("normal", ...
Priorities (sorted)
  _PRIONAME_TO_VALUE = dict(_PRIORITY_NAMES)
Priority dictionary for easier lookup
  _CHOOSE_BATCH = 25
Maximum batch size for ChooseJob
  TISPECS_GROUP_TYPES = {constants.ISPECS_MIN: constants.VTYPE_I...
  TISPECS_CLUSTER_TYPES = {constants.ISPECS_MIN: constants.VTYPE...
  _QFT_NAMES = {constants.QFT_UNKNOWN: "Unknown", constants.QFT_...
User-friendly names for query2 field types
  ARGS_NONE = []
  ARGS_MANY_INSTANCES = [ArgInstance()]
  ARGS_MANY_NETWORKS = [ArgNetwork()]
  ARGS_MANY_NODES = [ArgNode()]
  ARGS_MANY_GROUPS = [ArgGroup()]
  ARGS_ONE_INSTANCE = [ArgInstance(min= 1, max= 1)]
  ARGS_ONE_NETWORK = [ArgNetwork(min= 1, max= 1)]
  ARGS_ONE_NODE = [ArgNode(min= 1, max= 1)]
  ARGS_ONE_GROUP = [ArgGroup(min= 1, max= 1)]
  ARGS_ONE_OS = [ArgOs(min= 1, max= 1)]
  OPT_COMPL_ALL = compat.UniqueFrozenset([OPT_COMPL_MANY_NODES, ...
  _YORNO = "yes|no"
  DEBUG_OPT = cli_option("-d", "--debug", default= 0, action= "c...
  NOHDR_OPT = cli_option("--no-headers", default= False, action=...
  SEP_OPT = cli_option("--separator", default= None, action= "st...
  USEUNITS_OPT = cli_option("--units", default= None, dest= "uni...
  FIELDS_OPT = cli_option("-o", "--output", dest= "output", acti...
  FORCE_OPT = cli_option("-f", "--force", dest= "force", action=...
  CONFIRM_OPT = cli_option("--yes", dest= "confirm", action= "st...
  IGNORE_OFFLINE_OPT = cli_option("--ignore-offline", dest= "ign...
  TAG_ADD_OPT = cli_option("--tags", dest= "tags", default= None...
  TAG_SRC_OPT = cli_option("--from", dest= "tags_source", defaul...
  SUBMIT_OPT = cli_option("--submit", dest= "submit_only", defau...
  SYNC_OPT = cli_option("--sync", dest= "do_locking", default= F...
  DRY_RUN_OPT = cli_option("--dry-run", default= False, action= ...
  VERBOSE_OPT = cli_option("-v", "--verbose", default= False, ac...
  DEBUG_SIMERR_OPT = cli_option("--debug-simulate-errors", defau...
  NWSYNC_OPT = cli_option("--no-wait-for-sync", dest= "wait_for_...
  WFSYNC_OPT = cli_option("--wait-for-sync", dest= "wait_for_syn...
  ONLINE_INST_OPT = cli_option("--online", dest= "online_inst", ...
  OFFLINE_INST_OPT = cli_option("--offline", dest= "offline_inst...
  DISK_TEMPLATE_OPT = cli_option("-t", "--disk-template", dest= ...
  NONICS_OPT = cli_option("--no-nics", default= False, action= "...
  FILESTORE_DIR_OPT = cli_option("--file-storage-dir", dest= "fi...
  FILESTORE_DRIVER_OPT = cli_option("--file-driver", dest= "file...
  IALLOCATOR_OPT = cli_option("-I", "--iallocator", metavar= "<N...
  DEFAULT_IALLOCATOR_OPT = cli_option("-I", "--default-iallocato...
  OS_OPT = cli_option("-o", "--os-type", dest= "os", help= "What...
  OSPARAMS_OPT = cli_option("-O", "--os-parameters", dest= "ospa...
  FORCE_VARIANT_OPT = cli_option("--force-variant", dest= "force...
  NO_INSTALL_OPT = cli_option("--no-install", dest= "no_install"...
  NORUNTIME_CHGS_OPT = cli_option("--no-runtime-changes", dest= ...
  BACKEND_OPT = cli_option("-B", "--backend-parameters", dest= "...
  HVOPTS_OPT = cli_option("-H", "--hypervisor-parameters", type=...
  DISK_PARAMS_OPT = cli_option("-D", "--disk-parameters", dest= ...
  SPECS_MEM_SIZE_OPT = cli_option("--specs-mem-size", dest= "isp...
  SPECS_CPU_COUNT_OPT = cli_option("--specs-cpu-count", dest= "i...
  SPECS_DISK_COUNT_OPT = cli_option("--specs-disk-count", dest= ...
  SPECS_DISK_SIZE_OPT = cli_option("--specs-disk-size", dest= "i...
  SPECS_NIC_COUNT_OPT = cli_option("--specs-nic-count", dest= "i...
  IPOLICY_BOUNDS_SPECS_STR = "--ipolicy-bounds-specs"
  IPOLICY_BOUNDS_SPECS_OPT = cli_option(IPOLICY_BOUNDS_SPECS_STR...
  IPOLICY_STD_SPECS_STR = "--ipolicy-std-specs"
  IPOLICY_STD_SPECS_OPT = cli_option(IPOLICY_STD_SPECS_STR, dest...
  IPOLICY_DISK_TEMPLATES = cli_option("--ipolicy-disk-templates"...
  IPOLICY_VCPU_RATIO = cli_option("--ipolicy-vcpu-ratio", dest= ...
  IPOLICY_SPINDLE_RATIO = cli_option("--ipolicy-spindle-ratio", ...
  HYPERVISOR_OPT = cli_option("-H", "--hypervisor-parameters", d...
  HVLIST_OPT = cli_option("-H", "--hypervisor-parameters", dest=...
  NOIPCHECK_OPT = cli_option("--no-ip-check", dest= "ip_check", ...
  NONAMECHECK_OPT = cli_option("--no-name-check", dest= "name_ch...
  NET_OPT = cli_option("--net", help= "NIC parameters", default=...
  DISK_OPT = cli_option("--disk", help= "Disk parameters", defau...
  DISKIDX_OPT = cli_option("--disks", dest= "disks", default= No...
  OS_SIZE_OPT = cli_option("-s", "--os-size", dest= "sd_size", h...
  IGNORE_CONSIST_OPT = cli_option("--ignore-consistency", dest= ...
  ALLOW_FAILOVER_OPT = cli_option("--allow-failover", dest= "all...
  NONLIVE_OPT = cli_option("--non-live", dest= "live", default= ...
  MIGRATION_MODE_OPT = cli_option("--migration-mode", dest= "mig...
  NODE_PLACEMENT_OPT = cli_option("-n", "--node", dest= "node", ...
  NODE_LIST_OPT = cli_option("-n", "--node", dest= "nodes", defa...
  NODEGROUP_OPT_NAME = "--node-group"
  NODEGROUP_OPT = cli_option("-g", NODEGROUP_OPT_NAME, dest= "no...
  SINGLE_NODE_OPT = cli_option("-n", "--node", dest= "node", hel...
  NOSTART_OPT = cli_option("--no-start", dest= "start", default=...
  SHOWCMD_OPT = cli_option("--show-cmd", dest= "show_command", a...
  CLEANUP_OPT = cli_option("--cleanup", dest= "cleanup", default...
  STATIC_OPT = cli_option("-s", "--static", dest= "static", acti...
  ALL_OPT = cli_option("--all", dest= "show_all", default= False...
  SELECT_OS_OPT = cli_option("--select-os", dest= "select_os", a...
  IGNORE_FAILURES_OPT = cli_option("--ignore-failures", dest= "i...
  IGNORE_REMOVE_FAILURES_OPT = cli_option("--ignore-remove-failu...
  REMOVE_INSTANCE_OPT = cli_option("--remove-instance", dest= "r...
  DST_NODE_OPT = cli_option("-n", "--target-node", dest= "dst_no...
  NEW_SECONDARY_OPT = cli_option("-n", "--new-secondary", dest= ...
  NEW_PRIMARY_OPT = cli_option("--new-primary", dest= "new_prima...
  ON_PRIMARY_OPT = cli_option("-p", "--on-primary", dest= "on_pr...
  ON_SECONDARY_OPT = cli_option("-s", "--on-secondary", dest= "o...
  AUTO_PROMOTE_OPT = cli_option("--auto-promote", dest= "auto_pr...
  AUTO_REPLACE_OPT = cli_option("-a", "--auto", dest= "auto", de...
  IGNORE_SIZE_OPT = cli_option("--ignore-size", dest= "ignore_si...
  SRC_NODE_OPT = cli_option("--src-node", dest= "src_node", help...
  SRC_DIR_OPT = cli_option("--src-dir", dest= "src_dir", help= "...
  SECONDARY_IP_OPT = cli_option("-s", "--secondary-ip", dest= "s...
  READD_OPT = cli_option("--readd", dest= "readd", default= Fals...
  NOSSH_KEYCHECK_OPT = cli_option("--no-ssh-key-check", dest= "s...
  NODE_FORCE_JOIN_OPT = cli_option("--force-join", dest= "force_...
  MC_OPT = cli_option("-C", "--master-candidate", dest= "master_...
  OFFLINE_OPT = cli_option("-O", "--offline", dest= "offline", m...
  DRAINED_OPT = cli_option("-D", "--drained", dest= "drained", m...
  CAPAB_MASTER_OPT = cli_option("--master-capable", dest= "maste...
  CAPAB_VM_OPT = cli_option("--vm-capable", dest= "vm_capable", ...
  ALLOCATABLE_OPT = cli_option("--allocatable", dest= "allocatab...
  NOLVM_STORAGE_OPT = cli_option("--no-lvm-storage", dest= "lvm_...
  ENABLED_HV_OPT = cli_option("--enabled-hypervisors", dest= "en...
  ENABLED_DISK_TEMPLATES_OPT = cli_option("--enabled-disk-templa...
  NIC_PARAMS_OPT = cli_option("-N", "--nic-parameters", dest= "n...
  CP_SIZE_OPT = cli_option("-C", "--candidate-pool-size", defaul...
  VG_NAME_OPT = cli_option("--vg-name", dest= "vg_name", help= (...
  YES_DOIT_OPT = cli_option("--yes-do-it", "--ya-rly", dest= "ye...
  NOVOTING_OPT = cli_option("--no-voting", dest= "no_voting", he...
  MAC_PREFIX_OPT = cli_option("-m", "--mac-prefix", dest= "mac_p...
  MASTER_NETDEV_OPT = cli_option("--master-netdev", dest= "maste...
  MASTER_NETMASK_OPT = cli_option("--master-netmask", dest= "mas...
  USE_EXTERNAL_MIP_SCRIPT = cli_option("--use-external-mip-scrip...
  GLOBAL_FILEDIR_OPT = cli_option("--file-storage-dir", dest= "f...
  GLOBAL_SHARED_FILEDIR_OPT = cli_option("--shared-file-storage-...
  NOMODIFY_ETCHOSTS_OPT = cli_option("--no-etc-hosts", dest= "mo...
  MODIFY_ETCHOSTS_OPT = cli_option("--modify-etc-hosts", dest= "...
  NOMODIFY_SSH_SETUP_OPT = cli_option("--no-ssh-init", dest= "mo...
  ERROR_CODES_OPT = cli_option("--error-codes", dest= "error_cod...
  NONPLUS1_OPT = cli_option("--no-nplus1-mem", dest= "skip_nplus...
  REBOOT_TYPE_OPT = cli_option("-t", "--type", dest= "reboot_typ...
  IGNORE_SECONDARIES_OPT = cli_option("--ignore-secondaries", de...
  NOSHUTDOWN_OPT = cli_option("--noshutdown", dest= "shutdown", ...
  TIMEOUT_OPT = cli_option("--timeout", dest= "timeout", type= "...
  SHUTDOWN_TIMEOUT_OPT = cli_option("--shutdown-timeout", dest= ...
  INTERVAL_OPT = cli_option("--interval", dest= "interval", type...
  EARLY_RELEASE_OPT = cli_option("--early-release", dest= "early...
  NEW_CLUSTER_CERT_OPT = cli_option("--new-cluster-certificate",...
  RAPI_CERT_OPT = cli_option("--rapi-certificate", dest= "rapi_c...
  NEW_RAPI_CERT_OPT = cli_option("--new-rapi-certificate", dest=...
  SPICE_CERT_OPT = cli_option("--spice-certificate", dest= "spic...
  SPICE_CACERT_OPT = cli_option("--spice-ca-certificate", dest= ...
  NEW_SPICE_CERT_OPT = cli_option("--new-spice-certificate", des...
  NEW_CONFD_HMAC_KEY_OPT = cli_option("--new-confd-hmac-key", de...
  CLUSTER_DOMAIN_SECRET_OPT = cli_option("--cluster-domain-secre...
  NEW_CLUSTER_DOMAIN_SECRET_OPT = cli_option("--new-cluster-doma...
  USE_REPL_NET_OPT = cli_option("--use-replication-network", des...
  MAINTAIN_NODE_HEALTH_OPT = cli_option("--maintain-node-health"...
  IDENTIFY_DEFAULTS_OPT = cli_option("--identify-defaults", dest...
  UIDPOOL_OPT = cli_option("--uid-pool", default= None, action= ...
  ADD_UIDS_OPT = cli_option("--add-uids", default= None, action=...
  REMOVE_UIDS_OPT = cli_option("--remove-uids", default= None, a...
  RESERVED_LVS_OPT = cli_option("--reserved-lvs", default= None,...
  ROMAN_OPT = cli_option("--roman", dest= "roman_integers", defa...
  DRBD_HELPER_OPT = cli_option("--drbd-usermode-helper", dest= "...
  NODRBD_STORAGE_OPT = cli_option("--no-drbd-storage", dest= "dr...
  PRIMARY_IP_VERSION_OPT = cli_option("--primary-ip-version", de...
  SHOW_MACHINE_OPT = cli_option("-M", "--show-machine-names", de...
  FAILURE_ONLY_OPT = cli_option("--failure-only", default= False...
  REASON_OPT = cli_option("--reason", default= None, help= "The ...
  PRIORITY_OPT = cli_option("--priority", default= None, dest= "...
  HID_OS_OPT = cli_option("--hidden", dest= "hidden", type= "boo...
  BLK_OS_OPT = cli_option("--blacklisted", dest= "blacklisted", ...
  PREALLOC_WIPE_DISKS_OPT = cli_option("--prealloc-wipe-disks", ...
  NODE_PARAMS_OPT = cli_option("--node-parameters", dest= "ndpar...
  ALLOC_POLICY_OPT = cli_option("--alloc-policy", dest= "alloc_p...
  NODE_POWERED_OPT = cli_option("--node-powered", default= None,...
  OOB_TIMEOUT_OPT = cli_option("--oob-timeout", dest= "oob_timeo...
  POWER_DELAY_OPT = cli_option("--power-delay", dest= "power_del...
  FORCE_FILTER_OPT = cli_option("-F", "--filter", dest= "force_f...
  NO_REMEMBER_OPT = cli_option("--no-remember", dest= "no_rememb...
  PRIMARY_ONLY_OPT = cli_option("-p", "--primary-only", default=...
  SECONDARY_ONLY_OPT = cli_option("-s", "--secondary-only", defa...
  STARTUP_PAUSED_OPT = cli_option("--paused", dest= "startup_pau...
  TO_GROUP_OPT = cli_option("--to", dest= "to", metavar= "<group...
  IGNORE_ERRORS_OPT = cli_option("-I", "--ignore-errors", defaul...
  DISK_STATE_OPT = cli_option("--disk-state", default= [], dest=...
  HV_STATE_OPT = cli_option("--hypervisor-state", default= [], d...
  IGNORE_IPOLICY_OPT = cli_option("--ignore-ipolicy", dest= "ign...
  RUNTIME_MEM_OPT = cli_option("-m", "--runtime-memory", dest= "...
  ABSOLUTE_OPT = cli_option("--absolute", dest= "absolute", acti...
  NETWORK_OPT = cli_option("--network", action= "store", default...
  GATEWAY_OPT = cli_option("--gateway", action= "store", default...
  ADD_RESERVED_IPS_OPT = cli_option("--add-reserved-ips", action...
  REMOVE_RESERVED_IPS_OPT = cli_option("--remove-reserved-ips", ...
  NETWORK6_OPT = cli_option("--network6", action= "store", defau...
  GATEWAY6_OPT = cli_option("--gateway6", action= "store", defau...
  NOCONFLICTSCHECK_OPT = cli_option("--no-conflicts-check", dest...
  INCLUDEDEFAULTS_OPT = cli_option("--include-defaults", dest= "...
  COMMON_OPTS = [DEBUG_OPT, REASON_OPT]
Options provided by all commands
  COMMON_CREATE_OPTS = [BACKEND_OPT, DISK_OPT, DISK_TEMPLATE_OPT...
  INSTANCE_POLICY_OPTS = [IPOLICY_BOUNDS_SPECS_OPT, IPOLICY_DISK...
  SPLIT_ISPECS_OPTS = [SPECS_CPU_COUNT_OPT, SPECS_DISK_COUNT_OPT...
  _DEFAULT_FORMAT_QUERY = {constants.QFT_TEXT:(str, False), cons...
Default formatting for query results; (callback, align right)

Imports: sys, textwrap, os, time, logging, errno, itertools, shlex, StringIO, utils, errors, constants, opcodes, luxi, ssconf, rpc, ssh, compat, netutils, qlang, objects, pathutils, OptionParser, TitledHelpFormatter, Option, OptionValueError


Function Details [hide private]

_ExtractTagsObject(opts, args)

source code 

Extract the tag type object.

Note that this function will modify its args parameter.

_ExtendTags(opts, args)

source code 

Extend the args if a source file has been given.

This function will extend the tags with the contents of the file passed in the 'tags_source' attribute of the opts parameter. A file named '-' will be replaced by stdin.

ListTags(opts, args)

source code 

List the tags on a given object.

This is a generic implementation that knows how to deal with all three cases of tag objects (cluster, node, instance). The opts argument is expected to contain a tag_type field denoting what object type we work on.

AddTags(opts, args)

source code 

Add tags on a given object.

This is a generic implementation that knows how to deal with all three cases of tag objects (cluster, node, instance). The opts argument is expected to contain a tag_type field denoting what object type we work on.

RemoveTags(opts, args)

source code 

Remove tags from a given object.

This is a generic implementation that knows how to deal with all three cases of tag objects (cluster, node, instance). The opts argument is expected to contain a tag_type field denoting what object type we work on.

_SplitKeyVal(opt, data, parse_prefixes)

source code 

Convert a KeyVal string into a dict.

This function will convert a key=val[,...] string into a dict. Empty values will be converted specially: keys which have the prefix 'no_' will have the value=False and the prefix stripped, keys with the prefix "-" will have value=None and the prefix stripped, and the others will have value=True.

Parameters:
  • opt (string) - a string holding the option name for which we process the data, used in building error messages
  • data (string) - a string of the format key=val,key=val,...
  • parse_prefixes (bool) - whether to handle prefixes specially
Returns: dict
{key=val, key=val}
Raises:

_SplitIdentKeyVal(opt, value, parse_prefixes)

source code 

Helper function to parse "ident:key=val,key=val" options.

Parameters:
  • opt (string) - option name, used in error messages
  • value (string) - expected to be in the format "ident:key=val,key=val,..."
  • parse_prefixes (bool) - whether to handle prefixes specially (see _SplitKeyVal)
Returns: tuple
(ident, {key=val, key=val})
Raises:

check_ident_key_val(option, opt, value)

source code 

Custom parser for ident:key=val,key=val options.

This will store the parsed values as a tuple (ident, {key: val}). As such, multiple uses of this option via action=append is possible.

check_key_val(option, opt, value)

source code 

Custom parser class for key=val,key=val options.

This will store the parsed values as a dict {key: val}.

check_multilist_ident_key_val(_, opt, value)

source code 

Custom parser for "ident:key=val,key=val/ident:key=val//ident:.." options.

Returns: list of dictionary
[{ident: {key: val, key: val}, ident: {key: val}}, {ident:..}]

check_bool(option, opt, value)

source code 

Custom parser for yes/no options.

This will store the parsed value as either True or False.

_ParseArgs(binary, argv, commands, aliases, env_override)

source code 

Parser for the command line arguments.

This function parses the arguments and returns the function which must be executed together with its (modified) arguments.

Parameters:
  • binary - Script name
  • argv - Command line arguments
  • commands - Dictionary containing command definitions
  • aliases - dictionary with command aliases {"alias": "target", ...}
  • env_override - list of env variables allowed for default args
Raises:

_FormatUsage(binary, commands)

source code 

Generates a nice description of all commands.

Parameters:
  • binary - Script name
  • commands - Dictionary containing command definitions

_CheckArguments(cmd, args_def, args)

source code 

Verifies the arguments using the argument definition.

Algorithm:

  1. Abort with error if values specified by user but none expected.
  1. For each argument in definition
    1. Keep running count of minimum number of values (min_count)
    1. Keep running count of maximum number of values (max_count)
    1. If it has an unlimited number of values
      1. Abort with error if it's not the last argument in the definition
  1. If last argument has limited number of values
    1. Abort with error if number of values doesn't match or is too large
  1. Abort with error if user didn't pass enough values (min_count)

CalculateOSNames(os_name, os_variants)

source code 

Calculates all the names an OS can be called, according to its variants.

Parameters:
  • os_name (string) - base name of the os
  • os_variants (list or None) - list of supported variants
Returns: list
list of valid names

ParseFields(selected, default)

source code 

Parses the values of "--field"-like options.

Parameters:
  • selected (string or None) - User-selected options
  • default (list) - Default fields

UsesRPC(fn)

source code 

RPC-wrapper decorator.

When applied to a function, it runs it with the RPC system initialized, and it shutsdown the system afterwards. This means the function must be called without RPC being initialized.

AskUser(text, choices=None)

source code 

Ask the user a question.

Parameters:
  • text - the question to ask
  • choices - list with elements tuples (input_char, return_value, description); if not given, it will default to: [('y', True, 'Perform the operation'), ('n', False, 'Do no do the operation')]; note that the '?' char is reserved for help
Returns:
one of the return values from the choices list; if input is not possible (i.e. not running with a tty, we return the last entry from the list

SendJob(ops, cl=None)

source code 

Function to submit an opcode without waiting for the results.

Parameters:
  • ops (list) - list of opcodes
  • cl (luxi.Client) - the luxi client to use for communicating with the master; if None, a new client will be created

GenericPollJob(job_id, cbs, report_cbs)

source code 

Generic job-polling function.

Parameters:

PollJob(job_id, cl=None, feedback_fn=None, reporter=None)

source code 

Function to poll for the result of a job.

Parameters:
  • job_id (job identified) - the job to poll for results
  • cl (luxi.Client) - the luxi client to use for communicating with the master; if None, a new client will be created

SubmitOpCode(op, cl=None, feedback_fn=None, opts=None, reporter=None)

source code 

Legacy function to submit an opcode.

This is just a simple wrapper over the construction of the processor instance. It should be extended to better handle feedback and interaction functions.

SubmitOrSend(op, opts, cl=None, feedback_fn=None)

source code 

Wrapper around SubmitOpCode or SendJob.

This function will decide, based on the 'opts' parameter, whether to submit and wait for the result of the opcode (and return it), or whether to just send the job and print its identifier. It is used in order to simplify the implementation of the '--submit' option.

It will also process the opcodes if we're sending the via SendJob (otherwise SubmitOpCode does it).

_InitReasonTrail(op, opts)

source code 

Builds the first part of the reason trail

Builds the initial part of the reason trail, adding the user provided reason (if it exists) and the name of the command starting the operation.

Parameters:
  • op - the opcode the reason trail will be added to
  • opts - the command line options selected by the user

SetGenericOpcodeOpts(opcode_list, options)

source code 

Processor for generic options.

This function updates the given opcodes based on generic command line options (like debug, dry-run, etc.).

Parameters:
  • opcode_list - list of opcodes
  • options - command line options or None
Returns:
None (in-place modification)

GetClient(query=False)

source code 

Connects to the a luxi socket and returns a client.

Parameters:
  • query (boolean) - this signifies that the client will only be used for queries; if the build-time parameter enable-split-queries is enabled, then the client will be connected to the query socket instead of the masterd socket

FormatError(err)

source code 

Return a formatted error message for a given error.

This function takes an exception instance and returns a tuple consisting of two values: first, the recommended exit code, and second, a string describing the error message (not newline-terminated).

GenericMain(commands, override=None, aliases=None, env_override=frozenset())

source code 

Generic main function for all the gnt-* commands.

Parameters:
  • commands - a dictionary with a special structure, see the design doc for command line handling.
  • override - if not None, we expect a dictionary with keys that will override command line options; this can be used to pass options from the scripts to generic functions
  • aliases - dictionary with command aliases {'alias': 'target, ...}
  • env_override - list of environment names which are allowed to submit default args for commands

GenericInstanceCreate(mode, opts, args)

source code 

Add an instance to the cluster via either creation or import.

Parameters:
  • mode - constants.INSTANCE_CREATE or constants.INSTANCE_IMPORT
  • opts - the command line options selected by the user
  • args (list) - should contain only one element, the new instance name
Returns: int
the desired exit code

RunWhileClusterStopped(feedback_fn, fn, *args)

source code 

Calls a function while all cluster daemons are stopped.

Parameters:
  • feedback_fn (callable) - Feedback function
  • fn (callable) - Function to be called when daemons are stopped

GenerateTable(headers, fields, separator, data, numfields=None, unitfields=None, units=None)

source code 

Prints a table with headers and different fields.

Parameters:
  • headers (dict) - dictionary mapping field names to headers for the table
  • fields (list) - the field names corresponding to each row in the data field
  • separator - the separator to be used; if this is None, the default 'smart' algorithm is used which computes optimal field width, otherwise just the separator is used between each field
  • data (list) - a list of lists, each sublist being one row to be output
  • numfields (list) - a list with the fields that hold numeric values and thus should be right-aligned
  • unitfields (list) - a list with the fields that hold numeric values that should be formatted with the units field
  • units (string or None) - the units we should use for formatting, or None for automatic choice (human-readable for non-separator usage, otherwise megabytes); this is a one-letter string

_GetColumnFormatter(fdef, override, unit)

source code 

Returns formatting function for a field.

Parameters:
Returns: tuple; (callable, bool)
Returns the function to format a value (takes one parameter) and a boolean for aligning the value on the right-hand side

FormatResultError(status, verbose)

source code 

Formats result status other than constants.RS_NORMAL.

Parameters:
  • status - The result status
  • verbose (boolean) - Whether to return the verbose text
Returns:
Text of result status

FormatQueryResult(result, unit=None, format_override=None, separator=None, header=False, verbose=False)

source code 

Formats data in objects.QueryResponse.

Parameters:
  • result (objects.QueryResponse) - result of query operation
  • unit (string) - Unit used for formatting fields of type constants.QFT_UNIT, see utils.text.FormatUnit
  • format_override (dict) - Dictionary for overriding field formatting functions, indexed by field name, contents like _DEFAULT_FORMAT_QUERY
  • separator (string or None) - String used to separate fields
  • header (bool) - Whether to output header row
  • verbose (boolean) - whether to use verbose field descriptions or not

_GetUnknownFields(fdefs)

source code 

Returns list of unknown fields included in fdefs.

Parameters:

_WarnUnknownFields(fdefs)

source code 

Prints a warning to stderr if a query included unknown fields.

Parameters:

GenericList(resource, fields, names, unit, separator, header, cl=None, format_override=None, verbose=False, force_filter=False, namefield=None, qfilter=None, isnumeric=False)

source code 

Generic implementation for listing all items of a resource.

Parameters:
  • resource - One of constants.QR_VIA_LUXI
  • fields (list of strings) - List of fields to query for
  • names (list of strings) - Names of items to query for
  • unit (string or None) - Unit used for formatting fields of type constants.QFT_UNIT or None for automatic choice (human-readable for non-separator usage, otherwise megabytes); this is a one-letter string
  • separator (string or None) - String used to separate fields
  • header (bool) - Whether to show header row
  • force_filter (bool) - Whether to always treat names as filter
  • format_override (dict) - Dictionary for overriding field formatting functions, indexed by field name, contents like _DEFAULT_FORMAT_QUERY
  • verbose (boolean) - whether to use verbose field descriptions or not
  • namefield (string) - Name of field to use for simple filters (see qlang.MakeFilter for details)
  • qfilter (list or None) - Query filter (in addition to names)
  • isnumeric - bool
  • isnumeric - Whether the namefield's type is numeric, and therefore any simple filters built by namefield should use integer values to reflect that

_FieldDescValues(fdef)

source code 

Helper function for GenericListFields to get query field description.

Parameters:
Returns: list

GenericListFields(resource, fields, separator, header, cl=None)

source code 

Generic implementation for listing fields for a resource.

Parameters:
  • resource - One of constants.QR_VIA_LUXI
  • fields (list of strings) - List of fields to query for
  • separator (string or None) - String used to separate fields
  • header (bool) - Whether to show header row

FormatTable(rows, columns, header, separator)

source code 

Formats data as a table.

Parameters:
  • rows (list of lists) - Row data, one list per row
  • columns (list of TableColumn) - Column descriptions
  • header (bool) - Whether to show header row
  • separator (string or None) - String used to separate columns

FormatTimestamp(ts)

source code 

Formats a given timestamp.

Parameters:
  • ts (timestamp) - a timeval-type timestamp, a tuple of seconds and microseconds
Returns: string
a string with the formatted timestamp

ParseTimespec(value)

source code 

Parse a time specification.

The following suffixed will be recognized:

  • s: seconds
  • m: minutes
  • h: hours
  • d: day
  • w: weeks

Without any suffix, the value will be taken to be in seconds.

GetOnlineNodes(nodes, cl=None, nowarn=False, secondary_ips=False, filter_master=False, nodegroup=None)

source code 

Returns the names of online nodes.

This function will also log a warning on stderr with the names of the online nodes.

Parameters:
  • nodes - if not empty, use only this subset of nodes (minus the offline ones)
  • cl - if not None, luxi client to use
  • nowarn (boolean) - by default, this function will output a note with the offline nodes that are skipped; if this parameter is True the note is not displayed
  • secondary_ips (boolean) - if True, return the secondary IPs instead of the names, useful for doing network traffic over the replication interface (if any)
  • filter_master (boolean) - if True, do not return the master node in the list (useful in coordination with secondary_ips where we cannot check our node name against the list)
  • nodegroup (string) - If set, only return nodes in this node group

_ToStream(stream, txt, *args)

source code 

Write a message to a stream, bypassing the logging system

Parameters:
  • stream (file object) - the file to which we should write
  • txt (str) - the message

ToStdout(txt, *args)

source code 

Write a message to stdout only, bypassing the logging system

This is just a wrapper over _ToStream.

Parameters:
  • txt (str) - the message

ToStderr(txt, *args)

source code 

Write a message to stderr only, bypassing the logging system

This is just a wrapper over _ToStream.

Parameters:
  • txt (str) - the message

FormatParamsDictInfo(param_dict, actual)

source code 

Formats a parameter dictionary.

Parameters:
  • param_dict (dict) - the own parameters
  • actual (dict) - the current parameter set (including defaults)
Returns: dict
dictionary where the value of each parameter is either a fully formatted string or a dictionary containing formatted strings

FormatPolicyInfo(custom_ipolicy, eff_ipolicy, iscluster)

source code 

Formats an instance policy.

Parameters:
  • custom_ipolicy (dict) - own policy
  • eff_ipolicy (dict) - effective policy (including defaults); ignored for cluster
  • iscluster (bool) - the policy is at cluster level
Returns: list of pairs
formatted data, suitable for PrintGenericInfo

PrintIPolicyCommand(buf, ipolicy, isgroup)

source code 

Print the command option used to generate the given instance policy.

Currently only the parts dealing with specs are supported.

Parameters:
  • buf (StringIO) - stream to write into
  • ipolicy (dict) - instance policy
  • isgroup (bool) - whether the policy is at group level

ConfirmOperation(names, list_type, text, extra="")

source code 

Ask the user to confirm an operation on a list of list_type.

This function is used to request confirmation for doing an operation on a given list of list_type.

Parameters:
  • names (list) - the list of names that we display when we ask for confirmation
  • list_type (str) - Human readable name for elements in the list (e.g. nodes)
  • text (str) - the operation that the user should confirm
Returns: boolean
True or False depending on user's confirmation.

CreateIPolicyFromOpts(ispecs_mem_size=None, ispecs_cpu_count=None, ispecs_disk_count=None, ispecs_disk_size=None, ispecs_nic_count=None, minmax_ispecs=None, std_ispecs=None, ipolicy_disk_templates=None, ipolicy_vcpu_ratio=None, ipolicy_spindle_ratio=None, group_ipolicy=False, allowed_values=None, fill_all=False)

source code 

Creation of instance policy based on command line options.

Parameters:
  • fill_all - whether for cluster policies we should ensure that all values are filled

_SerializeGenericInfo(buf, data, level, afterkey=False)

source code 

Formatting core of PrintGenericInfo.

Parameters:
  • buf - (string) stream to accumulate the result into
  • data - data to format
  • level (int) - depth in the data hierarchy, used for indenting
  • afterkey (bool) - True when we are in the middle of a line after a key (used to properly add newlines or indentation)

PrintGenericInfo(data)

source code 

Print information formatted according to the hierarchy.

The output is a valid YAML string.

Parameters:
  • data - the data to print. It's a hierarchical structure whose elements can be:
    • dictionaries, where keys are strings and values are of any of the types listed here
    • lists of pairs (key, value), where key is a string and value is of any of the types listed here; it's a way to encode ordered dictionaries
    • lists of any of the types listed here
    • strings

Variables Details [hide private]

_PRIORITY_NAMES

Priorities (sorted)

Value:
[("low", constants.OP_PRIO_LOW), ("normal", constants.OP_PRIO_NORMAL),\
 ("high", constants.OP_PRIO_HIGH),]

TISPECS_GROUP_TYPES

Value:
{constants.ISPECS_MIN: constants.VTYPE_INT, constants.ISPECS_MAX: cons\
tants.VTYPE_INT,}

TISPECS_CLUSTER_TYPES

Value:
{constants.ISPECS_MIN: constants.VTYPE_INT, constants.ISPECS_MAX: cons\
tants.VTYPE_INT, constants.ISPECS_STD: constants.VTYPE_INT,}

_QFT_NAMES

User-friendly names for query2 field types

Value:
{constants.QFT_UNKNOWN: "Unknown", constants.QFT_TEXT: "Text", constan\
ts.QFT_BOOL: "Boolean", constants.QFT_NUMBER: "Number", constants.QFT_\
UNIT: "Storage size", constants.QFT_TIMESTAMP: "Timestamp", constants.\
QFT_OTHER: "Custom",}

OPT_COMPL_ALL

Value:
compat.UniqueFrozenset([OPT_COMPL_MANY_NODES, OPT_COMPL_ONE_NODE, OPT_\
COMPL_ONE_INSTANCE, OPT_COMPL_ONE_OS, OPT_COMPL_ONE_EXTSTORAGE, OPT_CO\
MPL_ONE_IALLOCATOR, OPT_COMPL_ONE_NETWORK, OPT_COMPL_INST_ADD_NODES, O\
PT_COMPL_ONE_NODEGROUP,])

DEBUG_OPT

Value:
cli_option("-d", "--debug", default= 0, action= "count", help= "Increa\
se debugging level")

NOHDR_OPT

Value:
cli_option("--no-headers", default= False, action= "store_true", dest=\
 "no_headers", help= "Don't display column headers")

SEP_OPT

Value:
cli_option("--separator", default= None, action= "store", dest= "separ\
ator", help= ("Separator between output fields" " (defaults to one spa\
ce)"))

USEUNITS_OPT

Value:
cli_option("--units", default= None, dest= "units", choices= ("h", "m"\
, "g", "t"), help= "Specify units for output (one of h/m/g/t)")

FIELDS_OPT

Value:
cli_option("-o", "--output", dest= "output", action= "store", type= "s\
tring", metavar= "FIELDS", help= "Comma separated list of output field\
s")

FORCE_OPT

Value:
cli_option("-f", "--force", dest= "force", action= "store_true", defau\
lt= False, help= "Force the operation")

CONFIRM_OPT

Value:
cli_option("--yes", dest= "confirm", action= "store_true", default= Fa\
lse, help= "Do not require confirmation")

IGNORE_OFFLINE_OPT

Value:
cli_option("--ignore-offline", dest= "ignore_offline", action= "store_\
true", default= False, help= ("Ignore offline nodes and do as much" " \
as possible"))

TAG_ADD_OPT

Value:
cli_option("--tags", dest= "tags", default= None, help= "Comma-separat\
ed list of instance" " tags")

TAG_SRC_OPT

Value:
cli_option("--from", dest= "tags_source", default= None, help= "File w\
ith tag names")

SUBMIT_OPT

Value:
cli_option("--submit", dest= "submit_only", default= False, action= "s\
tore_true", help= ("Submit the job and return the job ID, but" " don't\
 wait for the job to finish"))

SYNC_OPT

Value:
cli_option("--sync", dest= "do_locking", default= False, action= "stor\
e_true", help= ("Grab locks while doing the queries" " in order to ens\
ure more consistent results"))

DRY_RUN_OPT

Value:
cli_option("--dry-run", default= False, action= "store_true", help= ("\
Do not execute the operation, just run the" " check steps and verify i\
f it could be" " executed"))

VERBOSE_OPT

Value:
cli_option("-v", "--verbose", default= False, action= "store_true", he\
lp= "Increase the verbosity of the operation")

DEBUG_SIMERR_OPT

Value:
cli_option("--debug-simulate-errors", default= False, action= "store_t\
rue", dest= "simulate_errors", help= "Debugging option that makes the \
operation" " treat most runtime checks as failed")

NWSYNC_OPT

Value:
cli_option("--no-wait-for-sync", dest= "wait_for_sync", default= True,\
 action= "store_false", help= "Don't wait for sync (DANGEROUS!)")

WFSYNC_OPT

Value:
cli_option("--wait-for-sync", dest= "wait_for_sync", default= False, a\
ction= "store_true", help= "Wait for disks to sync")

ONLINE_INST_OPT

Value:
cli_option("--online", dest= "online_inst", action= "store_true", defa\
ult= False, help= "Enable offline instance")

OFFLINE_INST_OPT

Value:
cli_option("--offline", dest= "offline_inst", action= "store_true", de\
fault= False, help= "Disable down instance")

DISK_TEMPLATE_OPT

Value:
cli_option("-t", "--disk-template", dest= "disk_template", help= ("Cus\
tom disk setup (%s)" % utils.CommaJoin(constants.DISK_TEMPLATES)), def\
ault= None, metavar= "TEMPL", choices= list(constants.DISK_TEMPLATES))

NONICS_OPT

Value:
cli_option("--no-nics", default= False, action= "store_true", help= "D\
o not create any network cards for" " the instance")

FILESTORE_DIR_OPT

Value:
cli_option("--file-storage-dir", dest= "file_storage_dir", help= "Rela\
tive path under default cluster-wide" " file storage dir to store file\
-based disks", default= None, metavar= "<DIR>")

FILESTORE_DRIVER_OPT

Value:
cli_option("--file-driver", dest= "file_driver", help= "Driver to use \
for image files", default= None, metavar= "<DRIVER>", choices= list(co\
nstants.FILE_DRIVER))

IALLOCATOR_OPT

Value:
cli_option("-I", "--iallocator", metavar= "<NAME>", help= "Select node\
s for the instance automatically" " using the <NAME> iallocator plugin\
", default= None, type= "string", completion_suggest= OPT_COMPL_ONE_IA\
LLOCATOR)

DEFAULT_IALLOCATOR_OPT

Value:
cli_option("-I", "--default-iallocator", metavar= "<NAME>", help= "Set\
 the default instance" " allocator plugin", default= None, type= "stri\
ng", completion_suggest= OPT_COMPL_ONE_IALLOCATOR)

OS_OPT

Value:
cli_option("-o", "--os-type", dest= "os", help= "What OS to run", meta\
var= "<os>", completion_suggest= OPT_COMPL_ONE_OS)

OSPARAMS_OPT

Value:
cli_option("-O", "--os-parameters", dest= "osparams", type= "keyval", \
default= {}, help= "OS parameters")

FORCE_VARIANT_OPT

Value:
cli_option("--force-variant", dest= "force_variant", action= "store_tr\
ue", default= False, help= "Force an unknown variant")

NO_INSTALL_OPT

Value:
cli_option("--no-install", dest= "no_install", action= "store_true", d\
efault= False, help= "Do not install the OS (will" " enable no-start)"\
)

NORUNTIME_CHGS_OPT

Value:
cli_option("--no-runtime-changes", dest= "allow_runtime_chgs", default\
= True, action= "store_false", help= "Don't allow runtime changes")

BACKEND_OPT

Value:
cli_option("-B", "--backend-parameters", dest= "beparams", type= "keyv\
al", default= {}, help= "Backend parameters")

HVOPTS_OPT

Value:
cli_option("-H", "--hypervisor-parameters", type= "keyval", default= {\
}, dest= "hvparams", help= "Hypervisor parameters")

DISK_PARAMS_OPT

Value:
cli_option("-D", "--disk-parameters", dest= "diskparams", help= "Disk \
template parameters, in the format" " template:option=value,option=val\
ue,...", type= "identkeyval", action= "append", default= [])

SPECS_MEM_SIZE_OPT

Value:
cli_option("--specs-mem-size", dest= "ispecs_mem_size", type= "keyval"\
, default= {}, help= "Memory size specs: list of key=value," " where k\
ey is one of min, max, std" " (in MB or using a unit)")

SPECS_CPU_COUNT_OPT

Value:
cli_option("--specs-cpu-count", dest= "ispecs_cpu_count", type= "keyva\
l", default= {}, help= "CPU count specs: list of key=value," " where k\
ey is one of min, max, std")

SPECS_DISK_COUNT_OPT

Value:
cli_option("--specs-disk-count", dest= "ispecs_disk_count", type= "key\
val", default= {}, help= "Disk count specs: list of key=value," " wher\
e key is one of min, max, std")

SPECS_DISK_SIZE_OPT

Value:
cli_option("--specs-disk-size", dest= "ispecs_disk_size", type= "keyva\
l", default= {}, help= "Disk size specs: list of key=value," " where k\
ey is one of min, max, std" " (in MB or using a unit)")

SPECS_NIC_COUNT_OPT

Value:
cli_option("--specs-nic-count", dest= "ispecs_nic_count", type= "keyva\
l", default= {}, help= "NIC count specs: list of key=value," " where k\
ey is one of min, max, std")

IPOLICY_BOUNDS_SPECS_OPT

Value:
cli_option(IPOLICY_BOUNDS_SPECS_STR, dest= "ipolicy_bounds_specs", typ\
e= "multilistidentkeyval", default= None, help= "Complete instance spe\
cs limits")

IPOLICY_STD_SPECS_OPT

Value:
cli_option(IPOLICY_STD_SPECS_STR, dest= "ipolicy_std_specs", type= "ke\
yval", default= None, help= "Complte standard instance specs")

IPOLICY_DISK_TEMPLATES

Value:
cli_option("--ipolicy-disk-templates", dest= "ipolicy_disk_templates",\
 type= "list", default= None, help= "Comma-separated list of" " enable\
d disk templates")

IPOLICY_VCPU_RATIO

Value:
cli_option("--ipolicy-vcpu-ratio", dest= "ipolicy_vcpu_ratio", type= "\
maybefloat", default= None, help= "The maximum allowed vcpu-to-cpu rat\
io")

IPOLICY_SPINDLE_RATIO

Value:
cli_option("--ipolicy-spindle-ratio", dest= "ipolicy_spindle_ratio", t\
ype= "maybefloat", default= None, help= ("The maximum allowed instance\
s to" " spindle ratio"))

HYPERVISOR_OPT

Value:
cli_option("-H", "--hypervisor-parameters", dest= "hypervisor", help= \
"Hypervisor and hypervisor options, in the" " format hypervisor:option\
=value,option=value,...", default= None, type= "identkeyval")

HVLIST_OPT

Value:
cli_option("-H", "--hypervisor-parameters", dest= "hvparams", help= "H\
ypervisor and hypervisor options, in the" " format hypervisor:option=v\
alue,option=value,...", default= [], action= "append", type= "identkey\
val")

NOIPCHECK_OPT

Value:
cli_option("--no-ip-check", dest= "ip_check", default= True, action= "\
store_false", help= "Don't check that the instance's IP" " is alive")

NONAMECHECK_OPT

Value:
cli_option("--no-name-check", dest= "name_check", default= True, actio\
n= "store_false", help= "Don't check that the instance's name" " is re\
solvable")

NET_OPT

Value:
cli_option("--net", help= "NIC parameters", default= [], dest= "nics",\
 action= "append", type= "identkeyval")

DISK_OPT

Value:
cli_option("--disk", help= "Disk parameters", default= [], dest= "disk\
s", action= "append", type= "identkeyval")

DISKIDX_OPT

Value:
cli_option("--disks", dest= "disks", default= None, help= "Comma-separ\
ated list of disks" " indices to act on (e.g. 0,2) (optional," " defau\
lts to all disks)")

OS_SIZE_OPT

Value:
cli_option("-s", "--os-size", dest= "sd_size", help= "Enforces a singl\
e-disk configuration using the" " given disk size, in MiB unless a suf\
fix is used", default= None, type= "unit", metavar= "<size>")

IGNORE_CONSIST_OPT

Value:
cli_option("--ignore-consistency", dest= "ignore_consistency", action=\
 "store_true", default= False, help= "Ignore the consistency of the di\
sks on" " the secondary")

ALLOW_FAILOVER_OPT

Value:
cli_option("--allow-failover", dest= "allow_failover", action= "store_\
true", default= False, help= "If migration is not possible fallback to\
" " failover")

NONLIVE_OPT

Value:
cli_option("--non-live", dest= "live", default= True, action= "store_f\
alse", help= "Do a non-live migration (this usually means" " freeze th\
e instance, save the state, transfer and" " only then resume running o\
n the secondary node)")

MIGRATION_MODE_OPT

Value:
cli_option("--migration-mode", dest= "migration_mode", default= None, \
choices= list(constants.HT_MIGRATION_MODES), help= "Override default m\
igration mode (choose" " either live or non-live")

NODE_PLACEMENT_OPT

Value:
cli_option("-n", "--node", dest= "node", help= "Target node and option\
al secondary node", metavar= "<pnode>[:<snode>]", completion_suggest= \
OPT_COMPL_INST_ADD_NODES)

NODE_LIST_OPT

Value:
cli_option("-n", "--node", dest= "nodes", default= [], action= "append\
", metavar= "<node>", help= "Use only this node (can be used multiple"\
 " times, if not given defaults to all nodes)", completion_suggest= OP\
T_COMPL_ONE_NODE)

NODEGROUP_OPT

Value:
cli_option("-g", NODEGROUP_OPT_NAME, dest= "nodegroup", help= "Node gr\
oup (name or uuid)", metavar= "<nodegroup>", default= None, type= "str\
ing", completion_suggest= OPT_COMPL_ONE_NODEGROUP)

SINGLE_NODE_OPT

Value:
cli_option("-n", "--node", dest= "node", help= "Target node", metavar=\
 "<node>", completion_suggest= OPT_COMPL_ONE_NODE)

NOSTART_OPT

Value:
cli_option("--no-start", dest= "start", default= True, action= "store_\
false", help= "Don't start the instance after creation")

SHOWCMD_OPT

Value:
cli_option("--show-cmd", dest= "show_command", action= "store_true", d\
efault= False, help= "Show command instead of executing it")

CLEANUP_OPT

Value:
cli_option("--cleanup", dest= "cleanup", default= False, action= "stor\
e_true", help= "Instead of performing the migration/failover," " try t\
o recover from a failed cleanup. This is safe" " to run even if the in\
stance is healthy, but it" " will create extra replication traffic and\
 " " disrupt briefly the replication (like during the" " migration/fai\
lover")

STATIC_OPT

Value:
cli_option("-s", "--static", dest= "static", action= "store_true", def\
ault= False, help= "Only show configuration data, not runtime data")

ALL_OPT

Value:
cli_option("--all", dest= "show_all", default= False, action= "store_t\
rue", help= "Show info on all instances on the cluster." " This can ta\
ke a long time to run, use wisely")

SELECT_OS_OPT

Value:
cli_option("--select-os", dest= "select_os", action= "store_true", def\
ault= False, help= "Interactive OS reinstall, lists available" " OS te\
mplates for selection")

IGNORE_FAILURES_OPT

Value:
cli_option("--ignore-failures", dest= "ignore_failures", action= "stor\
e_true", default= False, help= "Remove the instance from the cluster" \
" configuration even if there are failures" " during the removal proce\
ss")

IGNORE_REMOVE_FAILURES_OPT

Value:
cli_option("--ignore-remove-failures", dest= "ignore_remove_failures",\
 action= "store_true", default= False, help= "Remove the instance from\
 the" " cluster configuration even if there" " are failures during the\
 removal" " process")

REMOVE_INSTANCE_OPT

Value:
cli_option("--remove-instance", dest= "remove_instance", action= "stor\
e_true", default= False, help= "Remove the instance from the cluster")

DST_NODE_OPT

Value:
cli_option("-n", "--target-node", dest= "dst_node", help= "Specifies t\
he new node for the instance", metavar= "NODE", default= None, complet\
ion_suggest= OPT_COMPL_ONE_NODE)

NEW_SECONDARY_OPT

Value:
cli_option("-n", "--new-secondary", dest= "dst_node", help= "Specifies\
 the new secondary node", metavar= "NODE", default= None, completion_s\
uggest= OPT_COMPL_ONE_NODE)

NEW_PRIMARY_OPT

Value:
cli_option("--new-primary", dest= "new_primary_node", help= "Specifies\
 the new primary node", metavar= "<node>", default= None, completion_s\
uggest= OPT_COMPL_ONE_NODE)

ON_PRIMARY_OPT

Value:
cli_option("-p", "--on-primary", dest= "on_primary", default= False, a\
ction= "store_true", help= "Replace the disk(s) on the primary" " node\
 (applies only to internally mirrored" " disk templates, e.g. %s)" % u\
tils.CommaJoin(constants.DTS_INT_MIRROR))

ON_SECONDARY_OPT

Value:
cli_option("-s", "--on-secondary", dest= "on_secondary", default= Fals\
e, action= "store_true", help= "Replace the disk(s) on the secondary" \
" node (applies only to internally mirrored" " disk templates, e.g. %s\
)" % utils.CommaJoin(constants.DTS_INT_MIRROR))

AUTO_PROMOTE_OPT

Value:
cli_option("--auto-promote", dest= "auto_promote", default= False, act\
ion= "store_true", help= "Lock all nodes and auto-promote as needed" "\
 to MC status")

AUTO_REPLACE_OPT

Value:
cli_option("-a", "--auto", dest= "auto", default= False, action= "stor\
e_true", help= "Automatically replace faulty disks" " (applies only to\
 internally mirrored" " disk templates, e.g. %s)" % utils.CommaJoin(co\
nstants.DTS_INT_MIRROR))

IGNORE_SIZE_OPT

Value:
cli_option("--ignore-size", dest= "ignore_size", default= False, actio\
n= "store_true", help= "Ignore current recorded size" " (useful for fo\
rcing activation when" " the recorded size is wrong)")

SRC_NODE_OPT

Value:
cli_option("--src-node", dest= "src_node", help= "Source node", metava\
r= "<node>", completion_suggest= OPT_COMPL_ONE_NODE)

SRC_DIR_OPT

Value:
cli_option("--src-dir", dest= "src_dir", help= "Source directory", met\
avar= "<dir>")

SECONDARY_IP_OPT

Value:
cli_option("-s", "--secondary-ip", dest= "secondary_ip", help= "Specif\
y the secondary ip for the node", metavar= "ADDRESS", default= None)

READD_OPT

Value:
cli_option("--readd", dest= "readd", default= False, action= "store_tr\
ue", help= "Readd old node after replacing it")

NOSSH_KEYCHECK_OPT

Value:
cli_option("--no-ssh-key-check", dest= "ssh_key_check", default= True,\
 action= "store_false", help= "Disable SSH key fingerprint checking")

NODE_FORCE_JOIN_OPT

Value:
cli_option("--force-join", dest= "force_join", default= False, action=\
 "store_true", help= "Force the joining of a node")

MC_OPT

Value:
cli_option("-C", "--master-candidate", dest= "master_candidate", type=\
 "bool", default= None, metavar= _YORNO, help= "Set the master_candida\
te flag on the node")

OFFLINE_OPT

Value:
cli_option("-O", "--offline", dest= "offline", metavar= _YORNO, type= \
"bool", default= None, help= ("Set the offline flag on the node" " (cl\
uster does not communicate with offline" " nodes)"))

DRAINED_OPT

Value:
cli_option("-D", "--drained", dest= "drained", metavar= _YORNO, type= \
"bool", default= None, help= ("Set the drained flag on the node" " (ex\
cluded from allocation operations)"))

CAPAB_MASTER_OPT

Value:
cli_option("--master-capable", dest= "master_capable", type= "bool", d\
efault= None, metavar= _YORNO, help= "Set the master_capable flag on t\
he node")

CAPAB_VM_OPT

Value:
cli_option("--vm-capable", dest= "vm_capable", type= "bool", default= \
None, metavar= _YORNO, help= "Set the vm_capable flag on the node")

ALLOCATABLE_OPT

Value:
cli_option("--allocatable", dest= "allocatable", type= "bool", default\
= None, metavar= _YORNO, help= "Set the allocatable flag on a volume")

NOLVM_STORAGE_OPT

Value:
cli_option("--no-lvm-storage", dest= "lvm_storage", help= "Disable sup\
port for lvm based instances" " (cluster-wide)", action= "store_false"\
, default= True)

ENABLED_HV_OPT

Value:
cli_option("--enabled-hypervisors", dest= "enabled_hypervisors", help=\
 "Comma-separated list of hypervisors", type= "string", default= None)

ENABLED_DISK_TEMPLATES_OPT

Value:
cli_option("--enabled-disk-templates", dest= "enabled_disk_templates",\
 help= "Comma-separated list of " "disk templates", type= "string", de\
fault= None)

NIC_PARAMS_OPT

Value:
cli_option("-N", "--nic-parameters", dest= "nicparams", type= "keyval"\
, default= {}, help= "NIC parameters")

CP_SIZE_OPT

Value:
cli_option("-C", "--candidate-pool-size", default= None, dest= "candid\
ate_pool_size", type= "int", help= "Set the candidate pool size")

VG_NAME_OPT

Value:
cli_option("--vg-name", dest= "vg_name", help= ("Enables LVM and speci\
fies the volume group" " name (cluster-wide) for disk allocation" " [%\
s]" % constants.DEFAULT_VG), metavar= "VG", default= None)

YES_DOIT_OPT

Value:
cli_option("--yes-do-it", "--ya-rly", dest= "yes_do_it", help= "Destro\
y cluster", action= "store_true")

NOVOTING_OPT

Value:
cli_option("--no-voting", dest= "no_voting", help= "Skip node agreemen\
t check (dangerous)", action= "store_true", default= False)

MAC_PREFIX_OPT

Value:
cli_option("-m", "--mac-prefix", dest= "mac_prefix", help= "Specify th\
e mac prefix for the instance IP" " addresses, in the format XX:XX:XX"\
, metavar= "PREFIX", default= None)

MASTER_NETDEV_OPT

Value:
cli_option("--master-netdev", dest= "master_netdev", help= "Specify th\
e node interface (cluster-wide)" " on which the master IP address will\
 be added" " (cluster init default: %s)" % constants.DEFAULT_BRIDGE, m\
etavar= "NETDEV", default= None)

MASTER_NETMASK_OPT

Value:
cli_option("--master-netmask", dest= "master_netmask", help= "Specify \
the netmask of the master IP", metavar= "NETMASK", default= None)

USE_EXTERNAL_MIP_SCRIPT

Value:
cli_option("--use-external-mip-script", dest= "use_external_mip_script\
", help= "Specify whether to run a" " user-provided script for the mas\
ter" " IP address turnup and" " turndown operations", type= "bool", me\
tavar= _YORNO, default= None)

GLOBAL_FILEDIR_OPT

Value:
cli_option("--file-storage-dir", dest= "file_storage_dir", help= "Spec\
ify the default directory (cluster-" "wide) for storing the file-based\
 disks [%s]" % pathutils.DEFAULT_FILE_STORAGE_DIR, metavar= "DIR", def\
ault= pathutils.DEFAULT_FILE_STORAGE_DIR)

GLOBAL_SHARED_FILEDIR_OPT

Value:
cli_option("--shared-file-storage-dir", dest= "shared_file_storage_dir\
", help= "Specify the default directory (cluster-wide) for storing the\
" " shared file-based disks [%s]" % pathutils.DEFAULT_SHARED_FILE_STOR\
AGE_DIR, metavar= "SHAREDDIR", default= pathutils.DEFAULT_SHARED_FILE_\
STORAGE_DIR)

NOMODIFY_ETCHOSTS_OPT

Value:
cli_option("--no-etc-hosts", dest= "modify_etc_hosts", help= "Don't mo\
dify %s" % pathutils.ETC_HOSTS, action= "store_false", default= True)

MODIFY_ETCHOSTS_OPT

Value:
cli_option("--modify-etc-hosts", dest= "modify_etc_hosts", metavar= _Y\
ORNO, default= None, type= "bool", help= "Defines whether the cluster \
should autonomously modify" " and keep in sync the /etc/hosts file of \
the nodes")

NOMODIFY_SSH_SETUP_OPT

Value:
cli_option("--no-ssh-init", dest= "modify_ssh_setup", help= "Don't ini\
tialize SSH keys", action= "store_false", default= True)

ERROR_CODES_OPT

Value:
cli_option("--error-codes", dest= "error_codes", help= "Enable parseab\
le error messages", action= "store_true", default= False)

NONPLUS1_OPT

Value:
cli_option("--no-nplus1-mem", dest= "skip_nplusone_mem", help= "Skip N\
+1 memory redundancy tests", action= "store_true", default= False)

REBOOT_TYPE_OPT

Value:
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))

IGNORE_SECONDARIES_OPT

Value:
cli_option("--ignore-secondaries", dest= "ignore_secondaries", default\
= False, action= "store_true", help= "Ignore errors from secondaries")

NOSHUTDOWN_OPT

Value:
cli_option("--noshutdown", dest= "shutdown", action= "store_false", de\
fault= True, help= "Don't shutdown the instance (unsafe)")

TIMEOUT_OPT

Value:
cli_option("--timeout", dest= "timeout", type= "int", default= constan\
ts.DEFAULT_SHUTDOWN_TIMEOUT, help= "Maximum time to wait")

SHUTDOWN_TIMEOUT_OPT

Value:
cli_option("--shutdown-timeout", dest= "shutdown_timeout", type= "int"\
, default= constants.DEFAULT_SHUTDOWN_TIMEOUT, help= "Maximum time to \
wait for instance" " shutdown")

INTERVAL_OPT

Value:
cli_option("--interval", dest= "interval", type= "int", default= None,\
 help= ("Number of seconds between repetions of the" " command"))

EARLY_RELEASE_OPT

Value:
cli_option("--early-release", dest= "early_release", default= False, a\
ction= "store_true", help= "Release the locks on the secondary" " node\
(s) early")

NEW_CLUSTER_CERT_OPT

Value:
cli_option("--new-cluster-certificate", dest= "new_cluster_cert", defa\
ult= False, action= "store_true", help= "Generate a new cluster certif\
icate")

RAPI_CERT_OPT

Value:
cli_option("--rapi-certificate", dest= "rapi_cert", default= None, hel\
p= "File containing new RAPI certificate")

NEW_RAPI_CERT_OPT

Value:
cli_option("--new-rapi-certificate", dest= "new_rapi_cert", default= N\
one, action= "store_true", help= ("Generate a new self-signed RAPI" " \
certificate"))

SPICE_CERT_OPT

Value:
cli_option("--spice-certificate", dest= "spice_cert", default= None, h\
elp= "File containing new SPICE certificate")

SPICE_CACERT_OPT

Value:
cli_option("--spice-ca-certificate", dest= "spice_cacert", default= No\
ne, help= "File containing the certificate of the CA" " which signed t\
he SPICE certificate")

NEW_SPICE_CERT_OPT

Value:
cli_option("--new-spice-certificate", dest= "new_spice_cert", default=\
 None, action= "store_true", help= ("Generate a new self-signed SPICE"\
 " certificate"))

NEW_CONFD_HMAC_KEY_OPT

Value:
cli_option("--new-confd-hmac-key", dest= "new_confd_hmac_key", default\
= False, action= "store_true", help= ("Create a new HMAC key for %s" %\
 constants.CONFD))

CLUSTER_DOMAIN_SECRET_OPT

Value:
cli_option("--cluster-domain-secret", dest= "cluster_domain_secret", d\
efault= None, help= ("Load new new cluster domain" " secret from file"\
))

NEW_CLUSTER_DOMAIN_SECRET_OPT

Value:
cli_option("--new-cluster-domain-secret", dest= "new_cluster_domain_se\
cret", default= False, action= "store_true", help= ("Create a new clus\
ter domain" " secret"))

USE_REPL_NET_OPT

Value:
cli_option("--use-replication-network", dest= "use_replication_network\
", help= "Whether to use the replication network" " for talking to the\
 nodes", action= "store_true", default= False)

MAINTAIN_NODE_HEALTH_OPT

Value:
cli_option("--maintain-node-health", dest= "maintain_node_health", met\
avar= _YORNO, default= None, type= "bool", help= "Configure the cluste\
r to automatically maintain node" " health, by shutting down unknown i\
nstances, shutting down" " unknown DRBD devices, etc.")

IDENTIFY_DEFAULTS_OPT

Value:
cli_option("--identify-defaults", dest= "identify_defaults", default= \
False, action= "store_true", help= "Identify which saved instance para\
meters are equal to" " the current cluster defaults and set them as su\
ch, instead" " of marking them as overridden")

UIDPOOL_OPT

Value:
cli_option("--uid-pool", default= None, action= "store", dest= "uid_po\
ol", help= ("A list of user-ids or user-id" " ranges separated by comm\
as"))

ADD_UIDS_OPT

Value:
cli_option("--add-uids", default= None, action= "store", dest= "add_ui\
ds", help= ("A list of user-ids or user-id" " ranges separated by comm\
as, to be" " added to the user-id pool"))

REMOVE_UIDS_OPT

Value:
cli_option("--remove-uids", default= None, action= "store", dest= "rem\
ove_uids", help= ("A list of user-ids or user-id" " ranges separated b\
y commas, to be" " removed from the user-id pool"))

RESERVED_LVS_OPT

Value:
cli_option("--reserved-lvs", default= None, action= "store", dest= "re\
served_lvs", help= ("A comma-separated list of reserved" " logical vol\
umes names, that will be" " ignored by cluster verify"))

ROMAN_OPT

Value:
cli_option("--roman", dest= "roman_integers", default= False, action= \
"store_true", help= "Use roman numbers for positive integers")

DRBD_HELPER_OPT

Value:
cli_option("--drbd-usermode-helper", dest= "drbd_helper", action= "sto\
re", default= None, help= "Specifies usermode helper for DRBD")

NODRBD_STORAGE_OPT

Value:
cli_option("--no-drbd-storage", dest= "drbd_storage", action= "store_f\
alse", default= True, help= "Disable support for DRBD")

PRIMARY_IP_VERSION_OPT

Value:
cli_option("--primary-ip-version", default= constants.IP4_VERSION, act\
ion= "store", dest= "primary_ip_version", metavar= "%d|%d" %(constants\
.IP4_VERSION, constants.IP6_VERSION), help= "Cluster-wide IP version f\
or primary IP")

SHOW_MACHINE_OPT

Value:
cli_option("-M", "--show-machine-names", default= False, action= "stor\
e_true", help= "Show machine name for every line in output")

FAILURE_ONLY_OPT

Value:
cli_option("--failure-only", default= False, action= "store_true", hel\
p= ("Hide successful results and show failures" " only (determined by \
the exit code)"))

REASON_OPT

Value:
cli_option("--reason", default= None, help= "The reason for executing \
the command")

PRIORITY_OPT

Value:
cli_option("--priority", default= None, dest= "priority", metavar= "|"\
.join(name for name, _ in _PRIORITY_NAMES), choices= _PRIONAME_TO_VALU\
E.keys(), action= "callback", type= "choice", callback= _PriorityOptio\
nCb, help= "Priority for opcode processing")

HID_OS_OPT

Value:
cli_option("--hidden", dest= "hidden", type= "bool", default= None, me\
tavar= _YORNO, help= "Sets the hidden flag on the OS")

BLK_OS_OPT

Value:
cli_option("--blacklisted", dest= "blacklisted", type= "bool", default\
= None, metavar= _YORNO, help= "Sets the blacklisted flag on the OS")

PREALLOC_WIPE_DISKS_OPT

Value:
cli_option("--prealloc-wipe-disks", default= None, type= "bool", metav\
ar= _YORNO, dest= "prealloc_wipe_disks", help= ("Wipe disks prior to i\
nstance" " creation"))

NODE_PARAMS_OPT

Value:
cli_option("--node-parameters", dest= "ndparams", type= "keyval", defa\
ult= None, help= "Node parameters")

ALLOC_POLICY_OPT

Value:
cli_option("--alloc-policy", dest= "alloc_policy", action= "store", me\
tavar= "POLICY", default= None, help= "Allocation policy for the node \
group")

NODE_POWERED_OPT

Value:
cli_option("--node-powered", default= None, type= "bool", metavar= _YO\
RNO, dest= "node_powered", help= "Specify if the SoR for node is power\
ed")

OOB_TIMEOUT_OPT

Value:
cli_option("--oob-timeout", dest= "oob_timeout", type= "int", default=\
 constants.OOB_TIMEOUT, help= "Maximum time to wait for out-of-band he\
lper")

POWER_DELAY_OPT

Value:
cli_option("--power-delay", dest= "power_delay", type= "float", defaul\
t= constants.OOB_POWER_DELAY, help= "Time in seconds to wait between p\
ower-ons")

FORCE_FILTER_OPT

Value:
cli_option("-F", "--filter", dest= "force_filter", action= "store_true\
", default= False, help= ("Whether command argument should be treated"\
 " as filter"))

NO_REMEMBER_OPT

Value:
cli_option("--no-remember", dest= "no_remember", action= "store_true",\
 default= False, help= "Perform but do not record the change" " in the\
 configuration")

PRIMARY_ONLY_OPT

Value:
cli_option("-p", "--primary-only", default= False, action= "store_true\
", help= "Evacuate primary instances only")

SECONDARY_ONLY_OPT

Value:
cli_option("-s", "--secondary-only", default= False, action= "store_tr\
ue", help= "Evacuate secondary instances only" " (applies only to inte\
rnally mirrored" " disk templates, e.g. %s)" % utils.CommaJoin(constan\
ts.DTS_INT_MIRROR))

STARTUP_PAUSED_OPT

Value:
cli_option("--paused", dest= "startup_paused", action= "store_true", d\
efault= False, help= "Pause instance at startup")

TO_GROUP_OPT

Value:
cli_option("--to", dest= "to", metavar= "<group>", help= "Destination \
node group (name or uuid)", default= None, action= "append", completio\
n_suggest= OPT_COMPL_ONE_NODEGROUP)

IGNORE_ERRORS_OPT

Value:
cli_option("-I", "--ignore-errors", default= [], action= "append", des\
t= "ignore_errors", choices= list(constants.CV_ALL_ECODES_STRINGS), he\
lp= "Error code to be ignored")

DISK_STATE_OPT

Value:
cli_option("--disk-state", default= [], dest= "disk_state", action= "a\
ppend", help= ("Specify disk state information in the" " format" " sto\
rage_type/identifier:option=value,...;" " note this is unused for now"\
), type= "identkeyval")

HV_STATE_OPT

Value:
cli_option("--hypervisor-state", default= [], dest= "hv_state", action\
= "append", help= ("Specify hypervisor state information in the" " for\
mat hypervisor:option=value,...;" " note this is unused for now"), typ\
e= "identkeyval")

IGNORE_IPOLICY_OPT

Value:
cli_option("--ignore-ipolicy", dest= "ignore_ipolicy", action= "store_\
true", default= False, help= "Ignore instance policy violations")

RUNTIME_MEM_OPT

Value:
cli_option("-m", "--runtime-memory", dest= "runtime_mem", help= "Sets \
the instance's runtime memory," " ballooning it up or down to the new \
value", default= None, type= "unit", metavar= "<size>")

ABSOLUTE_OPT

Value:
cli_option("--absolute", dest= "absolute", action= "store_true", defau\
lt= False, help= "Marks the grow as absolute instead of the" " (defaul\
t) relative mode")

NETWORK_OPT

Value:
cli_option("--network", action= "store", default= None, dest= "network\
", help= "IP network in CIDR notation")

GATEWAY_OPT

Value:
cli_option("--gateway", action= "store", default= None, dest= "gateway\
", help= "IP address of the router (gateway)")

ADD_RESERVED_IPS_OPT

Value:
cli_option("--add-reserved-ips", action= "store", default= None, dest=\
 "add_reserved_ips", help= "Comma-separated list of" " reserved IPs to\
 add")

REMOVE_RESERVED_IPS_OPT

Value:
cli_option("--remove-reserved-ips", action= "store", default= None, de\
st= "remove_reserved_ips", help= "Comma-delimited list of" " reserved \
IPs to remove")

NETWORK6_OPT

Value:
cli_option("--network6", action= "store", default= None, dest= "networ\
k6", help= "IP network in CIDR notation")

GATEWAY6_OPT

Value:
cli_option("--gateway6", action= "store", default= None, dest= "gatewa\
y6", help= "IP6 address of the router (gateway)")

NOCONFLICTSCHECK_OPT

Value:
cli_option("--no-conflicts-check", dest= "conflicts_check", default= T\
rue, action= "store_false", help= "Don't check for conflicting IPs")

INCLUDEDEFAULTS_OPT

Value:
cli_option("--include-defaults", dest= "include_defaults", default= Fa\
lse, action= "store_true", help= "Include default values")

COMMON_CREATE_OPTS

Value:
[BACKEND_OPT, DISK_OPT, DISK_TEMPLATE_OPT, FILESTORE_DIR_OPT, FILESTOR\
E_DRIVER_OPT, HYPERVISOR_OPT, IALLOCATOR_OPT, NET_OPT, NODE_PLACEMENT_\
OPT, NOIPCHECK_OPT, NOCONFLICTSCHECK_OPT, NONAMECHECK_OPT, NONICS_OPT,\
 NWSYNC_OPT, OSPARAMS_OPT, OS_SIZE_OPT, SUBMIT_OPT, TAG_ADD_OPT, DRY_R\
UN_OPT, PRIORITY_OPT,]

INSTANCE_POLICY_OPTS

Value:
[IPOLICY_BOUNDS_SPECS_OPT, IPOLICY_DISK_TEMPLATES, IPOLICY_VCPU_RATIO,\
 IPOLICY_SPINDLE_RATIO,]

SPLIT_ISPECS_OPTS

Value:
[SPECS_CPU_COUNT_OPT, SPECS_DISK_COUNT_OPT, SPECS_DISK_SIZE_OPT, SPECS\
_MEM_SIZE_OPT, SPECS_NIC_COUNT_OPT,]

_DEFAULT_FORMAT_QUERY

Default formatting for query results; (callback, align right)

Value:
{constants.QFT_TEXT:(str, False), constants.QFT_BOOL:(_FormatBool, Fal\
se), constants.QFT_NUMBER:(str, True), constants.QFT_TIMESTAMP:(utils.\
FormatTime, False), constants.QFT_OTHER:(str, False), constants.QFT_UN\
KNOWN:(str, False),}