Module gnt_cluster
source code
Cluster related commands
|
_CheckNoLvmStorageOptDeprecated(opts)
Checks if the legacy option '--no-lvm-storage' is used. |
source code
|
|
|
_InitEnabledDiskTemplates(opts)
Initialize the list of enabled disk templates. |
source code
|
|
|
|
|
_InitDrbdHelper(opts,
enabled_disk_templates)
Initialize the DRBD usermode helper. |
source code
|
|
int
|
|
int
|
|
int
|
|
|
ActivateMasterIp(opts,
args)
Activates the master IP. |
source code
|
|
|
DeactivateMasterIp(opts,
args)
Deactivates the master IP. |
source code
|
|
int
|
|
int
|
|
int
|
|
dict of dicts
|
|
int
|
|
int
|
|
int
|
|
int
|
|
int
|
|
int
|
|
int
|
|
int
|
|
int
|
|
string
|
|
|
_RenewCrypto(new_cluster_cert,
new_rapi_cert,
rapi_cert_filename,
new_spice_cert,
spice_cert_filename,
spice_cacert_filename,
new_confd_hmac_key,
new_cds,
cds_filename,
force)
Renews cluster certificates, keys and secrets. |
source code
|
|
|
RenewCrypto(opts,
args)
Renews cluster certificates, keys and secrets. |
source code
|
|
|
_GetEnabledDiskTemplates(opts)
Determine the list of enabled disk templates. |
source code
|
|
|
|
|
_GetDrbdHelper(opts,
enabled_disk_templates)
Determine the DRBD usermode helper. |
source code
|
|
int
|
|
int
|
|
|
|
int
|
|
|
|
|
|
|
|
|
|
|
_EpoOn(opts,
full_node_list,
node_list,
inst_map)
Does the actual power on. |
source code
|
|
|
|
int
|
Epo(opts,
args,
cl=None,
_on_fn=_EpoOn,
_off_fn=_EpoOff,
_confirm_fn=ConfirmOperation,
_stdout_fn=ToStdout,
_stderr_fn=ToStderr)
EPO operations. |
source code
|
|
|
|
|
|
bool
|
|
list
|
|
bool
|
|
list
|
|
list
|
|
|
|
tuple or None
|
|
(string, string) or (None, None)
|
|
|
|
(bool, list)
|
|
(bool, list)
|
|
int
|
|
int
|
|
|
|
|
ON_OPT = cli_option("--on", default= False, action= "store_tru...
|
|
GROUPS_OPT = cli_option("--groups", default= False, action= "s...
|
|
FORCE_FAILOVER = cli_option("--yes-do-it", dest= "yes_do_it", ...
|
|
FORCE_DISTRIBUTION = cli_option("--yes-do-it", dest= "yes_do_i...
|
|
TO_OPT = cli_option("--to", default= None, type= "string", hel...
|
|
RESUME_OPT = cli_option("--resume", default= False, action= "s...
|
|
_EPO_PING_INTERVAL = 30
|
|
_EPO_PING_TIMEOUT = 1
|
|
_EPO_REACHABLE_TIMEOUT = 15* 60
|
|
commands = {"init":(InitCluster, [ArgHost(min= 1, max= 1)], [B...
|
|
aliases = {"masterfailover": "master-failover", "show": "info",}
dictionary with aliases for commands
|
Imports:
StringIO,
os,
time,
OpenSSL,
tempfile,
itertools,
ARGS_ONE_INSTANCE,
POWER_DELAY_OPT,
NEW_RAPI_CERT_OPT,
OOB_TIMEOUT_OPT,
TO_GROUP_OPT,
MAC_PREFIX_OPT,
IPOLICY_STD_SPECS_OPT,
CONFIRM_OPT,
NOSHUTDOWN_OPT,
SHUTDOWN_TIMEOUT_OPT,
ParseFields,
PRIMARY_IP_VERSION_OPT,
ARGS_NONE,
ARGS_ONE_GROUP,
ARGS_MANY_NODES,
UsesRPC,
ALLOC_POLICY_OPT,
GenericListFields,
NOVOTING_OPT,
INSTANCE_POLICY_OPTS,
ArgUnknown,
ERROR_CODES_OPT,
SPECS_CPU_COUNT_OPT,
SPECS_DISK_SIZE_OPT,
SECONDARY_IP_OPT,
ARGS_ONE_NETWORK,
GATEWAY_OPT,
REMOVE_INSTANCE_OPT,
PrintGenericInfo,
IPOLICY_DISK_TEMPLATES,
FormatTimestamp,
GenerateTable,
ABSOLUTE_OPT,
IGNORE_SIZE_OPT,
COMMON_CREATE_OPTS,
READD_OPT,
NO_REMEMBER_OPT,
SUBMIT_OPTS,
ConfirmOperation,
SubmitOrSend,
RAPI_CERT_OPT,
GATEWAY6_OPT,
HV_STATE_OPT,
HOTPLUG_IF_POSSIBLE_OPT,
ARGS_MANY_NETWORKS,
FILESTORE_DIR_OPT,
RUNTIME_MEM_OPT,
ROMAN_OPT,
SEP_OPT,
RESERVED_LVS_OPT,
USE_EXTERNAL_MIP_SCRIPT,
GLOBAL_SHARED_FILEDIR_OPT,
FormatPolicyInfo,
NOMODIFY_SSH_SETUP_OPT,
GenericInstanceCreate,
SubmitOpCodeToDrainedQueue,
ArgChoice,
NODE_FORCE_JOIN_OPT,
DRY_RUN_OPT,
CAPAB_VM_OPT,
NODE_POWERED_OPT,
NODE_PLACEMENT_OPT,
JobExecutor,
FixHvParams,
ToStderr,
SELECT_OS_OPT,
SINGLE_NODE_OPT,
ArgExtStorage,
ArgOs,
SPICE_CACERT_OPT,
PrintIPolicyCommand,
IGNORE_ERRORS_OPT,
AUTO_REPLACE_OPT,
HVLIST_OPT,
cli_option,
AskUser,
ENABLED_DISK_TEMPLATES_OPT,
DISK_STATE_OPT,
USEUNITS_OPT,
EARLY_RELEASE_OPT,
VERBOSE_OPT,
ArgHost,
UIDPOOL_OPT,
ALL_OPT,
HOTPLUG_OPT,
CalculateOSNames,
OS_OPT,
ARGS_ONE_NODE,
ArgCommand,
FAILURE_ONLY_OPT,
ALLOW_FAILOVER_OPT,
NOSTART_OPT,
SPECS_NIC_COUNT_OPT,
OS_SIZE_OPT,
DEBUG_OPT,
ON_PRIMARY_OPT,
JobSubmittedException,
SUBMIT_OPT,
MASTER_NETMASK_OPT,
SPICE_CERT_OPT,
NEW_CLUSTER_CERT_OPT,
INTERVAL_OPT,
ToStdout,
FORCE_FILTER_OPT,
OSPARAMS_OPT,
AddTags,
NONICS_OPT,
NODE_PARAMS_OPT,
ArgNetwork,
RunWhileClusterStopped,
BLK_OS_OPT,
GLOBAL_FILEDIR_OPT,
SRC_NODE_OPT,
CAPAB_MASTER_OPT,
MODIFY_ETCHOSTS_OPT,
SPECS_MEM_SIZE_OPT,
TAG_SRC_OPT,
NOSSH_KEYCHECK_OPT,
NET_OPT,
IGNORE_FAILURES_OPT,
ADD_UIDS_OPT,
MASTER_NETDEV_OPT,
USE_REPL_NET_OPT,
NODEGROUP_OPT,
SRC_DIR_OPT,
SYNC_OPT,
IDENTIFY_DEFAULTS_OPT,
REMOVE_UIDS_OPT,
HYPERVISOR_OPT,
IGNORE_IPOLICY_OPT,
MC_OPT,
ONLINE_INST_OPT,
IGNORE_SECONDARIES_OPT,
SplitNodeOption,
NOLVM_STORAGE_OPT,
REBOOT_TYPE_OPT,
NONPLUS1_OPT,
IGNORE_CONSIST_OPT,
NOHDR_OPT,
NEW_SPICE_CERT_OPT,
TAG_ADD_OPT,
SPECS_DISK_COUNT_OPT,
NONLIVE_OPT,
ARGS_ONE_OS,
DISK_OPT,
PRIMARY_ONLY_OPT,
RemoveTags,
AUTO_PROMOTE_OPT,
ListTags,
DEFAULT_IALLOCATOR_OPT,
NEW_PRIMARY_OPT,
FORCE_VARIANT_OPT,
GetOnlineNodes,
NETWORK_OPT,
TIMEOUT_OPT,
NODE_LIST_OPT,
GenericList,
ON_SECONDARY_OPT,
FormatLogMessage,
ArgInstance,
CLEANUP_OPT,
CreateIPolicyFromOpts,
MIGRATION_MODE_OPT,
NIC_PARAMS_OPT,
NOIPCHECK_OPT,
ArgJobId,
SEQUENTIAL_OPT,
DRBD_HELPER_OPT,
DEBUG_SIMERR_OPT,
STATIC_OPT,
DISK_TEMPLATE_OPT,
FORCE_FAILOVER_OPT,
ARGS_MANY_GROUPS,
REASON_OPT,
NO_INSTALL_OPT,
YES_DOIT_OPT,
FORCE_OPT,
PRINT_JOBID_OPT,
SHOWCMD_OPT,
SPLIT_ISPECS_OPTS,
ArgGroup,
OFFLINE_INST_OPT,
NWSYNC_OPT,
NOCONFLICTSCHECK_OPT,
PRIORITY_OPT,
SECONDARY_ONLY_OPT,
NEW_CLUSTER_DOMAIN_SECRET_OPT,
FormatParamsDictInfo,
SubmitOpCode,
DRAINED_OPT,
ParseTimespec,
REMOVE_RESERVED_IPS_OPT,
GenericMain,
ArgFile,
WFSYNC_OPT,
NORUNTIME_CHGS_OPT,
ArgNode,
IGNORE_REMOVE_FAILURES_OPT,
CP_SIZE_OPT,
ADD_RESERVED_IPS_OPT,
CLUSTER_DOMAIN_SECRET_OPT,
HID_OS_OPT,
SHOW_MACHINE_OPT,
ALLOCATABLE_OPT,
ARGS_MANY_INSTANCES,
PREALLOC_WIPE_DISKS_OPT,
NONAMECHECK_OPT,
FormatQueryResult,
FormatError,
GetClient,
MAINTAIN_NODE_HEALTH_OPT,
ArgSuggest,
HVOPTS_OPT,
IPOLICY_VCPU_RATIO,
OFFLINE_OPT,
NETWORK6_OPT,
NOMODIFY_ETCHOSTS_OPT,
ENABLED_HV_OPT,
NEW_SECONDARY_OPT,
IGNORE_OFFLINE_OPT,
VG_NAME_OPT,
DISK_PARAMS_OPT,
FIELDS_OPT,
DST_NODE_OPT,
IALLOCATOR_OPT,
NEW_CONFD_HMAC_KEY_OPT,
FILESTORE_DRIVER_OPT,
INCLUDEDEFAULTS_OPT,
STARTUP_PAUSED_OPT,
DISKIDX_OPT,
BACKEND_OPT,
opcodes,
constants,
errors,
utils,
bootstrap,
ssh,
objects,
uidpool,
compat,
netutils,
ssconf,
pathutils,
serializer,
qlang
Initialize the volume group name.
- Parameters:
enabled_disk_templates (list of strings) - cluster-wide enabled disk templates
|
Initialize the cluster.
- Parameters:
opts - the command line options selected by the user
args (list) - should contain only one element, the desired cluster name
- Returns: int
- the desired exit code
- Decorators:
|
Destroy the cluster.
- Parameters:
opts - the command line options selected by the user
args (list) - should be an empty list
- Returns: int
- the desired exit code
- Decorators:
|
Rename the cluster.
- Parameters:
opts - the command line options selected by the user
args (list) - should contain only one element, the new cluster name
- Returns: int
- the desired exit code
|
Forces push of the cluster configuration.
- Parameters:
opts - the command line options selected by the user
args (list) - empty list
- Returns: int
- the desired exit code
|
Write version of ganeti software to the standard output.
- Parameters:
opts - the command line options selected by the user
args (list) - should be an empty list
- Returns: int
- the desired exit code
|
Write name of master node to the standard output.
- Parameters:
opts - the command line options selected by the user
args (list) - should be an empty list
- Returns: int
- the desired exit code
|
_FormatGroupedParams(paramsdict,
roman=False)
| source code
|
Format Grouped parameters (be, nic, disk) by group.
- Parameters:
paramsdict (dict of dicts) - {group: {param: value, ...}, ...}
- Returns: dict of dicts
- copy of the input dictionaries with strings as values
|
Shows cluster information.
- Parameters:
opts - the command line options selected by the user
args (list) - should be an empty list
- Returns: int
- the desired exit code
|
Copy a file from master to some nodes.
- Parameters:
opts - the command line options selected by the user
args (list) - should contain only one element, the path of the file to be
copied
- Returns: int
- the desired exit code
|
Run a command on some nodes.
- Parameters:
opts - the command line options selected by the user
args (list) - should contain the command to be run and its arguments
- Returns: int
- the desired exit code
|
Verify integrity of cluster, performing various test on nodes.
- Parameters:
opts - the command line options selected by the user
args (list) - should be an empty list
- Returns: int
- the desired exit code
|
Verify integrity of cluster disks.
- Parameters:
opts - the command line options selected by the user
args (list) - should be an empty list
- Returns: int
- the desired exit code
|
Verify sizes of cluster disks.
- Parameters:
opts - the command line options selected by the user
args (list) - optional list of instances to restrict check to
- Returns: int
- the desired exit code
|
Failover the master node.
This command, when run on a non-master node, will cause the current
master to cease being master, and the non-master to become new
master.
- Parameters:
opts - the command line options selected by the user
args (list) - should be an empty list
- Returns: int
- the desired exit code
- Decorators:
|
Checks if the master is alive.
- Parameters:
opts - the command line options selected by the user
args (list) - should be an empty list
- Returns: int
- the desired exit code
|
Searches the tags on all the cluster.
- Parameters:
opts - the command line options selected by the user
args (list) - should contain only one element, the tag pattern
- Returns: int
- the desired exit code
|
_ReadAndVerifyCert(cert_filename,
verify_private_key=False)
| source code
|
Reads and verifies an X509 certificate.
- Parameters:
cert_filename (string) - the path of the file containing the certificate to verify encoded
in PEM format
verify_private_key (bool) - whether to verify the private key in addition to the public
certificate
- Returns: string
- a string containing the PEM-encoded certificate.
|
_RenewCrypto(new_cluster_cert,
new_rapi_cert,
rapi_cert_filename,
new_spice_cert,
spice_cert_filename,
spice_cacert_filename,
new_confd_hmac_key,
new_cds,
cds_filename,
force)
| source code
|
Renews cluster certificates, keys and secrets.
- Parameters:
new_cluster_cert (bool) - Whether to generate a new cluster certificate
new_rapi_cert (bool) - Whether to generate a new RAPI certificate
rapi_cert_filename (string) - Path to file containing new RAPI certificate
new_spice_cert (bool) - Whether to generate a new SPICE certificate
spice_cert_filename (string) - Path to file containing new SPICE certificate
spice_cacert_filename (string) - Path to file containing the certificate of the CA that signed the
SPICE certificate
new_confd_hmac_key (bool) - Whether to generate a new HMAC key
new_cds (bool) - Whether to generate a new cluster domain secret
cds_filename (string) - Path to file containing new cluster domain secret
force (bool) - Whether to ask user for confirmation
|
Determine the volume group name.
- Parameters:
enabled_disk_templates (list of strings) - cluster-wide enabled disk-templates
|
Modify the cluster.
- Parameters:
opts - the command line options selected by the user
args (list) - should be an empty list
- Returns: int
- the desired exit code
|
Queue operations.
- Parameters:
opts - the command line options selected by the user
args (list) - should contain only one element, the subcommand
- Returns: int
- the desired exit code
|
Watcher operations.
- Parameters:
opts - the command line options selected by the user
args (list) - should contain only one element, the subcommand
- Returns: int
- the desired exit code
|
Puts the node in the list to desired power state.
- Parameters:
opts - The command line options selected by the user
node_list - The list of nodes to operate on
power - True if they should be powered on, False otherwise
- Returns:
- The success of the operation (none failed)
|
_InstanceStart(opts,
inst_list,
start,
no_remember=False)
| source code
|
Puts the instances in the list to desired state.
- Parameters:
opts - The command line options selected by the user
inst_list - The list of instances to operate on
start - True if they should be started, False for shutdown
no_remember - If the instance state should be remembered
- Returns:
- The success of the operation (none failed)
|
_RunWhenNodesReachable(node_list,
action_cb,
interval)
| source code
|
Run action_cb when nodes become reachable.
- Parameters:
node_list - The list of nodes to be reachable
action_cb - Callback called when a new host is reachable
interval - The earliest time to retry
|
_MaybeInstanceStartup(opts,
inst_map,
nodes_online,
_instance_start_fn=_InstanceStart)
| source code
|
Start the instances conditional based on node_states.
- Parameters:
opts - The command line options selected by the user
inst_map - A dict of inst -> nodes mapping
nodes_online - A list of nodes online
_instance_start_fn - Callback to start instances (unittest use only)
- Returns:
- Success of the operation on all instances
|
_EpoOn(opts,
full_node_list,
node_list,
inst_map)
| source code
|
Does the actual power on.
- Parameters:
opts - The command line options selected by the user
full_node_list - All nodes to operate on (includes nodes not supporting OOB)
node_list - The list of nodes to operate on (all need to support OOB)
inst_map - A dict of inst -> nodes mapping
- Returns:
- The desired exit status
|
Does the actual power off.
- Parameters:
opts - The command line options selected by the user
node_list - The list of nodes to operate on (all need to support OOB)
inst_map - A dict of inst -> nodes mapping
- Returns:
- The desired exit status
|
Epo(opts,
args,
cl=None,
_on_fn=_EpoOn,
_off_fn=_EpoOff,
_confirm_fn=ConfirmOperation,
_stdout_fn=ToStdout,
_stderr_fn=ToStderr)
| source code
|
EPO operations.
- Parameters:
opts - the command line options selected by the user
args (list) - should contain only one element, the subcommand
- Returns: int
- the desired exit code
|
Shows the command that can be used to re-create the cluster.
Currently it works only for ipolicy specs.
|
Run a command and report its output, iff it failed.
- Parameters:
cmd (list) - the command to execute
- Returns: bool
- False, if the execution failed.
|
Verify that a given command succeeds on all online nodes.
As this function is intended to run during upgrades, it is implemented
in such a way that it still works, if all Ganeti daemons are down.
- Parameters:
cmd (list) - the command to execute
- Returns: list
- the list of node names that are online where the command failed.
|
Verify that the given version of ganeti is installed on all online
nodes.
Do nothing, if this is the case, otherwise print an appropriate
message to stderr.
- Parameters:
versionstring (string) - the version to check for
- Returns: bool
- True, if the version is installed on all online nodes
|
Determine the list of running jobs.
- Returns: list
- the number of jobs still running
|
Set the active version of ganeti to the given versionstring
- Parameters:
- Returns: list
- the list of nodes where the version change failed
|
Execute a list of functions, in reverse order.
- Parameters:
fns (list of functions.) - the functions to be executed.
|
Determine the version the configuration file currently has.
- Returns: tuple or None
- (major, minor, revision) if the version can be determined, None
otherwise
|
Read the file documenting the intent to upgrade the cluster.
- Returns: (string, string) or (None, None)
- (old version, version to upgrade to), if the file exists, and
(None, None) otherwise.
|
Write file documenting the intent to upgrade the cluster.
- Parameters:
version (string) - the version we intent to upgrade to
|
_UpgradeBeforeConfigurationChange(versionstring)
| source code
|
Carry out all the tasks necessary for an upgrade that happen before
the configuration file, or Ganeti version, changes.
- Parameters:
versionstring (string) - the version to upgrade to
- Returns: (bool, list)
- tuple of a bool indicating success and a list of rollback tasks
|
_SwitchVersionAndConfig(versionstring,
downgrade)
| source code
|
Switch to the new Ganeti version and change the configuration, in
correct order.
- Parameters:
versionstring (string) - the version to change to
downgrade (bool) - True, if the configuration should be downgraded
- Returns: (bool, list)
- tupe of a bool indicating success, and a list of additional
rollback tasks
|
_UpgradeAfterConfigurationChange(oldversion)
| source code
|
Carry out the upgrade actions necessary after switching to the new
Ganeti version and updating the configuration.
As this part is run at a time where the new version of Ganeti is
already running, no communication should happen via luxi, as this is not
a stable interface. Also, as the configuration change is the point of no
return, all actions are pushed trough, even if some of them fail.
- Parameters:
oldversion (string) - the version the upgrade started from
- Returns: int
- the intended return value
|
Upgrade a cluster to a new ganeti version.
- Parameters:
opts - the command line options selected by the user
args (list) - should be an empty list
- Returns: int
- the desired exit code
|
ON_OPT
- Value:
cli_option("--on", default= False, action= "store_true", dest= "on", h
elp= "Recover from an EPO")
|
|
GROUPS_OPT
- Value:
cli_option("--groups", default= False, action= "store_true", dest= "gr
oups", help= "Arguments are node groups instead of nodes")
|
|
FORCE_FAILOVER
- Value:
cli_option("--yes-do-it", dest= "yes_do_it", help= "Override interacti
ve check for --no-voting", default= False, action= "store_true")
|
|
FORCE_DISTRIBUTION
- Value:
cli_option("--yes-do-it", dest= "yes_do_it", help= "Unconditionally di
stribute the" " configuration, even if the queue" " is drained", defau
lt= False, action= "store_true")
|
|
TO_OPT
- Value:
cli_option("--to", default= None, type= "string", help= "The Ganeti ve
rsion to upgrade to")
|
|
RESUME_OPT
- Value:
cli_option("--resume", default= False, action= "store_true", help= "Re
sume any pending Ganeti upgrades")
|
|
commands
- Value:
{"init":(InitCluster, [ArgHost(min= 1, max= 1)], [BACKEND_OPT, CP_SIZE
_OPT, ENABLED_HV_OPT, GLOBAL_FILEDIR_OPT, HVLIST_OPT, MAC_PREFIX_OPT,
MASTER_NETDEV_OPT, MASTER_NETMASK_OPT, NIC_PARAMS_OPT, NOLVM_STORAGE_O
PT, NOMODIFY_ETCHOSTS_OPT, NOMODIFY_SSH_SETUP_OPT, SECONDARY_IP_OPT, V
G_NAME_OPT, MAINTAIN_NODE_HEALTH_OPT, UIDPOOL_OPT, DRBD_HELPER_OPT, DE
FAULT_IALLOCATOR_OPT, PRIMARY_IP_VERSION_OPT, PREALLOC_WIPE_DISKS_OPT,
NODE_PARAMS_OPT, GLOBAL_SHARED_FILEDIR_OPT, USE_EXTERNAL_MIP_SCRIPT,
DISK_PARAMS_OPT, HV_STATE_OPT, DISK_STATE_OPT, ENABLED_DISK_TEMPLATES_
...
|
|