Trees | Indices | Help |
|
---|
|
Functions used by the node daemon
|
|||
RPCFail Class denoting RPC failure. |
|||
HooksRunner Hook runner. |
|||
IAllocatorRunner IAllocator runner. |
|||
DevCacheManager Simple class for managing a cache of block device information. |
|
|||
string |
|
||
None |
|
||
|
|||
ssconf.SimpleStore |
|
||
ssh.SshRunner |
|
||
str |
|
||
|
|||
|
|||
tuple |
|
||
string |
|
||
|
|||
|
|||
|
|||
|
|||
None |
|
||
|
|||
None |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
dict |
|
||
|
|||
|
|||
None or dict |
|
||
tuple; (string, None/dict, None/dict) |
|
||
|
|||
|
|||
list of tuples (string, list of strings) |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
dict |
|
||
list of tuples (string, string) |
|
||
bool |
|
||
|
|||
|
|||
|
|||
list of string |
|
||
list of string |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
dict |
|
||
dict |
|
||
dict |
|
||
list |
|
||
boolean |
|
||
list |
|
||
list |
|
||
dict |
|
||
tuple |
|
||
dict |
|
||
dict |
|
||
|
|||
None |
|
||
boolean |
|
||
|
|||
|
|||
|
|||
string |
|
||
list |
|
||
|
|||
|
|||
None |
|
||
None |
|
||
None |
|
||
None |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
objects.MigrationStatus |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
NoneType |
|
||
NoneType |
|
||
|
|||
NoneType |
|
||
|
|||
boolean |
|
||
|
|||
str or boolean |
|
||
None |
|
||
None |
|
||
None |
|
||
disk |
|
||
disk |
|
||
|
|||
|
|||
None or objects.BlockDevStatus |
|
||
list |
|
||
None |
|
||
|
|||
tuple |
|
||
list of objects.OS |
|
||
tuple |
|
||
objects.OS |
|
||
dict |
|
||
dict |
|
||
list of objects.ExtStorage |
|
||
(status, result) |
|
||
string |
|
||
(status, result) |
|
||
None |
|
||
objects.SerializableConfigParser |
|
||
list |
|
||
None |
|
||
boolean |
|
||
|
|||
tuple |
|
||
tuple (success,) |
|
||
tuple (success,) |
|
||
None |
|
||
boolean |
|
||
tuple |
|
||
tuple (success, message) |
|
||
|
|||
None |
|
||
|
|||
NoneType |
|
||
boolean |
|
||
string |
|
||
|
|||
|
|||
tuple; (string, string) |
|
||
|
|||
|
|||
|
|||
|
|||
List of dicts |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
tuple; (boolean, string or None) |
|
||
tuple; (boolean, string or os.stat result)
|
|
||
tuple; (boolean, string or None) |
|
||
tuple; (boolean, string) |
|
||
|
|||
string |
|
||
|
|||
|
|||
tuple of bool, dict |
|
|
|||
_BOOT_ID_PATH = "/proc/sys/kernel/random/boot_id"
|
|||
_ALLOWED_CLEAN_DIRS = compat.UniqueFrozenset([pathutils.DATA_D denotes which directories are accepted in the _CleanDirectory function |
|||
_MAX_SSL_CERT_VALIDITY = 7* 24* 60* 60
|
|||
_X509_KEY_FILE = "key"
|
|||
_X509_CERT_FILE = "cert"
|
|||
_IES_STATUS_FILE = "status"
|
|||
_IES_PID_FILE = "pid"
|
|||
_IES_CA_FILE = "ca"
|
|||
_LVSLINE_REGEX = re.compile(r"^ *([^|]+)\|([^|]+)\|([0-9.]+)\| Valid LVS output line regex |
|||
_MASTER_START = "start"
|
|||
_MASTER_STOP = "stop"
|
|||
_RCMD_MAX_MODE = stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | Maximum file permissions for restricted command directory and executables |
|||
_RCMD_INVALID_DELAY = 10 Delay before returning an error for restricted commands |
|||
_RCMD_LOCK_TIMEOUT = _RCMD_INVALID_DELAY* 0.8 How long to wait to acquire lock for restricted commands (shorter than _RCMD_INVALID_DELAY) to reduce blockage of noded forks when many command requests arrive |
|||
_ALLOWED_UPLOAD_FILES = _BuildUploadFileList() denotes which files are accepted in the UploadFile function |
|||
_STORAGE_TYPE_INFO_FN = {constants.ST_BLOCK: None, constants.S
|
|||
SshAddNodeInfo = collections.namedtuple("SshAddNodeInfo", ["uu
|
|||
SshRemoveNodeInfo = collections.namedtuple("SshRemoveNodeInfo"
|
Imports: base64, errno, logging, os, pycurl, random, re, shutil, signal, stat, tempfile, time, zlib, contextlib, collections, errors, http, utils, ssh, hypervisor, hv_base, constants, bdev, drbd, extstorage, filestorage, objects, ssconf, serializer, netutils, runtime, compat, pathutils, vcluster, ht, BlockDev, DRBD8, hooksmaster, metad
|
Path of the file containing the reason of the instance status change.
|
Serialize a reason trail related to an instance change of state to file. The exact location of the file depends on the name of the instance and on the configuration of the Ganeti cluster defined at deploy time.
|
Log an error and the raise an RPCFail exception. This exception is then handled specially in the ganeti daemon and turned into a 'failed' return type. As such, this function is a useful shortcut for logging the error and returning it to the master daemon.
|
Simple wrapper to return a SimpleStore.
|
Simple wrapper to return an SshRunner.
|
Unpacks data compressed by the RPC client.
|
Removes all regular files in a directory.
|
Build the list of allowed upload files. This is abstracted so that it's built only once at module import time. |
Removes job queue files and archived jobs.
|
Returns the master node name.
|
Decorator that runs hooks before and after the decorated function.
|
Builds environment variables for master IP hooks.
|
Execute the master IP address setup script.
|
Activate the IP address of the master daemon.
|
Activate local node as master node. The function will start the master daemons (ganeti-masterd and ganeti-rapi).
|
Deactivate the master IP on this node.
|
Stop the master daemons on this node. Stop the master daemons (ganeti-masterd and ganeti-rapi) on this node.
|
Change the netmask of the master IP.
|
Modify a host entry in /etc/hosts.
|
Cleans up and remove the current node. This function cleans up and prepares the current node to be removed from the cluster. If processing is successful, then it raises an errors.QuitGanetiException which is used as a special case to shutdown the node daemon.
|
Performs sanity checks for storage parameters.
|
Performs sanity check for the 'exclusive storage' flag. See Also:
|
Wrapper around
|
Wrapper around See Also:
|
Retrieves information about spindles in an LVM volume group.
|
Retrieves node information from a hypervisor. The information returned depends on the hypervisor. Common items:
|
Retrieves node information for all hypervisors. See
|
Gives back a hash with different information about the node.
|
Wrapper around filestorage.GetSpaceInfo. The purpose of this wrapper is to call filestorage.GetFileStorageSpaceInfo and ignore the *args parameter to not leak it into the filestorage module's code. See Also:
|
Looks up and applies the correct function to calculate free and total storage for the given storage type.
|
Check that PVs are not shared among LVs
|
Verifies the hypervisor. Appends the results to the 'results' list.
|
Verifies the hvparams. Appends the results to the 'results' list.
|
Verifies the instance list.
|
Verifies the node info.
|
Verify the existance and validity of the client SSL certificate. Also, verify that the client certificate is not self-signed. Self- signed client certificates stem from Ganeti versions 2.12.0 - 2.12.4 and should be replaced by client certificates signed by the server certificate. Hence we output a warning when we encounter a self-signed one. |
Verifies the state of the SSH key files.
|
Verifies that the 'authorized_keys' files are not cluttered up.
|
Verify the status of the local node. Based on the input If the filelist key is present, this list of files is checksummed and the file/checksum pairs are returned. If the nodelist key is present, we check that we have connectivity via ssh with the target nodes (and check the hostname report). If the node-net-test key is present, we check that we have connectivity to the given nodes via both primary IP and, if applicable, secondary IPs.
|
Perform actions on the node's cryptographic tokens. Token types can be 'ssl' or 'ssh'. So far only some actions are implemented for 'ssl'. Action 'get' returns the digest of the public client ssl certificate. Action 'create' creates a new client certificate and private key and also returns the digest of the certificate. The third parameter of a token request are optional parameters for the actions, so far only the filename is supported.
|
Ensures the given daemon is running or stopped.
|
Distributes a node's public SSH key across the cluster. Note that this function should only be executed on the master node, which then will copy the new node's key to all nodes in the cluster via SSH. Also note: at least one of the flags
|
Distributes a node's public SSH key across the cluster. Note that this function should only be executed on the master node, which then will copy the new node's key to all nodes in the cluster via SSH. Also note: at least one of the flags
|
Removes the node's SSH keys from the key files and distributes those. Note that at least one of the flags
|
Removes the node's SSH keys from the key files and distributes those. Note that at least one of the flags
|
Removes a SSH key from the master's public key file. This is an operation that is only used to clean up after failed operations (for example failed hooks before adding a node). To avoid abuse of this function (and the matching RPC call), we add a safety check to make sure that only stray keys can be removed that belong to nodes that are not in the cluster (anymore).
|
Generates the root SSH key pair on the node.
|
Renews all SSH keys and updates authorized_keys and ganeti_pub_keys.
|
Return the size of the given block devices
|
Compute list of logical volumes and their size.
|
List the volume groups and their size.
|
List all volumes on this node.
|
Check if a list of bridges exist on the current node.
|
Provides a list of instances of the given hypervisor.
|
Provides a list of instances.
|
Gives back the information about an instance as a dictionary.
|
Computes whether an instance can be migrated.
|
Gather data about all instances. This is the equivalent of GetInstanceInfo, except that it computes data for all instances at once, thus being faster if one needs data about more than one instance.
|
Gather data about the console access of a set of instances of this node. This function assumes that the caller already knows which instances are on this node, by calling a function such as GetAllInstancesInfo or GetInstanceList. For every instance, a large amount of configuration data needs to be provided to the hypervisor interface in order to receive the console information. Whether this could or should be cut down can be discussed. The information is provided in a dictionary indexed by instance name, allowing any number of instance queries to be done.
|
Compute the OS log filename for a given instance and operation. The instance name and os name are passed in as strings since not all operations have these as part of an instance object.
|
Add an OS to an instance.
|
Run the OS rename script for an instance.
|
Set up symlinks to a instance's block device. This is an auxiliary function run when an instance is start (on the primary node) or when an instance is migrated (on the target node).
|
Get the URI for the device.
|
Set up an instance's block device(s). This is run on the primary node at instance startup. The block devices must be already assembled.
|
Start an instance.
|
Shut an instance down.
Note: this functions uses polling with a hardcoded timeout. |
Reboot an instance.
|
Resize an instance's memory.
|
Gather information about an instance to be migrated.
|
Prepare the node to accept an instance.
|
Finalize any preparation to accept an instance.
|
Migrates an instance to another node.
|
Finalize the instance migration on the source node.
|
Get the migration status
|
Hotplug a device Hotplug is currently supported only for KVM Hypervisor.
|
Sends instance data to the metadata daemon. Uses the Luxi transport layer to communicate with the metadata daemon configuration server. It starts the metadata daemon if it is not running. The daemon must be enabled during at configuration time.
|
Creates a block device for an instance.
|
This function images/wipes the device using a local file.
|
This function images a device using a downloaded image file.
|
Copies data from source block device to target. This function gets the export and import commands from the source and target devices respectively, and then concatenates them to a single command using a pipe ("|"). Finally, executes the unified command that will transfer the data between the devices during the disk template conversion operation.
|
Wipes a block device.
|
Images a block device either by dumping a local file or downloading a URL.
|
Pause or resume the sync of the block device.
|
Remove a block device.
Note: This is intended to be called recursively. |
Activate a block device for an instance. This is run on the primary and secondary nodes for an instance.
Note: this function is called recursively. |
Activate a block device for an instance. This is a wrapper over _RecursiveAssembleBD.
|
Shut down a block device. First, if the device is assembled (Attach() is successful), then the device is shutdown. Then the children of the device are shutdown. This function is called recursively. Note that we don't cache the children or such, as oppossed to assemble, shutdown of different devices doesn't require that the upper device was active.
|
Extend a mirrored block device.
|
Shrink a mirrored block device.
|
Get the mirroring status of a list of devices.
|
Get the mirroring status of a list of devices.
|
Check if a device is activated. If so, return information about the real device.
|
Opens the underlying block device of a disk.
|
Check if a device is activated. If it is, return information about the real device.
|
Computes the size of the given disks. If a disk is not found, returns None instead.
|
Write a file to the filesystem. This allows the master to overwrite(!) a file. It will only perform the operation if the file belongs to a list of configuration files.
|
Executes oob_program with given command on given node.
|
Compute and return the API version of a given OS. This function will try to read the API version of the OS residing in the 'os_dir' directory.
|
Compute the validity for all OSes.
|
Create an OS instance from disk. This function will return an OS instance if the given name is a valid OS name.
|
Create an OS instance from disk. This function will return an OS instance if the given name is a valid OS name. Otherwise, it will raise an appropriate RPCFail exception, detailing why this is not a valid OS. This is just a wrapper over _TryOSFromDisk, which doesn't raise an exception but returns true/false status data.
|
Calculate the basic environment for an os script.
|
Calculate the environment for an os script.
|
Compute the validity for all ExtStorage Providers.
|
Grow a stack of block devices. This function is called recursively, with the childrens being the first ones to resize.
|
Create a snapshot copy of a block device. This function is called recursively, and the snapshot is actually created just for the leaf lvm backend device.
|
Sets 'metadata' information on block devices. This function sets 'info' metadata on block devices. Initial information is set at device creation; this function should be used for example after renames.
|
Write out the export configuration information.
|
Get export configuration information.
|
Return a list of exports currently available on this machine.
|
Remove an existing export from the node.
|
Rename a list of block devices.
|
Checks whether given file_storage_dir is valid. Checks wheter the given fs_dir is within the cluster-wide default file_storage_dir or the shared_file_storage_dir, which are stored in SimpleStore. Only paths under those directories are allowed.
|
Create file storage directory.
|
Remove file storage directory. Remove it only if it's empty. If not log an error and return.
|
Rename the file storage directory.
|
Checks whether the given filename is in the queue directory.
|
Updates a file in the queue directory. This is just a wrapper over utils.io.WriteFile, with proper checking.
|
Renames a job queue file. This is just a wrapper over os.rename with proper checking.
|
Closes the given block devices. This means they will be switched to secondary mode (in case of DRBD).
|
Validates the given hypervisor parameters.
|
Check whether a list of parameters is supported by the OS.
|
Check whether an OS name conforms to the os variants specification.
|
Validate the given OS parameters.
|
Creates a GZIPed tarball with an OS definition and environment. The archive contains a file with the environment variables needed by the OS scripts.
|
Creates a new X509 certificate for SSL/TLS.
|
Removes a X509 certificate.
|
Returns the command for the requested input/output.
|
Starts an import or export daemon.
|
Returns import/export daemon status.
|
Cleanup after an import or export. If the import/export daemon is still running it's killed. Afterwards the whole status directory is removed. |
Finds attached BlockDevs for the given disks.
|
Hard-powercycle the node. Because we need to return first, and schedule the powercycle in the background, we won't be able to report failures nicely. |
Verifies a restricted command name.
|
Common checks for restricted command file system directories and files.
|
Verifies restricted command directory.
|
Verifies a whole restricted command and returns its executable filename.
|
Performs a number of tests on a restricted command.
|
Executes a command after performing strict tests.
|
Creates or removes the watcher pause file.
|
Creates a OpenvSwitch on the node. This function sets up a OpenvSwitch on the node with given name nad connects it via a given eth device.
|
Checks if a file exists and returns information related to it. Currently returned information:
|
|
_ALLOWED_CLEAN_DIRSdenotes which directories are accepted in the _CleanDirectory function
|
_LVSLINE_REGEXValid LVS output line regex
|
_RCMD_MAX_MODEMaximum file permissions for restricted command directory and executables
|
_STORAGE_TYPE_INFO_FN
|
SshAddNodeInfo
|
SshRemoveNodeInfo
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Apr 4 13:43:45 2016 | http://epydoc.sourceforge.net |