Trees | Indices | Help |
|
---|
|
Module dealing with command line parsing
|
|||
_Argument | |||
ArgSuggest Suggesting argument. |
|||
ArgChoice Choice argument. |
|||
ArgUnknown Unknown argument to program (e.g. |
|||
ArgInstance Instances argument. |
|||
ArgNode Node argument. |
|||
ArgJobId Job ID argument. |
|||
ArgFile File path argument. |
|||
ArgCommand Command argument. |
|||
ArgHost Host argument. |
|||
ArgOs OS argument. |
|||
CliOption Custom option class for optparse. |
|||
cli_option Custom option class for optparse. |
|||
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 |
|||
JobExecutor Class which manages the submission and execution of multiple jobs. |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
dict |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
list |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
int |
|
||
|
|||
|
|||
string |
|
||
|
|||
|
|||
|
|||
|
|||
|
|
|||
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 |
|||
ARGS_NONE = []
|
|||
ARGS_MANY_INSTANCES = [ArgInstance()]
|
|||
ARGS_MANY_NODES = [ArgNode()]
|
|||
ARGS_ONE_INSTANCE = [ArgInstance(min= 1, max= 1)]
|
|||
ARGS_ONE_NODE = [ArgNode(min= 1, max= 1)]
|
|||
ARGS_ONE_OS = [ArgOs(min= 1, max= 1)]
|
|||
OPT_COMPL_ALL = frozenset([OPT_COMPL_MANY_NODES, OPT_COMPL_ONE
|
|||
_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_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_
|
|||
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"
|
|||
BACKEND_OPT = cli_option("-B", "--backend-parameters", dest= "
|
|||
HVOPTS_OPT = cli_option("-H", "--hypervisor-parameters", type=
|
|||
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=
|
|||
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 = cli_option("-g", "--node-group", dest= "nodegr
|
|||
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
|
|||
NEW_SECONDARY_OPT = cli_option("-n", "--new-secondary", dest=
|
|||
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
|
|||
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
|
|||
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", dest= "yes_do_it", he
|
|||
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
|
|||
GLOBAL_FILEDIR_OPT = cli_option("--file-storage-dir", dest= "f
|
|||
NOMODIFY_ETCHOSTS_OPT = cli_option("--no-etc-hosts", dest= "mo
|
|||
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=
|
|||
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
|
|||
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",
|
|||
COMMON_OPTS = [DEBUG_OPT] Options provided by all commands |
|||
COMMON_CREATE_OPTS = [BACKEND_OPT, DISK_OPT, DISK_TEMPLATE_OPT
|
Imports: sys, textwrap, os, time, logging, StringIO, utils, errors, constants, opcodes, luxi, ssconf, rpc, ssh, compat, netutils, OptionParser, TitledHelpFormatter, Option, OptionValueError
|
Extract the tag type object. Note that this function will modify its args parameter. |
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. |
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. |
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. |
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. |
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, the others will have value=True.
|
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. |
Custom parser class for key=val,key=val options. This will store the parsed values as a dict {key: val}. |
Custom parser for yes/no options. This will store the parsed value as either True or False. |
Parser for the command line arguments. This function parses the arguments and returns the function which must be executed together with its (modified) arguments.
|
Verifies the arguments using the argument definition. Algorithm:
|
Calculates all the names an OS can be called, according to its variants.
|
Parses the values of "--field"-like options.
|
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. |
Ask the user a question.
|
Function to submit an opcode without waiting for the results.
|
Generic job-polling function.
|
Function to poll for the result of a job.
|
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. |
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). |
Processor for generic options. This function updates the given opcodes based on generic command line options (like debug, dry-run, etc.).
|
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). |
Generic main function for all the gnt-* commands. Arguments:
|
Add an instance to the cluster via either creation or import.
|
Calls a function while all cluster daemons are stopped.
|
Prints a table with headers and different fields.
|
Formats a given timestamp.
|
Parse a time specification. The following suffixed will be recognized:
Without any suffix, the value will be taken to be in seconds. |
Returns the names of online nodes. This function will also log a warning on stderr with the names of the online nodes.
|
Write a message to a stream, bypassing the logging system
|
Write a message to stdout only, bypassing the logging system This is just a wrapper over _ToStream.
|
Write a message to stderr only, bypassing the logging system This is just a wrapper over _ToStream.
|
|
_PRIORITY_NAMESPriorities (sorted)
|
OPT_COMPL_ALL
|
DEBUG_OPT
|
NOHDR_OPT
|
SEP_OPT
|
USEUNITS_OPT
|
FIELDS_OPT
|
FORCE_OPT
|
CONFIRM_OPT
|
IGNORE_OFFLINE_OPT
|
TAG_SRC_OPT
|
SUBMIT_OPT
|
SYNC_OPT
|
DRY_RUN_OPT
|
VERBOSE_OPT
|
DEBUG_SIMERR_OPT
|
NWSYNC_OPT
|
DISK_TEMPLATE_OPT
|
NONICS_OPT
|
FILESTORE_DIR_OPT
|
FILESTORE_DRIVER_OPT
|
IALLOCATOR_OPT
|
DEFAULT_IALLOCATOR_OPT
|
OS_OPT
|
OSPARAMS_OPT
|
FORCE_VARIANT_OPT
|
NO_INSTALL_OPT
|
BACKEND_OPT
|
HVOPTS_OPT
|
HYPERVISOR_OPT
|
HVLIST_OPT
|
NOIPCHECK_OPT
|
NONAMECHECK_OPT
|
NET_OPT
|
DISK_OPT
|
DISKIDX_OPT
|
OS_SIZE_OPT
|
IGNORE_CONSIST_OPT
|
NONLIVE_OPT
|
MIGRATION_MODE_OPT
|
NODE_PLACEMENT_OPT
|
NODE_LIST_OPT
|
NODEGROUP_OPT
|
SINGLE_NODE_OPT
|
NOSTART_OPT
|
SHOWCMD_OPT
|
CLEANUP_OPT
|
STATIC_OPT
|
ALL_OPT
|
SELECT_OS_OPT
|
IGNORE_FAILURES_OPT
|
IGNORE_REMOVE_FAILURES_OPT
|
REMOVE_INSTANCE_OPT
|
NEW_SECONDARY_OPT
|
ON_PRIMARY_OPT
|
ON_SECONDARY_OPT
|
AUTO_PROMOTE_OPT
|
AUTO_REPLACE_OPT
|
IGNORE_SIZE_OPT
|
SRC_NODE_OPT
|
SRC_DIR_OPT
|
SECONDARY_IP_OPT
|
READD_OPT
|
NOSSH_KEYCHECK_OPT
|
MC_OPT
|
OFFLINE_OPT
|
DRAINED_OPT
|
CAPAB_MASTER_OPT
|
CAPAB_VM_OPT
|
ALLOCATABLE_OPT
|
NOLVM_STORAGE_OPT
|
ENABLED_HV_OPT
|
NIC_PARAMS_OPT
|
CP_SIZE_OPT
|
VG_NAME_OPT
|
YES_DOIT_OPT
|
NOVOTING_OPT
|
MAC_PREFIX_OPT
|
MASTER_NETDEV_OPT
|
GLOBAL_FILEDIR_OPT
|
NOMODIFY_ETCHOSTS_OPT
|
NOMODIFY_SSH_SETUP_OPT
|
ERROR_CODES_OPT
|
NONPLUS1_OPT
|
REBOOT_TYPE_OPT
|
IGNORE_SECONDARIES_OPT
|
NOSHUTDOWN_OPT
|
TIMEOUT_OPT
|
SHUTDOWN_TIMEOUT_OPT
|
INTERVAL_OPT
|
EARLY_RELEASE_OPT
|
NEW_CLUSTER_CERT_OPT
|
RAPI_CERT_OPT
|
NEW_RAPI_CERT_OPT
|
NEW_CONFD_HMAC_KEY_OPT
|
CLUSTER_DOMAIN_SECRET_OPT
|
NEW_CLUSTER_DOMAIN_SECRET_OPT
|
USE_REPL_NET_OPT
|
MAINTAIN_NODE_HEALTH_OPT
|
IDENTIFY_DEFAULTS_OPT
|
UIDPOOL_OPT
|
ADD_UIDS_OPT
|
REMOVE_UIDS_OPT
|
RESERVED_LVS_OPT
|
ROMAN_OPT
|
DRBD_HELPER_OPT
|
NODRBD_STORAGE_OPT
|
PRIMARY_IP_VERSION_OPT
|
PRIORITY_OPT
|
HID_OS_OPT
|
BLK_OS_OPT
|
PREALLOC_WIPE_DISKS_OPT
|
COMMON_CREATE_OPTS
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Dec 20 13:26:36 2010 | http://epydoc.sourceforge.net |