class documentation

class ConfigWriter(object):

Known subclasses: ganeti.config.DetachedConfig

View In Hierarchy

The interface to the cluster configuration.

WARNING: The class is no longer thread-safe! Each thread must construct a separate instance.

Static Method IsCluster Check if the cluster is configured.
Method __init__ Undocumented
Method AddInstance Add an instance to the config.
Method AddInstanceDisk Add a disk to the config and attach it to instance.
Method AddNetwork Add a network to the configuration.
Method AddNode Add a node to the configuration.
Method AddNodeGroup Add a node group to the configuration.
Method AddNodeToCandidateCerts Adds an entry to the candidate certificate map.
Method AddTcpUdpPort Adds a new port to the available port pool.
Method AllocateDRBDMinor Allocate a drbd minor.
Method AllocatePort Allocate a port.
Method AssignGroupNodes Changes the group of a number of nodes.
Method AttachInstanceDisk Attach an existing disk to an instance.
Method CheckIPInNodeGroup Check IP uniqueness in nodegroup.
Method CommitTemporaryIps Tell WConfD to commit all temporary ids
Method ComputeDRBDMap Compute the used DRBD minor/nodes.
Method DetachInstanceDisk Detach a disk from an instance.
Method DisksOfType Check if in there is at disk of the given type in the configuration.
Method DropECReservations Undocumented
Method ExpandInstanceName Attempt to expand an incomplete instance name.
Method ExpandNodeName Attempt to expand an incomplete node name into a node UUID.
Method FlushConfig Force the distribution of configuration to master candidates.
Method FlushConfigGroup Force the distribution of configuration to master candidates of a group.
Method GenerateDRBDSecret Generate a DRBD secret.
Method GenerateIp Find a free IPv4 address for an instance.
Method GenerateMAC Generate a MAC for an instance.
Method GenerateUniqueID Generate an unique ID.
Method GetAllDiskInfo Get the configuration of all disks.
Method GetAllDisksInfo Get the configuration of all disks.
Method GetAllInstancesInfo Get the configuration of all instances.
Method GetAllNetworksInfo Get configuration info of all the networks.
Method GetAllNodeGroupsInfo Get the configuration of all node groups.
Method GetAllNodeGroupsInfoDict Get the configuration of all node groups expressed as a dictionary of dictionaries.
Method GetAllNodesInfo Get the configuration of all nodes.
Method GetCandidateCerts Returns the candidate certificate map.
Method GetClusterInfo Returns information about the cluster
Method GetClusterName Get cluster name.
Method GetCompressionTools Get cluster compression tools
Method GetConfigManager Returns a ConfigManager, which is suitable to perform a synchronized block of configuration operations.
Method GetConfigVersion Get the configuration version.
Method GetDefaultIAllocator Get the default instance allocator for this cluster.
Method GetDefaultIAllocatorParameters Get the default instance allocator parameters for this cluster.
Method GetDetachedConfig Returns a detached version of a ConfigManager, which represents a read-only snapshot of the configuration at this particular time.
Method GetDiskInfo Returns information about a disk.
Method GetDiskInfoByName Return information about a named disk.
Method GetDRBDHelper Return DRBD usermode helper.
Method GetDsaHostKey Return the dsa hostkey from the config.
Method GetFileStorageDir Get the file storage dir for this cluster.
Method GetGlusterStorageDir Get the Gluster storage dir for this cluster.
Method GetGroupDiskParams Get the disk params populated with inherit chain.
Method GetGroupNetParams Locking wrapper of _UnlockedGetGroupNetParams()
Method GetGroupSshPorts Get a map of group UUIDs to SSH ports.
Method GetHvparamsString Return the hypervisor parameters of the given hypervisor.
Method GetHypervisorType Get the hypervisor type for this cluster.
Method GetInstallImage Get the install image location
Method GetInstanceCommunicationNetwork Get cluster instance communication network
Method GetInstanceDiskParams Get the disk params populated with inherit chain.
Method GetInstanceDisks Return the disks' info for the given instance
Method GetInstanceDiskTemplate Return the disk template of an instance.
Method GetInstanceForDisk Returns the instance the disk is currently attached to.
Method GetInstanceInfo Returns information about an instance.
Method GetInstanceInfoByName Get the objects.Instance object for a named instance.
Method GetInstanceList Get the list of instances.
Method GetInstanceLVsByNode Provide a mapping of node to LVs a given instance owns.
Method GetInstanceName Gets the instance name for the passed instance.
Method GetInstanceNames Gets the instance names for the passed list of nodes.
Method GetInstanceNetworks Returns set of network UUIDs for instance's nics.
Method GetInstanceNodeGroups Returns set of node group UUIDs for instance's nodes.
Method GetInstanceNodes Get all disk-related nodes for an instance.
Method GetInstanceSecondaryNodes Get the list of secondary nodes.
Method GetInstancesInfoByFilter Get instance configuration with a filter.
Method GetMACPrefix Return the mac prefix.
Method GetMasterCandidateStats Get the number of current and maximum possible candidates.
Method GetMasterCandidateUuids Get the list of UUIDs of master candidates.
Method GetMasterIP Get the IP of the master node for this cluster.
Method GetMasterNetdev Get the master network device for this cluster.
Method GetMasterNetmask Get the netmask of the master node for this cluster.
Method GetMasterNetworkParameters Get network parameters of the master node.
Method GetMasterNode Get the UUID of the master node for this cluster.
Method GetMasterNodeInfo Get the master node information for this cluster.
Method GetMasterNodeName Get the hostname of the master node for this cluster.
Method GetMultiInstanceInfo Get the configuration of multiple instances.
Method GetMultiInstanceInfoByName Get the configuration of multiple instances.
Method GetMultiNodeGroupInfo Get the configuration of multiple node groups.
Method GetMultiNodeInfo Get the configuration of multiple nodes.
Method GetNdGroupParams Get the node groups params populated with cluster defaults.
Method GetNdParams Get the node params populated with cluster defaults.
Method GetNetwork Returns information about a network.
Method GetNetworkList Get the list of networks.
Method GetNetworkNames Get a list of network names
Method GetNodeGroup Lookup a node group.
Method GetNodeGroupInfoByName Get the objects.NodeGroup object for a named node group.
Method GetNodeGroupInstances Get the instances of a node group.
Method GetNodeGroupList Get a list of node groups.
Method GetNodeGroupMembersByNodes Get nodes which are member in the same nodegroups as the given nodes.
Method GetNodeGroupsFromNodes Returns groups for a list of nodes.
Method GetNodeInfo Get the configuration of a node, as stored in the config.
Method GetNodeInfoByName Get the objects.Node object for a named node.
Method GetNodeInstances Get the instances of a node, as stored in the config.
Method GetNodeList Return the list of nodes which are in the configuration.
Method GetNodeName Gets the node name for the passed node.
Method GetNodeNames Gets the node names for the passed list of nodes.
Method GetNonVmCapableNodeList Return the list of nodes' uuids which are not vm capable.
Method GetNonVmCapableNodeNameList Return the list of nodes' names which are not vm capable.
Method GetOnlineNodeList Return the list of nodes which are online.
Method GetPortList Returns a copy of the current port list.
Method GetPotentialMasterCandidates Gets the list of node names of potential master candidates.
Method GetPrimaryIPFamily Get cluster primary ip family.
Method GetRsaHostKey Return the rsa hostkey from the config.
Method GetSharedFileStorageDir Get the shared file storage dir for this cluster.
Method GetSsconfValues Wrapper using lock around _UnlockedGetSsconf().
Method GetUseExternalMipScript Get flag representing whether to use the external master IP setup script.
Method GetVGName Return the volume group name.
Method GetVmCapableNodeList Return the list of nodes which are not vm capable.
Method GetZeroingImage Get the zeroing image location
Method LookupNetwork Lookup a network's UUID.
Method LookupNodeGroup Lookup a node group's UUID.
Method MaintainCandidatePool Try to grow the candidate pool to the desired size.
Method MarkInstanceDisksActive Mark the status of instance disks active.
Method MarkInstanceDisksInactive Mark the status of instance disks inactive.
Method MarkInstanceDown Mark the status of an instance to down in the configuration.
Method MarkInstanceOffline Mark the instance status to down in the config.
Method MarkInstanceUp Mark the instance status to up in the config.
Method MarkInstanceUserDown Mark the status of an instance to user down in the configuration.
Method OutDate Undocumented
Method ReleaseDRBDMinors Release temporary drbd minors allocated for a given disk.
Method ReleaseIp Give a specific IP address back to an IP pool.
Method RemoveInstance Remove the instance from the configuration.
Method RemoveInstanceDisk Detach a disk from an instance and remove it from the config.
Method RemoveNetwork Remove a network from the configuration.
Method RemoveNode Remove a node from the configuration.
Method RemoveNodeFromCandidateCerts Removes the entry of the given node in the certificate map.
Method RemoveNodeGroup Remove a node group from the configuration.
Method RenameInstance Rename an instance.
Method ReserveIp Reserve a given IPv4 address for use by an instance.
Method ReserveLV Reserve an VG/LV pair for an instance.
Method ReserveMAC Reserve a MAC for an instance.
Method SetCandidateCerts Replaces the master candidate cert list with the new values.
Method SetCompressionTools Set cluster compression tools
Method SetDiskLogicalID Sets the logical_id of an existing disk
Method SetDiskNodes Sets the nodes of an existing disk
Method SetDRBDHelper Set DRBD usermode helper.
Method SetInstallImage Set the install image location
Method SetInstanceCommunicationNetwork Set cluster instance communication network
Method SetInstancePrimaryNode Sets the primary node of an existing instance
Method SetVGName Set the volume group name.
Method Update Notify function to be called after updates.
Method UpdateOfflineCluster Undocumented
Method VerifyConfig Verify function.
Method VerifyConfigAndLog A simple wrapper around _UnlockedVerifyConfigAndLog
Instance Variable write_count Undocumented
Static Method _ExtendByAllHvparamsStrings Extends the ssconf_values dictionary by hvparams.
Static Method _VerifyDisks Per-disk verification checks
Method _AddLockCount Undocumented
Method _AllDRBDSecrets Return all DRBD secrets present in the config.
Method _AllIDs Compute the list of all UUIDs and names we have.
Method _AllInstanceNodes Compute the set of all disk-related nodes for an instance.
Method _AllLVs Compute the list of all LVs.
Method _AllMACs Return all MACs present in the config.
Method _AllNICs Compute the list of all NICs.
Method _AllUUIDObjects Returns all objects with uuid attributes.
Method _BumpSerialNo Bump up the serial number of the config.
Method _CheckUniqueUUID Checks that the UUID of the given object is unique.
Method _CheckUUIDpresent Checks that an object with the given UUID exists.
Method _CloseConfig Release resources relating the config data.
Method _ConfigData Undocumented
Method _EnsureUUID Ensures a given object has a valid UUID.
Method _GenerateUniqueID Generate an unique UUID.
Method _GetAllHvparamsStrings Get the hvparams of all given hypervisors from the config.
Method _GetWConfdContext Undocumented
Method _LockCount Undocumented
Method _OpenConfig Read the config data from WConfd or disk.
Method _SetConfigData Undocumented
Method _SetInstanceStatus Set the instance's status to a given value.
Method _UnlockedAddNetwork Add a network to the configuration.
Method _UnlockedAddNode Add a node to the configuration.
Method _UnlockedAddNodeGroup Add a node group to the configuration.
Method _UnlockedAddNodeToGroup Add a given node to the specified group.
Method _UnlockedDropECReservations Drop per-execution-context reservations
Method _UnlockedGetAllDiskInfo Undocumented
Method _UnlockedGetAllDisksInfo Get the configuration of all disks.
Method _UnlockedGetAllInstancesInfo Undocumented
Method _UnlockedGetAllNodeGroupsInfo Get the configuration of all node groups.
Method _UnlockedGetAllNodesInfo Gets configuration of all nodes.
Method _UnlockedGetDiskInfo Returns information about a disk.
Method _UnlockedGetDiskInfoByName Return information about a named disk.
Method _UnlockedGetDiskList Get the list of disks.
Method _UnlockedGetGroupDiskParams Get the disk params populated with inherit chain down to node-group.
Method _UnlockedGetGroupNetParams Get the netparams (mode, link) of a network.
Method _UnlockedGetHvparamsString Return the string representation of the list of hyervisor parameters of the given hypervisor.
Method _UnlockedGetInstanceDisks Return the disks' info for the given instance
Method _UnlockedGetInstanceInfo Returns information about an instance.
Method _UnlockedGetInstanceInfoByName Undocumented
Method _UnlockedGetInstanceList Get the list of instances.
Method _UnlockedGetInstanceLVsByNode Provide a mapping of node to LVs a given instance owns.
Method _UnlockedGetInstanceName Undocumented
Method _UnlockedGetInstanceNames Undocumented
Method _UnlockedGetInstanceNodes Get all disk-related nodes for an instance.
Method _UnlockedGetInstanceSecondaryNodes Get the list of secondary nodes.
Method _UnlockedGetMasterCandidateStats Get the number of current and maximum desired and possible candidates.
Method _UnlockedGetMasterCandidateUuids Get the list of UUIDs of master candidates.
Method _UnlockedGetNdGroupParams Get the ndparams of the group.
Method _UnlockedGetNdParams Undocumented
Method _UnlockedGetNetwork Returns information about a network.
Method _UnlockedGetNetworkList Get the list of networks.
Method _UnlockedGetNodeGroup Lookup a node group.
Method _UnlockedGetNodeInfo Get the configuration of a node, as stored in the config.
Method _UnlockedGetNodeInfoByName Undocumented
Method _UnlockedGetNodeList Return the list of nodes which are in the configuration.
Method _UnlockedGetNodeName Undocumented
Method _UnlockedGetNodeNames Undocumented
Method _UnlockedGetOnlineNodeList Return the list of nodes which are online.
Method _UnlockedGetSsconfValues Return the values needed by ssconf.
Method _UnlockedGetSshPortMap Undocumented
Method _UnlockedLookupNetwork Lookup a network's UUID.
Method _UnlockedLookupNodeGroup Lookup a node group's UUID.
Method _UnlockedRemoveDisk Remove the disk from the configuration.
Method _UnlockedRemoveNodeFromGroup Remove a given node from its group.
Method _UnlockedVerifyConfig Verify function.
Method _UnlockedVerifyConfigAndLog Verify the configuration and log any errors.
Method _UpgradeConfig Run any upgrade steps.
Method _WriteConfig Write the configuration data to persistent storage.
Instance Variable _accept_foreign Undocumented
Instance Variable _all_rms a list of all temporary reservation managers
Instance Variable _cfg_file Undocumented
Instance Variable _cfg_id Undocumented
Instance Variable _config_data Undocumented
Instance Variable _getents Undocumented
Instance Variable _lock_count Undocumented
Instance Variable _lock_current_shared Undocumented
Instance Variable _lock_forced Undocumented
Instance Variable _my_hostname Undocumented
Instance Variable _offline Undocumented
Instance Variable _temporary_ids Undocumented
Instance Variable _wconfd Undocumented
Instance Variable _wconfdcontext Undocumented
@staticmethod
def IsCluster():

Check if the cluster is configured.

def __init__(self, cfg_file=None, offline=False, _getents=runtime.GetEnts, accept_foreign=False, wconfdcontext=None, wconfd=None):

Undocumented

def AddInstance(self, instance, _ec_id, replace=False):

Add an instance to the config.

This should be used after creating a new instance.

Parameters
instance:objects.Instancethe instance object
_ec_idUndocumented
replace:boolif true, expect the instance to be present and replace rather than add.
def AddInstanceDisk(self, inst_uuid, disk, idx=None, replace=False):

Add a disk to the config and attach it to instance.

@ConfigSync()
def AddNetwork(self, net, ec_id, check_uuid=True):

Add a network to the configuration.

Parameters
net:objects.Networkthe Network object to add
ec_id:stringunique id for the job to use when creating a missing UUID
check_uuidUndocumented
@ConfigSync()
def AddNode(self, node, ec_id):

Add a node to the configuration.

Parameters
node:objects.Nodea Node instance
ec_idUndocumented
@ConfigSync()
def AddNodeGroup(self, group, ec_id, check_uuid=True):

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.NodeGroupthe NodeGroup object to add
ec_id:stringunique id for the job to use when creating a missing UUID
check_uuid:booladd 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
@ConfigSync()
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_uuid:stringthe node's UUID
cert_digest:stringthe digest of the node's client SSL certificate
info_fn:functionlogging function for information messages
warn_fn:functionlogging function for warning messages
def AddTcpUdpPort(self, port):

Adds a new port to the available port pool.

def AllocateDRBDMinor(self, node_uuids, disk_uuid):

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_uuids:list of stringsthe nodes in which we allocate minors
disk_uuid:stringthe disk for which we allocate minors
Returns
list of intsA list of minors in the same order as the passed nodes
def AllocatePort(self):

Allocate a port.

@ConfigSync()
def AssignGroupNodes(self, mods):

Changes the group of a number of nodes.

Parameters
mods:list of tuples; (node name, new group UUID)Node membership modifications
def AttachInstanceDisk(self, inst_uuid, disk_uuid, idx=None):

Attach an existing disk to an instance.

@ConfigSync(shared=1)
def CheckIPInNodeGroup(self, ip, node_uuid):

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:stringip address
node_uuid:stringnode UUID
Returns
(string, dict) or (None, None)(network name, netparams)
@ConfigSync(shared=1)
def CommitTemporaryIps(self, _ec_id):

Tell WConfD to commit all temporary ids

@ConfigSync(shared=1)
def ComputeDRBDMap(self):

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).
def DetachInstanceDisk(self, inst_uuid, disk_uuid):

Detach a disk from an instance.

@ConfigSync(shared=1)
def DisksOfType(self, dev_type):

Check if in there is at disk of the given type in the configuration.

def DropECReservations(self, ec_id):

Undocumented

def ExpandInstanceName(self, short_name):

Attempt to expand an incomplete instance name.

def ExpandNodeName(self, short_name):

Attempt to expand an incomplete node name into a node UUID.

def FlushConfig(self):

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.

def FlushConfigGroup(self, uuid):

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.

def GenerateDRBDSecret(self, _ec_id):

Generate a DRBD secret.

This checks the current disks for duplicates.

def GenerateIp(self, net_uuid, _ec_id):

Find a free IPv4 address for an instance.

def GenerateMAC(self, net_uuid, _ec_id):

Generate a MAC for an instance.

This should check the current instances for duplicates.

@ConfigSync(shared=1)
def GenerateUniqueID(self, ec_id):

Generate an unique ID.

This is just a wrapper over the unlocked version.

Parameters
ec_id:stringunique id for the job to reserve the id to
@ConfigSync(shared=1)
def GetAllDiskInfo(self):

Get the configuration of all disks.

Returns
dictdict of (disk, disk_info), where disk_info is what would GetDiskInfo return for disk
@ConfigSync(shared=1)
def GetAllDisksInfo(self):

Get the configuration of all disks.

This is a simple wrapper over _UnlockedGetAllDisksInfo.

@ConfigSync(shared=1)
def GetAllInstancesInfo(self):

Get the configuration of all instances.

Returns
dictdict of (instance, instance_info), where instance_info is what would GetInstanceInfo return for the node
@ConfigSync(shared=1)
def GetAllNetworksInfo(self):

Get configuration info of all the networks.

@ConfigSync(shared=1)
def GetAllNodeGroupsInfo(self):

Get the configuration of all node groups.

@ConfigSync(shared=1)
def GetAllNodeGroupsInfoDict(self):

Get the configuration of all node groups expressed as a dictionary of dictionaries.

@ConfigSync(shared=1)
def GetAllNodesInfo(self):

Get the configuration of all nodes.

Returns
dictdict of (node, node_info), where node_info is what would GetNodeInfo return for the node
@ConfigSync(shared=1)
def GetCandidateCerts(self):

Returns the candidate certificate map.

@ConfigSync(shared=1)
def GetClusterInfo(self):

Returns information about the cluster

Returns
objects.Clusterthe cluster object
@ConfigSync(shared=1)
def GetClusterName(self):

Get cluster name.

Returns
Cluster name
@ConfigSync(shared=1)
def GetCompressionTools(self):

Get cluster compression tools

Returns
list of stringa list of tools that are cleared for use in this cluster for the purpose of compressing data
def GetConfigManager(self, shared=False, forcelock=False):

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.

@ConfigSync(shared=1)
def GetConfigVersion(self):

Get the configuration version.

Returns
Config version
@ConfigSync(shared=1)
def GetDefaultIAllocator(self):

Get the default instance allocator for this cluster.

@ConfigSync(shared=1)
def GetDefaultIAllocatorParameters(self):

Get the default instance allocator parameters for this cluster.

Returns
dictdict of iallocator parameters
@ConfigSync(shared=1)
def GetDetachedConfig(self):

Returns a detached version of a ConfigManager, which represents a read-only snapshot of the configuration at this particular time.

@ConfigSync(shared=1)
def GetDiskInfo(self, disk_uuid):

Returns information about a disk.

This is a simple wrapper over _UnlockedGetDiskInfo.

@ConfigSync(shared=1)
def GetDiskInfoByName(self, disk_name):

Return information about a named disk.

This is a simple wrapper over _UnlockedGetDiskInfoByName.

@ConfigSync(shared=1)
def GetDRBDHelper(self):

Return DRBD usermode helper.

@ConfigSync(shared=1)
def GetDsaHostKey(self):

Return the dsa hostkey from the config.

Returns
stringthe dsa hostkey
@ConfigSync(shared=1)
def GetFileStorageDir(self):

Get the file storage dir for this cluster.

@ConfigSync(shared=1)
def GetGlusterStorageDir(self):

Get the Gluster storage dir for this cluster.

@ConfigSync(shared=1)
def GetGroupDiskParams(self, group):

Get the disk params populated with inherit chain.

Parameters
group:objects.NodeGroupThe group we want to know the params for
Returns
A dict with the filled in disk params
@ConfigSync(shared=1)
def GetGroupNetParams(self, net_uuid, node_uuid):

Locking wrapper of _UnlockedGetGroupNetParams()

@ConfigSync(shared=1)
def GetGroupSshPorts(self):

Get a map of group UUIDs to SSH ports.

Returns
dict of str to inta dict mapping the UUIDs to the SSH ports
@ConfigSync(shared=1)
def GetHvparamsString(self, hvname):

Return the hypervisor parameters of the given hypervisor.

Parameters
hvname:stringname of a hypervisor
Returns
stringstring containing key-value-pairs, one pair on each line; format: KEY=VALUE
@ConfigSync(shared=1)
def GetHypervisorType(self):

Get the hypervisor type for this cluster.

@ConfigSync(shared=1)
def GetInstallImage(self):

Get the install image location

Returns
stringlocation of the install image
@ConfigSync(shared=1)
def GetInstanceCommunicationNetwork(self):

Get cluster instance communication network

Returns
stringinstance communication network, which is the name of the network used for instance communication
@ConfigSync(shared=1)
def GetInstanceDiskParams(self, instance):

Get the disk params populated with inherit chain.

Parameters
instance:objects.InstanceThe instance we want to know the params for
Returns
A dict with the filled in disk params
@ConfigSync(shared=1)
def GetInstanceDisks(self, inst_uuid):

Return the disks' info for the given instance

This is a simple wrapper over _UnlockedGetInstanceDisks.

@ConfigSync(shared=1)
def GetInstanceDiskTemplate(self, inst_uuid):

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_uuid:strThe uuid of the instance.
@ConfigSync(shared=1)
def GetInstanceForDisk(self, disk_uuid):

Returns the instance the disk is currently attached to.

Parameters
disk_uuid:stringthe identifier of the disk in question.
Returns
stringuuid of instance the disk is attached to.
@ConfigSync(shared=1)
def GetInstanceInfo(self, inst_uuid):

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_uuidUUID of the instance
Returns
objects.Instancethe instance object
@ConfigSync(shared=1)
def GetInstanceInfoByName(self, inst_name):

Get the objects.Instance object for a named instance.

Parameters
inst_name:stringname of the instance to get information for
Returns
the corresponding objects.Instance instance or None if no information is available
@ConfigSync(shared=1)
def GetInstanceList(self):

Get the list of instances.

Returns
array of instances, ex. ['instance2-uuid', 'instance1-uuid']
@ConfigSync(shared=1)
def GetInstanceLVsByNode(self, inst_uuid, lvmap=None):

Provide a mapping of node to LVs a given instance owns.

This is a simple wrapper over _UnlockedGetInstanceLVsByNode

@ConfigSync(shared=1)
def GetInstanceName(self, inst_uuid):

Gets the instance name for the passed instance.

Parameters
inst_uuid:stringinstance UUID to get name for
Returns
stringinstance name
@ConfigSync(shared=1)
def GetInstanceNames(self, inst_uuids):

Gets the instance names for the passed list of nodes.

Parameters
inst_uuids:list of stringslist of instance UUIDs to get names for
Returns
list of stringslist of instance names
@ConfigSync(shared=1)
def GetInstanceNetworks(self, inst_uuid):

Returns set of network UUIDs for instance's nics.

Returns
frozensetUndocumented
@ConfigSync(shared=1)
def GetInstanceNodeGroups(self, inst_uuid, primary_only=False):

Returns set of node group UUIDs for instance's nodes.

Returns
frozensetUndocumented
@ConfigSync(shared=1)
def GetInstanceNodes(self, inst_uuid):

Get all disk-related nodes for an instance.

This is just a wrapper over _UnlockedGetInstanceNodes

@ConfigSync(shared=1)
def GetInstanceSecondaryNodes(self, inst_uuid):

Get the list of secondary nodes.

This is a simple wrapper over _UnlockedGetInstanceSecondaryNodes.

@ConfigSync(shared=1)
def GetInstancesInfoByFilter(self, filter_fn):

Get instance configuration with a filter.

Parameters
filter_fn:callableFilter 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.
@ConfigSync(shared=1)
def GetMACPrefix(self):

Return the mac prefix.

@ConfigSync(shared=1)
def GetMasterCandidateStats(self, exceptions=None):

Get the number of current and maximum possible candidates.

This is just a wrapper over _UnlockedGetMasterCandidateStats.

Parameters
exceptions:listif passed, list of nodes that should be ignored
Returns
tupletuple of (current, max)
@ConfigSync(shared=1)
def GetMasterCandidateUuids(self):

Get the list of UUIDs of master candidates.

Returns
list of stringslist of UUIDs of all master candidates.
@ConfigSync(shared=1)
def GetMasterIP(self):

Get the IP of the master node for this cluster.

Returns
Master IP
@ConfigSync(shared=1)
def GetMasterNetdev(self):

Get the master network device for this cluster.

@ConfigSync(shared=1)
def GetMasterNetmask(self):

Get the netmask of the master node for this cluster.

@ConfigSync(shared=1)
def GetMasterNetworkParameters(self):

Get network parameters of the master node.

Returns
object.MasterNetworkParametersnetwork parameters of the master node
@ConfigSync(shared=1)
def GetMasterNode(self):

Get the UUID of the master node for this cluster.

Returns
Master node UUID
@ConfigSync(shared=1)
def GetMasterNodeInfo(self):

Get the master node information for this cluster.

Returns
objects.NodeMaster node objects.Node object
@ConfigSync(shared=1)
def GetMasterNodeName(self):

Get the hostname of the master node for this cluster.

Returns
Master node hostname
@ConfigSync(shared=1)
def GetMultiInstanceInfo(self, inst_uuids):

Get the configuration of multiple instances.

Parameters
inst_uuidslist of instance UUIDs
Returns
listlist of tuples (instance UUID, instance_info), where instance_info is what would GetInstanceInfo return for the node, while keeping the original order
@ConfigSync(shared=1)
def GetMultiInstanceInfoByName(self, inst_names):

Get the configuration of multiple instances.

Parameters
inst_nameslist of instance names
Returns
listlist of tuples (instance, instance_info), where instance_info is what would GetInstanceInfo return for the node, while keeping the original order
@ConfigSync(shared=1)
def GetMultiNodeGroupInfo(self, group_uuids):

Get the configuration of multiple node groups.

Parameters
group_uuidsList of node group UUIDs
Returns
listList of tuples of (group_uuid, group_info)
@ConfigSync(shared=1)
def GetMultiNodeInfo(self, node_uuids):

Get the configuration of multiple nodes.

Parameters
node_uuidslist of node UUIDs
Returns
listlist of tuples of (node, node_info), where node_info is what would GetNodeInfo return for the node, in the original order
@ConfigSync(shared=1)
def GetNdGroupParams(self, nodegroup):

Get the node groups params populated with cluster defaults.

Parameters
nodegroup:objects.NodeGroupThe node group we want to know the params for
Returns
A dict with the filled in node group params
@ConfigSync(shared=1)
def GetNdParams(self, node):

Get the node params populated with cluster defaults.

Parameters
node:objects.NodeThe node we want to know the params for
Returns
A dict with the filled in node params
@ConfigSync(shared=1)
def GetNetwork(self, uuid):

Returns information about a network.

It takes the information from the configuration file.

Parameters
uuidUUID of the network
Returns
objects.Networkthe network object
@ConfigSync(shared=1)
def GetNetworkList(self):

Get the list of networks.

Returns
array of networks, ex. ["main", "vlan100", "200]
@ConfigSync(shared=1)
def GetNetworkNames(self):

Get a list of network names

@ConfigSync(shared=1)
def GetNodeGroup(self, uuid):

Lookup a node group.

Parameters
uuid:stringgroup UUID
Returns
objects.NodeGroup or Nonenodegroup object, or None if not found
@ConfigSync(shared=1)
def GetNodeGroupInfoByName(self, nodegroup_name):

Get the objects.NodeGroup object for a named node group.

Parameters
nodegroup_name:stringname of the node group to get information for
Returns
the corresponding objects.NodeGroup instance or None if no information is available
@ConfigSync(shared=1)
def GetNodeGroupInstances(self, uuid, primary_only=False):

Get the instances of a node group.

Parameters
uuidNode group UUID
primary_onlyWhether to only consider primary nodes
Returns
frozensetList of instance UUIDs in node group
@ConfigSync(shared=1)
def GetNodeGroupList(self):

Get a list of node groups.

@ConfigSync(shared=1)
def GetNodeGroupMembersByNodes(self, nodes):

Get nodes which are member in the same nodegroups as the given nodes.

@ConfigSync(shared=1)
def GetNodeGroupsFromNodes(self, node_uuids):

Returns groups for a list of nodes.

Parameters
node_uuids:list of stringList of node UUIDs
Returns
frozensetUndocumented
@ConfigSync(shared=1)
def GetNodeInfo(self, node_uuid):

Get the configuration of a node, as stored in the config.

This is just a locked wrapper over _UnlockedGetNodeInfo.

Parameters
node_uuidthe node UUID
Returns
objects.Nodethe node object
@ConfigSync(shared=1)
def GetNodeInfoByName(self, node_name):

Get the objects.Node object for a named node.

Parameters
node_name:stringname of the node to get information for
Returns
the corresponding objects.Node instance or None if no information is available
@ConfigSync(shared=1)
def GetNodeInstances(self, node_uuid):

Get the instances of a node, as stored in the config.

Parameters
node_uuidthe node UUID
Returns
(list, list)a tuple with two lists: the primary and the secondary instances
@ConfigSync(shared=1)
def GetNodeList(self):

Return the list of nodes which are in the configuration.

@ConfigSync(shared=1)
def GetNodeName(self, node_spec):

Gets the node name for the passed node.

Parameters
node_spec:either node UUID or a objects.Node objectnode to get names for
Returns
stringnode name
@ConfigSync(shared=1)
def GetNodeNames(self, node_specs):

Gets the node names for the passed list of nodes.

Parameters
node_specs:list of either node UUIDs or objects.Node objectslist of nodes to get names for
Returns
list of stringslist of node names
@ConfigSync(shared=1)
def GetNonVmCapableNodeList(self):

Return the list of nodes' uuids which are not vm capable.

@ConfigSync(shared=1)
def GetNonVmCapableNodeNameList(self):

Return the list of nodes' names which are not vm capable.

@ConfigSync(shared=1)
def GetOnlineNodeList(self):

Return the list of nodes which are online.

@ConfigSync(shared=1)
def GetPortList(self):

Returns a copy of the current port list.

@ConfigSync(shared=1)
def GetPotentialMasterCandidates(self):

Gets the list of node names of potential master candidates.

Returns
list of strlist of node names of potential master candidates
@ConfigSync(shared=1)
def GetPrimaryIPFamily(self):

Get cluster primary ip family.

Returns
primary ip family
@ConfigSync(shared=1)
def GetRsaHostKey(self):

Return the rsa hostkey from the config.

Returns
stringthe rsa hostkey
@ConfigSync(shared=1)
def GetSharedFileStorageDir(self):

Get the shared file storage dir for this cluster.

@ConfigSync(shared=1)
def GetSsconfValues(self):

Wrapper using lock around _UnlockedGetSsconf().

@ConfigSync(shared=1)
def GetUseExternalMipScript(self):

Get flag representing whether to use the external master IP setup script.

@ConfigSync(shared=1)
def GetVGName(self):

Return the volume group name.

@ConfigSync(shared=1)
def GetVmCapableNodeList(self):

Return the list of nodes which are not vm capable.

@ConfigSync(shared=1)
def GetZeroingImage(self):

Get the zeroing image location

Returns
stringthe location of the zeroing image
@ConfigSync(shared=1)
def LookupNetwork(self, target):

Lookup a network's UUID.

This function is just a wrapper over _UnlockedLookupNetwork.

Parameters
target:stringnetwork name or UUID
Returns
stringnetwork UUID
@ConfigSync(shared=1)
def LookupNodeGroup(self, target):

Lookup a node group's UUID.

This function is just a wrapper over _UnlockedLookupNodeGroup.

Parameters
target:string or Nonegroup name or UUID or None to look for the default
Returns
stringnodegroup UUID
@ConfigSync()
def MaintainCandidatePool(self, exception_node_uuids):

Try to grow the candidate pool to the desired size.

Parameters
exception_node_uuids:listif passed, list of nodes that should be ignored
Returns
listlist with the adjusted nodes (objects.Node instances)
def MarkInstanceDisksActive(self, inst_uuid):

Mark the status of instance disks active.

Returns
objects.Instancethe updated instance object
def MarkInstanceDisksInactive(self, inst_uuid):

Mark the status of instance disks inactive.

Returns
objects.Instancethe updated instance object
def MarkInstanceDown(self, inst_uuid):

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.Instancethe updated instance object
def MarkInstanceOffline(self, inst_uuid):

Mark the instance status to down in the config.

This also clears the instance disks active flag.

Returns
objects.Instancethe updated instance object
def MarkInstanceUp(self, inst_uuid):

Mark the instance status to up in the config.

This also sets the instance disks active flag.

Returns
objects.Instancethe updated instance object
def MarkInstanceUserDown(self, inst_uuid):

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.

def OutDate(self):

Undocumented

def ReleaseDRBDMinors(self, disk_uuid):

Release temporary drbd minors allocated for a given disk.

This is just a wrapper over a call to WConfd.

Parameters
disk_uuid:stringthe disk for which temporary minors should be released
def ReleaseIp(self, net_uuid, address, _ec_id):

Give a specific IP address back to an IP pool.

The IP address is returned to the IP pool and marked as reserved.

def RemoveInstance(self, inst_uuid):

Remove the instance from the configuration.

def RemoveInstanceDisk(self, inst_uuid, disk_uuid):

Detach a disk from an instance and remove it from the config.

@ConfigSync()
def RemoveNetwork(self, network_uuid):

Remove a network from the configuration.

Parameters
network_uuid:stringthe UUID of the network to remove
@ConfigSync()
def RemoveNode(self, node_uuid):

Remove a node from the configuration.

@ConfigSync()
def RemoveNodeFromCandidateCerts(self, node_uuid, warn_fn=logging.warn):

Removes the entry of the given node in the certificate map.

Parameters
node_uuid:stringthe node's UUID
warn_fn:functionlogging function for warning messages
@ConfigSync()
def RemoveNodeGroup(self, group_uuid):

Remove a node group from the configuration.

Parameters
group_uuid:stringthe UUID of the node group to remove
@ConfigSync()
def RenameInstance(self, inst_uuid, new_name):

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.

def ReserveIp(self, net_uuid, address, _ec_id, check=True):

Reserve a given IPv4 address for use by an instance.

def ReserveLV(self, lv_name, _ec_id):

Reserve an VG/LV pair for an instance.

Parameters
lv_name:stringthe logical volume name to reserve
_ec_idUndocumented
def ReserveMAC(self, mac, _ec_id):

Reserve a MAC for an instance.

This only checks instances managed by this cluster, it does not check for potential collisions elsewhere.

@ConfigSync()
def SetCandidateCerts(self, certs):

Replaces the master candidate cert list with the new values.

Parameters
certs:dict of string to stringmap of node UUIDs to SSL client certificate digests.
@ConfigSync()
def SetCompressionTools(self, tools):

Set cluster compression tools

Parameters
tools:list of stringa list of tools that are cleared for use in this cluster for the purpose of compressing data
@ConfigSync()
def SetDiskLogicalID(self, disk_uuid, logical_id):

Sets the logical_id of an existing disk

Parameters
disk_uuid:stringdisk UUID
logical_id:tuplethe new logical_id for the disk
@ConfigSync()
def SetDiskNodes(self, disk_uuid, nodes):

Sets the nodes of an existing disk

Parameters
disk_uuid:stringdisk UUID
nodes:list of node uuidsthe new nodes for the disk
@ConfigSync()
def SetDRBDHelper(self, drbd_helper):

Set DRBD usermode helper.

@ConfigSync()
def SetInstallImage(self, install_image):

Set the install image location

Parameters
install_image:stringlocation of the install image
@ConfigSync()
def SetInstanceCommunicationNetwork(self, network_name):

Set cluster instance communication network

Parameters
network_name:stringinstance communication network, which is the name of the network used for instance communication
def SetInstancePrimaryNode(self, inst_uuid, target_node_uuid):

Sets the primary node of an existing instance

Parameters
inst_uuid:stringinstance UUID
target_node_uuid:stringthe new primary node UUID
@ConfigSync()
def SetVGName(self, vg_name):

Set the volume group name.

def Update(self, target, feedback_fn, ec_id=None):

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
targetan instance of either objects.Cluster, objects.Node or objects.Instance which is existing in the cluster
feedback_fnCallable feedback function
ec_idUndocumented
@ConfigSync()
def UpdateOfflineCluster(self, target, feedback_fn):

Undocumented

@ConfigSync(shared=1)
def VerifyConfig(self):

Verify function.

This is just a wrapper over _UnlockedVerifyConfig.

Returns
lista list of error messages; a non-empty list signifies configuration errors
@ConfigSync(shared=1)
def VerifyConfigAndLog(self, feedback_fn=None):

A simple wrapper around _UnlockedVerifyConfigAndLog

write_count: int =

Undocumented

@staticmethod
def _ExtendByAllHvparamsStrings(ssconf_values, all_hvparams):

Extends the ssconf_values dictionary by hvparams.

Parameters
ssconf_values:dict of stringsdictionary mapping ssconf_keys to strings representing the content of ssconf files
all_hvparams:dict of stringsdictionary mapping hypervisor names to a string representation of their hvparams
Returns
same as ssconf_valuesthe ssconf_values dictionary extended by hvparams
@staticmethod
def _VerifyDisks(data, result):

Per-disk verification checks

Extends result with diagnostic information about the disks.

Parameters
data:see _ConfigDataconfiguration data
result:list of stringslist containing diagnostic messages
def _AddLockCount(self, count):

Undocumented

def _AllDRBDSecrets(self):

Return all DRBD secrets present in the config.

Returns
listthe list of all DRBD secrets
def _AllIDs(self, include_temporary):

Compute the list of all UUIDs and names we have.

Parameters
include_temporary:booleanwhether to include the _temporary_ids set
Returns
seta set of IDs
def _AllInstanceNodes(self, inst_uuid):

Compute the set of all disk-related nodes for an instance.

This abstracts away some work from '_UnlockedGetInstanceNodes' and '_UnlockedGetInstanceSecondaryNodes'.

Parameters
inst_uuid:stringThe UUID of the instance we want to get nodes for
Returns
set of stringsA set of names for all the nodes of the instance
def _AllLVs(self):

Compute the list of all LVs.

def _AllMACs(self):

Return all MACs present in the config.

Returns
listthe list of all MACs
def _AllNICs(self):

Compute the list of all NICs.

def _AllUUIDObjects(self):

Returns all objects with uuid attributes.

def _BumpSerialNo(self):

Bump up the serial number of the config.

def _CheckUniqueUUID(self, item, include_temporary):

Checks that the UUID of the given object is unique.

Parameters
itemthe instance or node to be checked
include_temporarywhether 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.
def _CheckUUIDpresent(self, item):

Checks that an object with the given UUID exists.

Parameters
itemthe instance or other UUID possessing object to verify that its UUID is present
def _CloseConfig(self, save):

Release resources relating the config data.

def _ConfigData(self):

Undocumented

def _EnsureUUID(self, item, ec_id):

Ensures a given object has a valid UUID.

Parameters
itemthe instance or node to be checked
ec_idthe execution context id for the uuid reservation
def _GenerateUniqueID(self, ec_id):

Generate an unique UUID.

This checks the current node, instances and disk names for duplicates.

Returns
stringthe unique id
def _GetAllHvparamsStrings(self, hypervisors):

Get the hvparams of all given hypervisors from the config.

Parameters
hypervisors:list of stringlist of hypervisor names
Returns
dict of stringsdictionary mapping the hypervisor name to a string representation of the hypervisor's hvparams
def _GetWConfdContext(self):

Undocumented

def _LockCount(self):

Undocumented

def _OpenConfig(self, shared, force=False):

Read the config data from WConfd or disk.

def _SetConfigData(self, cfg):

Undocumented

def _SetInstanceStatus(self, inst_uuid, status, disks_active, admin_state_source):

Set the instance's status to a given value.

Returns
objects.Instancethe updated instance object
def _UnlockedAddNetwork(self, net, ec_id, check_uuid):

Add a network to the configuration.

def _UnlockedAddNode(self, node, ec_id):

Add a node to the configuration.

Parameters
node:objects.Nodea Node instance
ec_idUndocumented
def _UnlockedAddNodeGroup(self, group, ec_id, check_uuid):

Add a node group to the configuration.

def _UnlockedAddNodeToGroup(self, node_uuid, nodegroup_uuid):

Add a given node to the specified group.

def _UnlockedDropECReservations(self, _ec_id):

Drop per-execution-context reservations

def _UnlockedGetAllDiskInfo(self):

Undocumented

def _UnlockedGetAllDisksInfo(self):

Get the configuration of all disks.

Returns
dictdict of (disk, disk_info), where disk_info is what would GetDiskInfo return for the node
def _UnlockedGetAllInstancesInfo(self):

Undocumented

def _UnlockedGetAllNodeGroupsInfo(self):

Get the configuration of all node groups.

def _UnlockedGetAllNodesInfo(self):

Gets configuration of all nodes.

Note
See GetAllNodesInfo
def _UnlockedGetDiskInfo(self, disk_uuid):

Returns information about a disk.

It takes the information from the configuration file.

Parameters
disk_uuidUUID of the disk
Returns
objects.Diskthe disk object
def _UnlockedGetDiskInfoByName(self, disk_name):

Return information about a named disk.

Return disk information from the configuration file, searching with the name of the disk.

Parameters
disk_nameName of the disk
Returns
objects.Diskthe disk object
def _UnlockedGetDiskList(self):

Get the list of disks.

Returns
array of disks, ex. ['disk2-uuid', 'disk1-uuid']
def _UnlockedGetGroupDiskParams(self, group):

Get the disk params populated with inherit chain down to node-group.

Parameters
group:objects.NodeGroupThe group we want to know the params for
Returns
A dict with the filled in disk params
def _UnlockedGetGroupNetParams(self, net_uuid, node_uuid):

Get the netparams (mode, link) of a network.

Get a network's netparams for a given node.

Parameters
net_uuid:stringnetwork uuid
node_uuid:stringnode UUID
Returns
dict or Nonenetparams
def _UnlockedGetHvparamsString(self, hvname):

Return the string representation of the list of hyervisor parameters of the given hypervisor.

See Also
GetHvparams
def _UnlockedGetInstanceDisks(self, inst_uuid):

Return the disks' info for the given instance

Parameters
inst_uuid:stringThe UUID of the instance we want to know the disks for
Returns
List of objects.DiskA list with all the disks' info
def _UnlockedGetInstanceInfo(self, inst_uuid):

Returns information about an instance.

This function is for internal use, when the config lock is already held.

def _UnlockedGetInstanceInfoByName(self, inst_name):

Undocumented

def _UnlockedGetInstanceList(self):

Get the list of instances.

This function is for internal use, when the config lock is already held.

def _UnlockedGetInstanceLVsByNode(self, inst_uuid, lvmap=None):

Provide a mapping of node to LVs a given instance owns.

Parameters
inst_uuid:stringThe UUID of the instance we want to compute the LVsByNode for
lvmap:dictOptional dictionary to receive the 'node' : ['lv', ...] data.
Returns
dict or NoneNone 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()
def _UnlockedGetInstanceName(self, inst_uuid):

Undocumented

def _UnlockedGetInstanceNames(self, inst_uuids):

Undocumented

def _UnlockedGetInstanceNodes(self, inst_uuid):

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_uuid:stringThe UUID of the instance we want to get nodes for
Returns
list of stringsA list of names for all the nodes of the instance
def _UnlockedGetInstanceSecondaryNodes(self, inst_uuid):

Get the list of secondary nodes.

Parameters
inst_uuid:stringThe UUID of the instance we want to get nodes for
Returns
list of stringsA tuple of names for all the secondary nodes of the instance
def _UnlockedGetMasterCandidateStats(self, exceptions=None):

Get the number of current and maximum desired and possible candidates.

Parameters
exceptions:listif passed, list of nodes that should be ignored
Returns
tupletuple of (current, desired and possible, possible)
def _UnlockedGetMasterCandidateUuids(self):

Get the list of UUIDs of master candidates.

Returns
list of stringslist of UUIDs of all master candidates.
def _UnlockedGetNdGroupParams(self, group):

Get the ndparams of the group.

Parameters
group:objects.NodeGroupThe group we want to know the params for
Returns
dict of str to intA dict with the filled in node group params
def _UnlockedGetNdParams(self, node):

Undocumented

def _UnlockedGetNetwork(self, uuid):

Returns information about a network.

This function is for internal use, when the config lock is already held.

def _UnlockedGetNetworkList(self):

Get the list of networks.

This function is for internal use, when the config lock is already held.

def _UnlockedGetNodeGroup(self, uuid):

Lookup a node group.

Parameters
uuid:stringgroup UUID
Returns
objects.NodeGroup or Nonenodegroup object, or None if not found
def _UnlockedGetNodeInfo(self, node_uuid):

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_uuidthe node UUID
Returns
objects.Nodethe node object
def _UnlockedGetNodeInfoByName(self, node_name):

Undocumented

def _UnlockedGetNodeList(self):

Return the list of nodes which are in the configuration.

This function is for internal use, when the config lock is already held.

Returns
listUndocumented
def _UnlockedGetNodeName(self, node_spec):

Undocumented

def _UnlockedGetNodeNames(self, node_specs):

Undocumented

def _UnlockedGetOnlineNodeList(self):

Return the list of nodes which are online.

def _UnlockedGetSsconfValues(self):

Return the values needed by ssconf.

Returns
dicta dictionary with keys the ssconf names and values their associated value
def _UnlockedGetSshPortMap(self, node_infos):

Undocumented

def _UnlockedLookupNetwork(self, target):

Lookup a network's UUID.

Parameters
target:stringnetwork name or UUID
Returns
stringnetwork UUID
Raises
errors.OpPrereqErrorwhen the target network cannot be found
def _UnlockedLookupNodeGroup(self, target):

Lookup a node group's UUID.

Parameters
target:string or Nonegroup name or UUID or None to look for the default
Returns
stringnodegroup UUID
Raises
errors.OpPrereqErrorwhen the target group cannot be found
def _UnlockedRemoveDisk(self, disk_uuid):

Remove the disk from the configuration.

Parameters
disk_uuid:stringThe UUID of the disk object
def _UnlockedRemoveNodeFromGroup(self, node):

Remove a given node from its group.

def _UnlockedVerifyConfig(self):

Verify function.

Returns
lista list of error messages; a non-empty list signifies configuration errors
def _UnlockedVerifyConfigAndLog(self, feedback_fn=None):

Verify the configuration and log any errors.

The errors get logged as critical errors and also to the feedback function, if given.

Parameters
feedback_fnCallable feedback function
Returns
lista list of error messages; a non-empty list signifies configuration errors
def _UpgradeConfig(self, saveafter=False):

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.
def _WriteConfig(self, destination=None, releaselock=False):

Write the configuration data to persistent storage.

_accept_foreign =

Undocumented

_all_rms =

a list of all temporary reservation managers

Currently the class fulfills 3 main functions:

  1. lock the configuration for access (monitor)
  2. reload and write the config if necessary (bridge)
  3. provide convenient access methods to config data (facade)
_cfg_file =

Undocumented

_cfg_id =

Undocumented

_config_data =

Undocumented

_getents =

Undocumented

_lock_count: int =

Undocumented

_lock_current_shared =

Undocumented

_lock_forced: bool =

Undocumented

_my_hostname =

Undocumented

_offline =

Undocumented

_temporary_ids =

Undocumented

_wconfd =

Undocumented

_wconfdcontext =

Undocumented