The interface to the cluster configuration.
WARNING: The class is no longer thread-safe! Each thread must construct a separate instance.
Static Method |
|
Check if the cluster is configured. |
Method | __init__ |
Undocumented |
Method |
|
Add an instance to the config. |
Method |
|
Add a disk to the config and attach it to instance. |
Method |
|
Add a network to the configuration. |
Method |
|
Add a node to the configuration. |
Method |
|
Add a node group to the configuration. |
Method |
|
Adds an entry to the candidate certificate map. |
Method |
|
Adds a new port to the available port pool. |
Method |
|
Allocate a drbd minor. |
Method |
|
Allocate a port. |
Method |
|
Changes the group of a number of nodes. |
Method |
|
Attach an existing disk to an instance. |
Method |
|
Check IP uniqueness in nodegroup. |
Method |
|
Tell WConfD to commit all temporary ids |
Method |
|
Compute the used DRBD minor/nodes. |
Method |
|
Detach a disk from an instance. |
Method |
|
Check if in there is at disk of the given type in the configuration. |
Method |
|
Undocumented |
Method |
|
Attempt to expand an incomplete instance name. |
Method |
|
Attempt to expand an incomplete node name into a node UUID. |
Method |
|
Force the distribution of configuration to master candidates. |
Method |
|
Force the distribution of configuration to master candidates of a group. |
Method |
|
Generate a DRBD secret. |
Method |
|
Find a free IPv4 address for an instance. |
Method |
|
Generate a MAC for an instance. |
Method |
|
Generate an unique ID. |
Method |
|
Get the configuration of all disks. |
Method |
|
Get the configuration of all disks. |
Method |
|
Get the configuration of all instances. |
Method |
|
Get configuration info of all the networks. |
Method |
|
Get the configuration of all node groups. |
Method |
|
Get the configuration of all node groups expressed as a dictionary of dictionaries. |
Method |
|
Get the configuration of all nodes. |
Method |
|
Returns the candidate certificate map. |
Method |
|
Returns information about the cluster |
Method |
|
Get cluster name. |
Method |
|
Get cluster compression tools |
Method |
|
Returns a ConfigManager, which is suitable to perform a synchronized block of configuration operations. |
Method |
|
Get the configuration version. |
Method |
|
Get the default instance allocator for this cluster. |
Method |
|
Get the default instance allocator parameters for this cluster. |
Method |
|
Returns a detached version of a ConfigManager, which represents a read-only snapshot of the configuration at this particular time. |
Method |
|
Returns information about a disk. |
Method |
|
Return information about a named disk. |
Method |
|
Return DRBD usermode helper. |
Method |
|
Return the dsa hostkey from the config. |
Method |
|
Get the file storage dir for this cluster. |
Method |
|
Get the Gluster storage dir for this cluster. |
Method |
|
Get the disk params populated with inherit chain. |
Method |
|
Locking wrapper of _UnlockedGetGroupNetParams() |
Method |
|
Get a map of group UUIDs to SSH ports. |
Method |
|
Return the hypervisor parameters of the given hypervisor. |
Method |
|
Get the hypervisor type for this cluster. |
Method |
|
Get the install image location |
Method |
|
Get cluster instance communication network |
Method |
|
Get the disk params populated with inherit chain. |
Method |
|
Return the disks' info for the given instance |
Method |
|
Return the disk template of an instance. |
Method |
|
Returns the instance the disk is currently attached to. |
Method |
|
Returns information about an instance. |
Method |
|
Get the objects.Instance object for a named instance. |
Method |
|
Get the list of instances. |
Method |
|
Provide a mapping of node to LVs a given instance owns. |
Method |
|
Gets the instance name for the passed instance. |
Method |
|
Gets the instance names for the passed list of nodes. |
Method |
|
Returns set of network UUIDs for instance's nics. |
Method |
|
Returns set of node group UUIDs for instance's nodes. |
Method |
|
Get all disk-related nodes for an instance. |
Method |
|
Get the list of secondary nodes. |
Method |
|
Get instance configuration with a filter. |
Method |
|
Return the mac prefix. |
Method |
|
Get the number of current and maximum possible candidates. |
Method |
|
Get the list of UUIDs of master candidates. |
Method |
|
Get the IP of the master node for this cluster. |
Method |
|
Get the master network device for this cluster. |
Method |
|
Get the netmask of the master node for this cluster. |
Method |
|
Get network parameters of the master node. |
Method |
|
Get the UUID of the master node for this cluster. |
Method |
|
Get the master node information for this cluster. |
Method |
|
Get the hostname of the master node for this cluster. |
Method |
|
Get the configuration of multiple instances. |
Method |
|
Get the configuration of multiple instances. |
Method |
|
Get the configuration of multiple node groups. |
Method |
|
Get the configuration of multiple nodes. |
Method |
|
Get the node groups params populated with cluster defaults. |
Method |
|
Get the node params populated with cluster defaults. |
Method |
|
Returns information about a network. |
Method |
|
Get the list of networks. |
Method |
|
Get a list of network names |
Method |
|
Lookup a node group. |
Method |
|
Get the objects.NodeGroup object for a named node group. |
Method |
|
Get the instances of a node group. |
Method |
|
Get a list of node groups. |
Method |
|
Get nodes which are member in the same nodegroups as the given nodes. |
Method |
|
Returns groups for a list of nodes. |
Method |
|
Get the configuration of a node, as stored in the config. |
Method |
|
Get the objects.Node object for a named node. |
Method |
|
Get the instances of a node, as stored in the config. |
Method |
|
Return the list of nodes which are in the configuration. |
Method |
|
Gets the node name for the passed node. |
Method |
|
Gets the node names for the passed list of nodes. |
Method |
|
Return the list of nodes' uuids which are not vm capable. |
Method |
|
Return the list of nodes' names which are not vm capable. |
Method |
|
Return the list of nodes which are online. |
Method |
|
Returns a copy of the current port list. |
Method |
|
Gets the list of node names of potential master candidates. |
Method |
|
Get cluster primary ip family. |
Method |
|
Return the rsa hostkey from the config. |
Method |
|
Get the shared file storage dir for this cluster. |
Method |
|
Wrapper using lock around _UnlockedGetSsconf(). |
Method |
|
Get flag representing whether to use the external master IP setup script. |
Method |
|
Return the volume group name. |
Method |
|
Return the list of nodes which are not vm capable. |
Method |
|
Get the zeroing image location |
Method |
|
Lookup a network's UUID. |
Method |
|
Lookup a node group's UUID. |
Method |
|
Try to grow the candidate pool to the desired size. |
Method |
|
Mark the status of instance disks active. |
Method |
|
Mark the status of instance disks inactive. |
Method |
|
Mark the status of an instance to down in the configuration. |
Method |
|
Mark the instance status to down in the config. |
Method |
|
Mark the instance status to up in the config. |
Method |
|
Mark the status of an instance to user down in the configuration. |
Method |
|
Undocumented |
Method |
|
Release temporary drbd minors allocated for a given disk. |
Method |
|
Give a specific IP address back to an IP pool. |
Method |
|
Remove the instance from the configuration. |
Method |
|
Detach a disk from an instance and remove it from the config. |
Method |
|
Remove a network from the configuration. |
Method |
|
Remove a node from the configuration. |
Method |
|
Removes the entry of the given node in the certificate map. |
Method |
|
Remove a node group from the configuration. |
Method |
|
Rename an instance. |
Method |
|
Reserve a given IPv4 address for use by an instance. |
Method |
|
Reserve an VG/LV pair for an instance. |
Method |
|
Reserve a MAC for an instance. |
Method |
|
Replaces the master candidate cert list with the new values. |
Method |
|
Set cluster compression tools |
Method |
|
Sets the logical_id of an existing disk |
Method |
|
Sets the nodes of an existing disk |
Method |
|
Set DRBD usermode helper. |
Method |
|
Set the install image location |
Method |
|
Set cluster instance communication network |
Method |
|
Sets the primary node of an existing instance |
Method |
|
Set the volume group name. |
Method |
|
Notify function to be called after updates. |
Method |
|
Undocumented |
Method |
|
Verify function. |
Method |
|
A simple wrapper around _UnlockedVerifyConfigAndLog |
Instance Variable | write |
Undocumented |
Static Method | _ |
Extends the ssconf_values dictionary by hvparams. |
Static Method | _ |
Per-disk verification checks |
Method | _ |
Undocumented |
Method | _ |
Return all DRBD secrets present in the config. |
Method | _ |
Compute the list of all UUIDs and names we have. |
Method | _ |
Compute the set of all disk-related nodes for an instance. |
Method | _ |
Compute the list of all LVs. |
Method | _ |
Return all MACs present in the config. |
Method | _ |
Compute the list of all NICs. |
Method | _ |
Returns all objects with uuid attributes. |
Method | _ |
Bump up the serial number of the config. |
Method | _ |
Checks that the UUID of the given object is unique. |
Method | _ |
Checks that an object with the given UUID exists. |
Method | _ |
Release resources relating the config data. |
Method | _ |
Undocumented |
Method | _ |
Ensures a given object has a valid UUID. |
Method | _ |
Generate an unique UUID. |
Method | _ |
Get the hvparams of all given hypervisors from the config. |
Method | _ |
Undocumented |
Method | _ |
Undocumented |
Method | _ |
Read the config data from WConfd or disk. |
Method | _ |
Undocumented |
Method | _ |
Set the instance's status to a given value. |
Method | _ |
Add a network to the configuration. |
Method | _ |
Add a node to the configuration. |
Method | _ |
Add a node group to the configuration. |
Method | _ |
Add a given node to the specified group. |
Method | _ |
Drop per-execution-context reservations |
Method | _ |
Undocumented |
Method | _ |
Get the configuration of all disks. |
Method | _ |
Undocumented |
Method | _ |
Get the configuration of all node groups. |
Method | _ |
Gets configuration of all nodes. |
Method | _ |
Returns information about a disk. |
Method | _ |
Return information about a named disk. |
Method | _ |
Get the list of disks. |
Method | _ |
Get the disk params populated with inherit chain down to node-group. |
Method | _ |
Get the netparams (mode, link) of a network. |
Method | _ |
Return the string representation of the list of hyervisor parameters of the given hypervisor. |
Method | _ |
Return the disks' info for the given instance |
Method | _ |
Returns information about an instance. |
Method | _ |
Undocumented |
Method | _ |
Get the list of instances. |
Method | _ |
Provide a mapping of node to LVs a given instance owns. |
Method | _ |
Undocumented |
Method | _ |
Undocumented |
Method | _ |
Get all disk-related nodes for an instance. |
Method | _ |
Get the list of secondary nodes. |
Method | _ |
Get the number of current and maximum desired and possible candidates. |
Method | _ |
Get the list of UUIDs of master candidates. |
Method | _ |
Get the ndparams of the group. |
Method | _ |
Undocumented |
Method | _ |
Returns information about a network. |
Method | _ |
Get the list of networks. |
Method | _ |
Lookup a node group. |
Method | _ |
Get the configuration of a node, as stored in the config. |
Method | _ |
Undocumented |
Method | _ |
Return the list of nodes which are in the configuration. |
Method | _ |
Undocumented |
Method | _ |
Undocumented |
Method | _ |
Return the list of nodes which are online. |
Method | _ |
Return the values needed by ssconf. |
Method | _ |
Undocumented |
Method | _ |
Lookup a network's UUID. |
Method | _ |
Lookup a node group's UUID. |
Method | _ |
Remove the disk from the configuration. |
Method | _ |
Remove a given node from its group. |
Method | _ |
Verify function. |
Method | _ |
Verify the configuration and log any errors. |
Method | _ |
Run any upgrade steps. |
Method | _ |
Write the configuration data to persistent storage. |
Instance Variable | _accept |
Undocumented |
Instance Variable | _all |
a list of all temporary reservation managers |
Instance Variable | _cfg |
Undocumented |
Instance Variable | _cfg |
Undocumented |
Instance Variable | _config |
Undocumented |
Instance Variable | _getents |
Undocumented |
Instance Variable | _lock |
Undocumented |
Instance Variable | _lock |
Undocumented |
Instance Variable | _lock |
Undocumented |
Instance Variable | _my |
Undocumented |
Instance Variable | _offline |
Undocumented |
Instance Variable | _temporary |
Undocumented |
Instance Variable | _wconfd |
Undocumented |
Instance Variable | _wconfdcontext |
Undocumented |
ganeti.config.DetachedConfig
Undocumented
Add an instance to the config.
This should be used after creating a new instance.
Parameters | |
instance:objects.Instance | the instance object |
_ec | Undocumented |
replace:bool | if true, expect the instance to be present and replace rather than add. |
Add a network to the configuration.
Parameters | |
net:objects.Network | the Network object to add |
ec | unique id for the job to use when creating a missing UUID |
check | Undocumented |
Add a node group to the configuration.
This method calls group.UpgradeConfig() to fill any missing attributes according to their default values.
Parameters | |
group:objects.NodeGroup | the NodeGroup object to add |
ec | unique id for the job to use when creating a missing UUID |
check | add an UUID to the group if it doesn't have one or, if it does, ensure that it does not exist in the configuration already |
def AddNodeToCandidateCerts(self, node_uuid, cert_digest, info_fn=logging.info, warn_fn=logging.warn): ¶
Adds an entry to the candidate certificate map.
Parameters | |
node | the node's UUID |
cert | the digest of the node's client SSL certificate |
info | logging function for information messages |
warn | logging function for warning messages |
Allocate a drbd minor.
This is just a wrapper over a call to WConfd.
The free minor will be automatically computed from the existing devices. A node can not be given multiple times. The result is the list of minors, in the same order as the passed nodes.
Parameters | |
node | the nodes in which we allocate minors |
disk | the disk for which we allocate minors |
Returns | |
list of ints | A list of minors in the same order as the passed nodes |
Changes the group of a number of nodes.
Parameters | |
mods:list of tuples; (node name, new group UUID) | Node membership modifications |
Check IP uniqueness in nodegroup.
Check networks that are connected in the node's node group if ip is contained in any of them. Used when creating/adding a NIC to ensure uniqueness among nodegroups.
Parameters | |
ip:string | ip address |
node | node UUID |
Returns | |
(string, dict) or (None, None) | (network name, netparams) |
Compute the used DRBD minor/nodes.
This is just a wrapper over a call to WConfd.
Returns | |
dictionary of node_uuid: dict of minor: instance_uuid; the returned dict will have all the nodes in it (even if with an empty list). |
Force the distribution of configuration to master candidates.
It is not necessary to hold a lock for this operation, it is handled internally by WConfd.
Force the distribution of configuration to master candidates of a group.
It is not necessary to hold a lock for this operation, it is handled internally by WConfd.
Generate an unique ID.
This is just a wrapper over the unlocked version.
Parameters | |
ec | unique id for the job to reserve the id to |
Get the configuration of all disks.
Returns | |
dict | dict of (disk, disk_info), where disk_info is what would GetDiskInfo return for disk |
Get the configuration of all instances.
Returns | |
dict | dict of (instance, instance_info), where instance_info is what would GetInstanceInfo return for the node |
Get the configuration of all nodes.
Returns | |
dict | dict of (node, node_info), where node_info is what would GetNodeInfo return for the node |
Get cluster compression tools
Returns | |
list of string | a list of tools that are cleared for use in this cluster for the purpose of compressing data |
Returns a ConfigManager, which is suitable to perform a synchronized block of configuration operations.
WARNING: This blocks all other configuration operations, so anything that runs inside the block should be very fast, preferably not using any IO.
Get the default instance allocator parameters for this cluster.
Returns | |
dict | dict of iallocator parameters |
Returns a detached version of a ConfigManager, which represents a read-only snapshot of the configuration at this particular time.
Get the disk params populated with inherit chain.
Parameters | |
group:objects.NodeGroup | The group we want to know the params for |
Returns | |
A dict with the filled in disk params |
Get a map of group UUIDs to SSH ports.
Returns | |
dict of str to int | a dict mapping the UUIDs to the SSH ports |
Return the hypervisor parameters of the given hypervisor.
Parameters | |
hvname:string | name of a hypervisor |
Returns | |
string | string containing key-value-pairs, one pair on each line; format: KEY=VALUE |
Get cluster instance communication network
Returns | |
string | instance communication network, which is the name of the network used for instance communication |
Get the disk params populated with inherit chain.
Parameters | |
instance:objects.Instance | The instance we want to know the params for |
Returns | |
A dict with the filled in disk params |
Return the disks' info for the given instance
This is a simple wrapper over _UnlockedGetInstanceDisks
.
Return the disk template of an instance.
This corresponds to the currently attached disks. If no disks are attached, it is constants.DT_DISKLESS
, if homogeneous disk types are attached, that type is returned, if that isn't the case, constants.DT_MIXED
is returned.
Parameters | |
inst | The uuid of the instance. |
Returns the instance the disk is currently attached to.
Parameters | |
disk | the identifier of the disk in question. |
Returns | |
string | uuid of instance the disk is attached to. |
Returns information about an instance.
It takes the information from the configuration file. Other information of an instance are taken from the live systems.
Parameters | |
inst | UUID of the instance |
Returns | |
objects.Instance | the instance object |
Get the objects.Instance
object for a named instance.
Parameters | |
inst | name of the instance to get information for |
Returns | |
the corresponding objects.Instance instance or None if no information is available |
Provide a mapping of node to LVs a given instance owns.
This is a simple wrapper over _UnlockedGetInstanceLVsByNode
Gets the instance name for the passed instance.
Parameters | |
inst | instance UUID to get name for |
Returns | |
string | instance name |
Gets the instance names for the passed list of nodes.
Parameters | |
inst | list of instance UUIDs to get names for |
Returns | |
list of strings | list of instance names |
Get instance configuration with a filter.
Parameters | |
filter | Filter function receiving instance object as parameter, returning boolean. Important: this function is called while the configuration locks is held. It must not do any complex work or call functions potentially leading to a deadlock. Ideally it doesn't call any other functions and just compares instance attributes. |
Get the number of current and maximum possible candidates.
This is just a wrapper over _UnlockedGetMasterCandidateStats
.
Parameters | |
exceptions:list | if passed, list of nodes that should be ignored |
Returns | |
tuple | tuple of (current, max) |
Get the list of UUIDs of master candidates.
Returns | |
list of strings | list of UUIDs of all master candidates. |
Get network parameters of the master node.
Returns | |
object.MasterNetworkParameters | network parameters of the master node |
Get the master node information for this cluster.
Returns | |
objects.Node | Master node objects.Node object |
Get the configuration of multiple instances.
Parameters | |
inst | list of instance UUIDs |
Returns | |
list | list of tuples (instance UUID, instance_info), where instance_info is what would GetInstanceInfo return for the node, while keeping the original order |
Get the configuration of multiple instances.
Parameters | |
inst | list of instance names |
Returns | |
list | list of tuples (instance, instance_info), where instance_info is what would GetInstanceInfo return for the node, while keeping the original order |
Get the configuration of multiple node groups.
Parameters | |
group | List of node group UUIDs |
Returns | |
list | List of tuples of (group_uuid, group_info) |
Get the configuration of multiple nodes.
Parameters | |
node | list of node UUIDs |
Returns | |
list | list of tuples of (node, node_info), where node_info is what would GetNodeInfo return for the node, in the original order |
Get the node groups params populated with cluster defaults.
Parameters | |
nodegroup:objects.NodeGroup | The node group we want to know the params for |
Returns | |
A dict with the filled in node group params |
Get the node params populated with cluster defaults.
Parameters | |
node:objects.Node | The node we want to know the params for |
Returns | |
A dict with the filled in node params |
Returns information about a network.
It takes the information from the configuration file.
Parameters | |
uuid | UUID of the network |
Returns | |
objects.Network | the network object |
Lookup a node group.
Parameters | |
uuid:string | group UUID |
Returns | |
objects.NodeGroup or None | nodegroup object, or None if not found |
Get the objects.NodeGroup
object for a named node group.
Parameters | |
nodegroup | name of the node group to get information for |
Returns | |
the corresponding objects.NodeGroup instance or None if no information is available |
Get the instances of a node group.
Parameters | |
uuid | Node group UUID |
primary | Whether to only consider primary nodes |
Returns | |
frozenset | List of instance UUIDs in node group |
Returns groups for a list of nodes.
Parameters | |
node | List of node UUIDs |
Returns | |
frozenset | Undocumented |
Get the configuration of a node, as stored in the config.
This is just a locked wrapper over _UnlockedGetNodeInfo
.
Parameters | |
node | the node UUID |
Returns | |
objects.Node | the node object |
Get the objects.Node
object for a named node.
Parameters | |
node | name of the node to get information for |
Returns | |
the corresponding objects.Node instance or None if no information is available |
Get the instances of a node, as stored in the config.
Parameters | |
node | the node UUID |
Returns | |
(list, list) | a tuple with two lists: the primary and the secondary instances |
Gets the node name for the passed node.
Parameters | |
nodeobjects.Node object | node to get names for |
Returns | |
string | node name |
Gets the node names for the passed list of nodes.
Parameters | |
nodeobjects.Node objects | list of nodes to get names for |
Returns | |
list of strings | list of node names |
Gets the list of node names of potential master candidates.
Returns | |
list of str | list of node names of potential master candidates |
Lookup a network's UUID.
This function is just a wrapper over _UnlockedLookupNetwork
.
Parameters | |
target:string | network name or UUID |
Returns | |
string | network UUID |
Lookup a node group's UUID.
This function is just a wrapper over _UnlockedLookupNodeGroup
.
Parameters | |
target:string or None | group name or UUID or None to look for the default |
Returns | |
string | nodegroup UUID |
Try to grow the candidate pool to the desired size.
Parameters | |
exception | if passed, list of nodes that should be ignored |
Returns | |
list | list with the adjusted nodes (objects.Node instances) |
Mark the status of an instance to down in the configuration.
This does not touch the instance disks active flag, as shut down instances can still have active disks.
Returns | |
objects.Instance | the updated instance object |
Mark the instance status to down in the config.
This also clears the instance disks active flag.
Returns | |
objects.Instance | the updated instance object |
Mark the instance status to up in the config.
This also sets the instance disks active flag.
Returns | |
objects.Instance | the updated instance object |
Mark the status of an instance to user down in the configuration.
This does not touch the instance disks active flag, as user shut down instances can still have active disks.
Release temporary drbd minors allocated for a given disk.
This is just a wrapper over a call to WConfd.
Parameters | |
disk | the disk for which temporary minors should be released |
Give a specific IP address back to an IP pool.
The IP address is returned to the IP pool and marked as reserved.
Remove a network from the configuration.
Parameters | |
network | the UUID of the network to remove |
Removes the entry of the given node in the certificate map.
Parameters | |
node | the node's UUID |
warn | logging function for warning messages |
Remove a node group from the configuration.
Parameters | |
group | the UUID of the node group to remove |
Rename an instance.
This needs to be done in ConfigWriter and not by RemoveInstance combined with AddInstance as only we can guarantee an atomic rename.
Reserve an VG/LV pair for an instance.
Parameters | |
lv | the logical volume name to reserve |
_ec | Undocumented |
Reserve a MAC for an instance.
This only checks instances managed by this cluster, it does not check for potential collisions elsewhere.
Replaces the master candidate cert list with the new values.
Parameters | |
certs:dict of string to string | map of node UUIDs to SSL client certificate digests. |
Set cluster compression tools
Parameters | |
tools:list of string | a list of tools that are cleared for use in this cluster for the purpose of compressing data |
Sets the logical_id of an existing disk
Parameters | |
disk | disk UUID |
logical | the new logical_id for the disk |
Sets the nodes of an existing disk
Parameters | |
disk | disk UUID |
nodes:list of node uuids | the new nodes for the disk |
Set cluster instance communication network
Parameters | |
network | instance communication network, which is the name of the network used for instance communication |
Sets the primary node of an existing instance
Parameters | |
inst | instance UUID |
target | the new primary node UUID |
Notify function to be called after updates.
This function must be called when an object (as returned by GetInstanceInfo, GetNodeInfo, GetCluster) has been updated and the caller wants the modifications saved to the backing store. Note that all modified objects will be saved, but the target argument is the one the caller wants to ensure that it's saved.
Parameters | |
target | an instance of either objects.Cluster , objects.Node or objects.Instance which is existing in the cluster |
feedback | Callable feedback function |
ec | Undocumented |
Verify function.
This is just a wrapper over _UnlockedVerifyConfig
.
Returns | |
list | a list of error messages; a non-empty list signifies configuration errors |
Extends the ssconf_values dictionary by hvparams.
Parameters | |
ssconf | dictionary mapping ssconf_keys to strings representing the content of ssconf files |
all | dictionary mapping hypervisor names to a string representation of their hvparams |
Returns | |
same as ssconf_values | the ssconf_values dictionary extended by hvparams |
Per-disk verification checks
Extends result
with diagnostic information about the disks.
Parameters | |
data:see _ConfigData | configuration data |
result:list of strings | list containing diagnostic messages |
Compute the list of all UUIDs and names we have.
Parameters | |
include | whether to include the _temporary_ids set |
Returns | |
set | a set of IDs |
Compute the set of all disk-related nodes for an instance.
This abstracts away some work from '_UnlockedGetInstanceNodes' and '_UnlockedGetInstanceSecondaryNodes'.
Parameters | |
inst | The UUID of the instance we want to get nodes for |
Returns | |
set of strings | A set of names for all the nodes of the instance |
Checks that the UUID of the given object is unique.
Parameters | |
item | the instance or node to be checked |
include | whether temporarily generated UUID's should be included in the check. If the UUID of the item to be checked is a temporarily generated one, this has to be False. |
Checks that an object with the given UUID exists.
Parameters | |
item | the instance or other UUID possessing object to verify that its UUID is present |
Ensures a given object has a valid UUID.
Parameters | |
item | the instance or node to be checked |
ec | the execution context id for the uuid reservation |
Generate an unique UUID.
This checks the current node, instances and disk names for duplicates.
Returns | |
string | the unique id |
Get the hvparams of all given hypervisors from the config.
Parameters | |
hypervisors:list of string | list of hypervisor names |
Returns | |
dict of strings | dictionary mapping the hypervisor name to a string representation of the hypervisor's hvparams |
Get the configuration of all disks.
Returns | |
dict | dict of (disk, disk_info), where disk_info is what would GetDiskInfo return for the node |
Returns information about a disk.
It takes the information from the configuration file.
Parameters | |
disk | UUID of the disk |
Returns | |
objects.Disk | the disk object |
Return information about a named disk.
Return disk information from the configuration file, searching with the name of the disk.
Parameters | |
disk | Name of the disk |
Returns | |
objects.Disk | the disk object |
Get the disk params populated with inherit chain down to node-group.
Parameters | |
group:objects.NodeGroup | The group we want to know the params for |
Returns | |
A dict with the filled in disk params |
Get the netparams (mode, link) of a network.
Get a network's netparams for a given node.
Parameters | |
net | network uuid |
node | node UUID |
Returns | |
dict or None | netparams |
Return the string representation of the list of hyervisor parameters of the given hypervisor.
See Also | |
GetHvparams |
Return the disks' info for the given instance
Parameters | |
inst | The UUID of the instance we want to know the disks for |
Returns | |
List of objects.Disk | A list with all the disks' info |
Returns information about an instance.
This function is for internal use, when the config lock is already held.
Provide a mapping of node to LVs a given instance owns.
Parameters | |
inst | The UUID of the instance we want to compute the LVsByNode for |
lvmap:dict | Optional dictionary to receive the 'node' : ['lv', ...] data. |
Returns | |
dict or None | None if lvmap arg is given, otherwise, a dictionary of the form { 'node_uuid' : ['volume1', 'volume2', ...], ... }; volumeN is of the form "vg_name/lv_name", compatible with GetVolumeList() |
Get all disk-related nodes for an instance.
For non-DRBD instances, this will contain only the instance's primary node, whereas for DRBD instances, it will contain both the primary and the secondaries.
Parameters | |
inst | The UUID of the instance we want to get nodes for |
Returns | |
list of strings | A list of names for all the nodes of the instance |
Get the list of secondary nodes.
Parameters | |
inst | The UUID of the instance we want to get nodes for |
Returns | |
list of strings | A tuple of names for all the secondary nodes of the instance |
Get the number of current and maximum desired and possible candidates.
Parameters | |
exceptions:list | if passed, list of nodes that should be ignored |
Returns | |
tuple | tuple of (current, desired and possible, possible) |
Get the list of UUIDs of master candidates.
Returns | |
list of strings | list of UUIDs of all master candidates. |
Get the ndparams of the group.
Parameters | |
group:objects.NodeGroup | The group we want to know the params for |
Returns | |
dict of str to int | A dict with the filled in node group params |
Returns information about a network.
This function is for internal use, when the config lock is already held.
Lookup a node group.
Parameters | |
uuid:string | group UUID |
Returns | |
objects.NodeGroup or None | nodegroup object, or None if not found |
Get the configuration of a node, as stored in the config.
This function is for internal use, when the config lock is already held.
Parameters | |
node | the node UUID |
Returns | |
objects.Node | the node object |
Return the list of nodes which are in the configuration.
This function is for internal use, when the config lock is already held.
Returns | |
list | Undocumented |
Return the values needed by ssconf.
Returns | |
dict | a dictionary with keys the ssconf names and values their associated value |
Lookup a network's UUID.
Parameters | |
target:string | network name or UUID |
Returns | |
string | network UUID |
Raises | |
errors.OpPrereqError | when the target network cannot be found |
Lookup a node group's UUID.
Parameters | |
target:string or None | group name or UUID or None to look for the default |
Returns | |
string | nodegroup UUID |
Raises | |
errors.OpPrereqError | when the target group cannot be found |
Verify function.
Returns | |
list | a list of error messages; a non-empty list signifies configuration errors |
Verify the configuration and log any errors.
The errors get logged as critical errors and also to the feedback function, if given.
Parameters | |
feedback | Callable feedback function |
Returns | |
list | a list of error messages; a non-empty list signifies configuration errors |
Run any upgrade steps.
This method performs both in-object upgrades and also update some data elements that need uniqueness across the whole configuration or interact with other objects.
Unknown Field: warning | |
if 'saveafter' is 'True', this function will call _WriteConfig() so it needs to be called only from a "safe" place. |
a list of all temporary reservation managers
Currently the class fulfills 3 main functions:
- lock the configuration for access (monitor)
- reload and write the config if necessary (bridge)
- provide convenient access methods to config data (facade)