Package ganeti :: Package config :: Class ConfigWriter
[hide private]
[frames] | no frames]

Class ConfigWriter

source code


The interface to the cluster configuration.

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

Instance Methods [hide private]
 
__init__(self, cfg_file=None, offline=False, _getents=runtime.GetEnts, accept_foreign=False, wconfdcontext=None, wconfd=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_ConfigData(self) source code
 
OutDate(self) source code
 
_SetConfigData(self, cfg) source code
 
_GetWConfdContext(self) source code
 
_UnlockedGetNdParams(self, node) source code
 
GetNdParams(self, node)
Get the node params populated with cluster defaults.
source code
 
GetNdGroupParams(self, nodegroup)
Get the node groups params populated with cluster defaults.
source code
dict of str to int
_UnlockedGetNdGroupParams(self, group)
Get the ndparams of the group.
source code
dict of str to int
GetGroupSshPorts(self)
Get a map of group UUIDs to SSH ports.
source code
 
GetInstanceDiskParams(self, instance)
Get the disk params populated with inherit chain.
source code
List of objects.Disk
_UnlockedGetInstanceDisks(self, inst_uuid)
Return the disks' info for the given instance
source code
 
GetInstanceDisks(self, inst_uuid)
Return the disks' info for the given instance
source code
 
AddInstanceDisk(self, inst_uuid, disk, idx=None, replace=False)
Add a disk to the config and attach it to instance.
source code
 
AttachInstanceDisk(self, inst_uuid, disk_uuid, idx=None)
Attach an existing disk to an instance.
source code
 
_UnlockedRemoveDisk(self, disk_uuid)
Remove the disk from the configuration.
source code
 
RemoveInstanceDisk(self, inst_uuid, disk_uuid)
Detach a disk from an instance and remove it from the config.
source code
 
DetachInstanceDisk(self, inst_uuid, disk_uuid)
Detach a disk from an instance.
source code
objects.Disk
_UnlockedGetDiskInfo(self, disk_uuid)
Returns information about a disk.
source code
 
GetDiskInfo(self, disk_uuid)
Returns information about a disk.
source code
objects.Disk
_UnlockedGetDiskInfoByName(self, disk_name)
Return information about a named disk.
source code
 
GetDiskInfoByName(self, disk_name)
Return information about a named disk.
source code
 
_UnlockedGetDiskList(self)
Get the list of disks.
source code
 
GetAllDisksInfo(self)
Get the configuration of all disks.
source code
dict
_UnlockedGetAllDisksInfo(self)
Get the configuration of all disks.
source code
set of strings
_AllInstanceNodes(self, inst_uuid)
Compute the set of all disk-related nodes for an instance.
source code
list of strings
_UnlockedGetInstanceNodes(self, inst_uuid)
Get all disk-related nodes for an instance.
source code
 
GetInstanceNodes(self, inst_uuid)
Get all disk-related nodes for an instance.
source code
list of strings
_UnlockedGetInstanceSecondaryNodes(self, inst_uuid)
Get the list of secondary nodes.
source code
 
GetInstanceSecondaryNodes(self, inst_uuid)
Get the list of secondary nodes.
source code
dict or None
_UnlockedGetInstanceLVsByNode(self, inst_uuid, lvmap=None)
Provide a mapping of node to LVs a given instance owns.
source code
 
GetInstanceLVsByNode(self, inst_uuid, lvmap=None)
Provide a mapping of node to LVs a given instance owns.
source code
 
GetGroupDiskParams(self, group)
Get the disk params populated with inherit chain.
source code
 
_UnlockedGetGroupDiskParams(self, group)
Get the disk params populated with inherit chain down to node-group.
source code
list of str
GetPotentialMasterCandidates(self)
Gets the list of node names of potential master candidates.
source code
 
GenerateMAC(self, net_uuid, _ec_id)
Generate a MAC for an instance.
source code
 
ReserveMAC(self, mac, _ec_id)
Reserve a MAC for an instance.
source code
 
CommitTemporaryIps(self, _ec_id)
Tell WConfD to commit all temporary ids
source code
 
ReleaseIp(self, net_uuid, address, _ec_id)
Give a specific IP address back to an IP pool.
source code
 
GenerateIp(self, net_uuid, _ec_id)
Find a free IPv4 address for an instance.
source code
 
ReserveIp(self, net_uuid, address, _ec_id, check=True)
Reserve a given IPv4 address for use by an instance.
source code
 
ReserveLV(self, lv_name, _ec_id)
Reserve an VG/LV pair for an instance.
source code
 
GenerateDRBDSecret(self, _ec_id)
Generate a DRBD secret.
source code
 
_AllLVs(self)
Compute the list of all LVs.
source code
 
_AllNICs(self)
Compute the list of all NICs.
source code
set
_AllIDs(self, include_temporary)
Compute the list of all UUIDs and names we have.
source code
string
_GenerateUniqueID(self, ec_id)
Generate an unique UUID.
source code
 
GenerateUniqueID(self, ec_id)
Generate an unique ID.
source code
list
_AllMACs(self)
Return all MACs present in the config.
source code
list
_AllDRBDSecrets(self)
Return all DRBD secrets present in the config.
source code
list
_UnlockedVerifyConfig(self)
Verify function.
source code
 
VerifyConfigAndLog(self, feedback_fn=None)
A simple wrapper around _UnlockedVerifyConfigAndLog
source code
list
_UnlockedVerifyConfigAndLog(self, feedback_fn=None)
Verify the configuration and log any errors.
source code
list
VerifyConfig(self)
Verify function.
source code
 
AddTcpUdpPort(self, port)
Adds a new port to the available port pool.
source code
 
GetPortList(self)
Returns a copy of the current port list.
source code
 
AllocatePort(self)
Allocate a port.
source code
 
ComputeDRBDMap(self)
Compute the used DRBD minor/nodes.
source code
list of ints
AllocateDRBDMinor(self, node_uuids, disk_uuid)
Allocate a drbd minor.
source code
 
ReleaseDRBDMinors(self, disk_uuid)
Release temporary drbd minors allocated for a given disk.
source code
 
GetInstanceDiskTemplate(self, inst_uuid)
Return the disk template of an instance.
source code
 
GetConfigVersion(self)
Get the configuration version.
source code
 
GetClusterName(self)
Get cluster name.
source code
 
GetMasterNode(self)
Get the UUID of the master node for this cluster.
source code
 
GetMasterNodeName(self)
Get the hostname of the master node for this cluster.
source code
objects.Node
GetMasterNodeInfo(self)
Get the master node information for this cluster.
source code
 
GetMasterIP(self)
Get the IP of the master node for this cluster.
source code
 
GetMasterNetdev(self)
Get the master network device for this cluster.
source code
 
GetMasterNetmask(self)
Get the netmask of the master node for this cluster.
source code
 
GetUseExternalMipScript(self)
Get flag representing whether to use the external master IP setup script.
source code
 
GetFileStorageDir(self)
Get the file storage dir for this cluster.
source code
 
GetSharedFileStorageDir(self)
Get the shared file storage dir for this cluster.
source code
 
GetGlusterStorageDir(self)
Get the Gluster storage dir for this cluster.
source code
 
GetHypervisorType(self)
Get the hypervisor type for this cluster.
source code
string
GetRsaHostKey(self)
Return the rsa hostkey from the config.
source code
string
GetDsaHostKey(self)
Return the dsa hostkey from the config.
source code
 
GetDefaultIAllocator(self)
Get the default instance allocator for this cluster.
source code
dict
GetDefaultIAllocatorParameters(self)
Get the default instance allocator parameters for this cluster.
source code
 
GetPrimaryIPFamily(self)
Get cluster primary ip family.
source code
object.MasterNetworkParameters
GetMasterNetworkParameters(self)
Get network parameters of the master node.
source code
string
GetInstallImage(self)
Get the install image location
source code
 
SetInstallImage(self, install_image)
Set the install image location
source code
string
GetInstanceCommunicationNetwork(self)
Get cluster instance communication network
source code
 
SetInstanceCommunicationNetwork(self, network_name)
Set cluster instance communication network
source code
string
GetZeroingImage(self)
Get the zeroing image location
source code
list of string
GetCompressionTools(self)
Get cluster compression tools
source code
 
SetCompressionTools(self, tools)
Set cluster compression tools
source code
 
AddNodeGroup(self, group, ec_id, check_uuid=True)
Add a node group to the configuration.
source code
 
_UnlockedAddNodeGroup(self, group, ec_id, check_uuid)
Add a node group to the configuration.
source code
 
RemoveNodeGroup(self, group_uuid)
Remove a node group from the configuration.
source code
string
_UnlockedLookupNodeGroup(self, target)
Lookup a node group's UUID.
source code
string
LookupNodeGroup(self, target)
Lookup a node group's UUID.
source code
objects.NodeGroup or None
_UnlockedGetNodeGroup(self, uuid)
Lookup a node group.
source code
objects.NodeGroup or None
GetNodeGroup(self, uuid)
Lookup a node group.
source code
 
_UnlockedGetAllNodeGroupsInfo(self)
Get the configuration of all node groups.
source code
 
GetAllNodeGroupsInfo(self)
Get the configuration of all node groups.
source code
 
GetAllNodeGroupsInfoDict(self)
Get the configuration of all node groups expressed as a dictionary of dictionaries.
source code
 
GetNodeGroupList(self)
Get a list of node groups.
source code
 
GetNodeGroupMembersByNodes(self, nodes)
Get nodes which are member in the same nodegroups as the given nodes.
source code
list
GetMultiNodeGroupInfo(self, group_uuids)
Get the configuration of multiple node groups.
source code
 
AddInstance(self, instance, _ec_id, replace=False)
Add an instance to the config.
source code
 
_EnsureUUID(self, item, ec_id)
Ensures a given object has a valid UUID.
source code
 
_CheckUniqueUUID(self, item, include_temporary)
Checks that the UUID of the given object is unique.
source code
 
_CheckUUIDpresent(self, item)
Checks that an object with the given UUID exists.
source code
objects.Instance
_SetInstanceStatus(self, inst_uuid, status, disks_active, admin_state_source)
Set the instance's status to a given value.
source code
objects.Instance
MarkInstanceUp(self, inst_uuid)
Mark the instance status to up in the config.
source code
objects.Instance
MarkInstanceOffline(self, inst_uuid)
Mark the instance status to down in the config.
source code
 
RemoveInstance(self, inst_uuid)
Remove the instance from the configuration.
source code
 
RenameInstance(self, inst_uuid, new_name)
Rename an instance.
source code
objects.Instance
MarkInstanceDown(self, inst_uuid)
Mark the status of an instance to down in the configuration.
source code
 
MarkInstanceUserDown(self, inst_uuid)
Mark the status of an instance to user down in the configuration.
source code
objects.Instance
MarkInstanceDisksActive(self, inst_uuid)
Mark the status of instance disks active.
source code
objects.Instance
MarkInstanceDisksInactive(self, inst_uuid)
Mark the status of instance disks inactive.
source code
 
_UnlockedGetInstanceList(self)
Get the list of instances.
source code
 
GetInstanceList(self)
Get the list of instances.
source code
 
ExpandInstanceName(self, short_name)
Attempt to expand an incomplete instance name.
source code
 
_UnlockedGetInstanceInfo(self, inst_uuid)
Returns information about an instance.
source code
objects.Instance
GetInstanceInfo(self, inst_uuid)
Returns information about an instance.
source code
frozenset
GetInstanceNodeGroups(self, inst_uuid, primary_only=False)
Returns set of node group UUIDs for instance's nodes.
source code
frozenset
GetInstanceNetworks(self, inst_uuid)
Returns set of network UUIDs for instance's nics.
source code
list
GetMultiInstanceInfo(self, inst_uuids)
Get the configuration of multiple instances.
source code
list
GetMultiInstanceInfoByName(self, inst_names)
Get the configuration of multiple instances.
source code
dict
GetAllInstancesInfo(self)
Get the configuration of all instances.
source code
 
_UnlockedGetAllInstancesInfo(self) source code
 
GetInstancesInfoByFilter(self, filter_fn)
Get instance configuration with a filter.
source code
 
GetInstanceInfoByName(self, inst_name)
Get the objects.Instance object for a named instance.
source code
 
_UnlockedGetInstanceInfoByName(self, inst_name) source code
 
_UnlockedGetInstanceName(self, inst_uuid) source code
string
GetInstanceName(self, inst_uuid)
Gets the instance name for the passed instance.
source code
list of strings
GetInstanceNames(self, inst_uuids)
Gets the instance names for the passed list of nodes.
source code
 
SetInstancePrimaryNode(self, inst_uuid, target_node_uuid)
Sets the primary node of an existing instance
source code
 
SetDiskNodes(self, disk_uuid, nodes)
Sets the nodes of an existing disk
source code
 
SetDiskLogicalID(self, disk_uuid, logical_id)
Sets the logical_id of an existing disk
source code
 
_UnlockedGetInstanceNames(self, inst_uuids) source code
 
_UnlockedAddNode(self, node, ec_id)
Add a node to the configuration.
source code
 
AddNode(self, node, ec_id)
Add a node to the configuration.
source code
 
RemoveNode(self, node_uuid)
Remove a node from the configuration.
source code
 
ExpandNodeName(self, short_name)
Attempt to expand an incomplete node name into a node UUID.
source code
objects.Node
_UnlockedGetNodeInfo(self, node_uuid)
Get the configuration of a node, as stored in the config.
source code
objects.Node
GetNodeInfo(self, node_uuid)
Get the configuration of a node, as stored in the config.
source code
(list, list)
GetNodeInstances(self, node_uuid)
Get the instances of a node, as stored in the config.
source code
frozenset
GetNodeGroupInstances(self, uuid, primary_only=False)
Get the instances of a node group.
source code
 
_UnlockedGetHvparamsString(self, hvname)
Return the string representation of the list of hyervisor parameters of the given hypervisor.
source code
string
GetHvparamsString(self, hvname)
Return the hypervisor parameters of the given hypervisor.
source code
list
_UnlockedGetNodeList(self)
Return the list of nodes which are in the configuration.
source code
 
GetNodeList(self)
Return the list of nodes which are in the configuration.
source code
 
_UnlockedGetOnlineNodeList(self)
Return the list of nodes which are online.
source code
 
GetOnlineNodeList(self)
Return the list of nodes which are online.
source code
 
GetVmCapableNodeList(self)
Return the list of nodes which are not vm capable.
source code
 
GetNonVmCapableNodeList(self)
Return the list of nodes' uuids which are not vm capable.
source code
 
GetNonVmCapableNodeNameList(self)
Return the list of nodes' names which are not vm capable.
source code
list
GetMultiNodeInfo(self, node_uuids)
Get the configuration of multiple nodes.
source code
 
_UnlockedGetAllNodesInfo(self)
Gets configuration of all nodes.
source code
dict
GetAllNodesInfo(self)
Get the configuration of all nodes.
source code
 
_UnlockedGetNodeInfoByName(self, node_name) source code
 
GetNodeInfoByName(self, node_name)
Get the objects.Node object for a named node.
source code
 
GetNodeGroupInfoByName(self, nodegroup_name)
Get the objects.NodeGroup object for a named node group.
source code
 
_UnlockedGetNodeName(self, node_spec) source code
string
GetNodeName(self, node_spec)
Gets the node name for the passed node.
source code
 
_UnlockedGetNodeNames(self, node_specs) source code
list of strings
GetNodeNames(self, node_specs)
Gets the node names for the passed list of nodes.
source code
frozenset
GetNodeGroupsFromNodes(self, node_uuids)
Returns groups for a list of nodes.
source code
list of strings
_UnlockedGetMasterCandidateUuids(self)
Get the list of UUIDs of master candidates.
source code
list of strings
GetMasterCandidateUuids(self)
Get the list of UUIDs of master candidates.
source code
tuple
_UnlockedGetMasterCandidateStats(self, exceptions=None)
Get the number of current and maximum desired and possible candidates.
source code
tuple
GetMasterCandidateStats(self, exceptions=None)
Get the number of current and maximum possible candidates.
source code
list
MaintainCandidatePool(self, exception_node_uuids)
Try to grow the candidate pool to the desired size.
source code
 
_UnlockedAddNodeToGroup(self, node_uuid, nodegroup_uuid)
Add a given node to the specified group.
source code
 
_UnlockedRemoveNodeFromGroup(self, node)
Remove a given node from its group.
source code
 
AssignGroupNodes(self, mods)
Changes the group of a number of nodes.
source code
 
_BumpSerialNo(self)
Bump up the serial number of the config.
source code
 
_AllUUIDObjects(self)
Returns all objects with uuid attributes.
source code
 
GetConfigManager(self, shared=False, forcelock=False)
Returns a ConfigManager, which is suitable to perform a synchronized block of configuration operations.
source code
 
_AddLockCount(self, count) source code
 
_LockCount(self) source code
 
_OpenConfig(self, shared, force=False)
Read the config data from WConfd or disk.
source code
 
_CloseConfig(self, save)
Release resources relating the config data.
source code
 
_UpgradeConfig(self, saveafter=False)
Run any upgrade steps.
source code
 
_WriteConfig(self, destination=None, releaselock=False)
Write the configuration data to persistent storage.
source code
dict of strings
_GetAllHvparamsStrings(self, hypervisors)
Get the hvparams of all given hypervisors from the config.
source code
 
_UnlockedGetSshPortMap(self, node_infos) source code
dict
_UnlockedGetSsconfValues(self)
Return the values needed by ssconf.
source code
 
GetSsconfValues(self)
Wrapper using lock around _UnlockedGetSsconf().
source code
 
GetVGName(self)
Return the volume group name.
source code
 
SetVGName(self, vg_name)
Set the volume group name.
source code
 
GetDRBDHelper(self)
Return DRBD usermode helper.
source code
 
SetDRBDHelper(self, drbd_helper)
Set DRBD usermode helper.
source code
 
GetMACPrefix(self)
Return the mac prefix.
source code
objects.Cluster
GetClusterInfo(self)
Returns information about the cluster
source code
 
DisksOfType(self, dev_type)
Check if in there is at disk of the given type in the configuration.
source code
 
GetDetachedConfig(self)
Returns a detached version of a ConfigManager, which represents a read-only snapshot of the configuration at this particular time.
source code
 
Update(self, target, feedback_fn, ec_id=None)
Notify function to be called after updates.
source code
 
UpdateOfflineCluster(self, target, feedback_fn) source code
 
_UnlockedDropECReservations(self, _ec_id)
Drop per-execution-context reservations
source code
 
DropECReservations(self, ec_id) source code
 
GetAllNetworksInfo(self)
Get configuration info of all the networks.
source code
 
_UnlockedGetNetworkList(self)
Get the list of networks.
source code
 
GetNetworkList(self)
Get the list of networks.
source code
 
GetNetworkNames(self)
Get a list of network names
source code
 
_UnlockedGetNetwork(self, uuid)
Returns information about a network.
source code
objects.Network
GetNetwork(self, uuid)
Returns information about a network.
source code
 
AddNetwork(self, net, ec_id, check_uuid=True)
Add a network to the configuration.
source code
 
_UnlockedAddNetwork(self, net, ec_id, check_uuid)
Add a network to the configuration.
source code
string
_UnlockedLookupNetwork(self, target)
Lookup a network's UUID.
source code
string
LookupNetwork(self, target)
Lookup a network's UUID.
source code
 
RemoveNetwork(self, network_uuid)
Remove a network from the configuration.
source code
dict or None
_UnlockedGetGroupNetParams(self, net_uuid, node_uuid)
Get the netparams (mode, link) of a network.
source code
 
GetGroupNetParams(self, net_uuid, node_uuid)
Locking wrapper of _UnlockedGetGroupNetParams()
source code
(string, dict) or (None, None)
CheckIPInNodeGroup(self, ip, node_uuid)
Check IP uniqueness in nodegroup.
source code
 
GetCandidateCerts(self)
Returns the candidate certificate map.
source code
 
SetCandidateCerts(self, certs)
Replaces the master candidate cert list with the new values.
source code
 
AddNodeToCandidateCerts(self, node_uuid, cert_digest, info_fn=logging.info, warn_fn=logging.warn)
Adds an entry to the candidate certificate map.
source code
 
RemoveNodeFromCandidateCerts(self, node_uuid, warn_fn=logging.warn)
Removes the entry of the given node in the certificate map.
source code
 
FlushConfig(self)
Force the distribution of configuration to master candidates.
source code
 
FlushConfigGroup(self, uuid)
Force the distribution of configuration to master candidates of a group.
source code
dict
GetAllDiskInfo(self)
Get the configuration of all disks.
source code
 
_UnlockedGetAllDiskInfo(self) source code
string
GetInstanceForDisk(self, disk_uuid)
Returns the instance the disk is currently attached to.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
IsCluster()
Check if the cluster is configured.
source code
 
_VerifyDisks(data, result)
Per-disk verification checks
source code
same as ssconf_values
_ExtendByAllHvparamsStrings(ssconf_values, all_hvparams)
Extends the ssconf_values dictionary by hvparams.
source code
Instance Variables [hide private]
  _all_rms
a list of all temporary reservation managers
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

GetNdParams(self, node)

source code 

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
Decorators:
  • @ConfigSync(shared= 1)

GetNdGroupParams(self, nodegroup)

source code 

Get the node groups params populated with cluster defaults.

Parameters:
Returns:
A dict with the filled in node group params
Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetNdGroupParams(self, group)

source code 

Get the ndparams of the group.

Parameters:
Returns: dict of str to int
A dict with the filled in node group params

GetGroupSshPorts(self)

source code 

Get a map of group UUIDs to SSH ports.

Returns: dict of str to int
a dict mapping the UUIDs to the SSH ports
Decorators:
  • @ConfigSync(shared= 1)

GetInstanceDiskParams(self, instance)

source code 

Get the disk params populated with inherit chain.

Parameters:
Returns:
A dict with the filled in disk params
Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetInstanceDisks(self, inst_uuid)

source code 

Return the disks' info for the given instance

Parameters:
  • inst_uuid (string) - The UUID of the instance we want to know the disks for
Returns: List of objects.Disk
A list with all the disks' info

GetInstanceDisks(self, inst_uuid)

source code 

Return the disks' info for the given instance

This is a simple wrapper over _UnlockedGetInstanceDisks.

Decorators:
  • @ConfigSync(shared= 1)

_UnlockedRemoveDisk(self, disk_uuid)

source code 

Remove the disk from the configuration.

Parameters:
  • disk_uuid (string) - The UUID of the disk object

_UnlockedGetDiskInfo(self, disk_uuid)

source code 

Returns information about a disk.

It takes the information from the configuration file.

Parameters:
  • disk_uuid - UUID of the disk
Returns: objects.Disk
the disk object

GetDiskInfo(self, disk_uuid)

source code 

Returns information about a disk.

This is a simple wrapper over _UnlockedGetDiskInfo.

Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetDiskInfoByName(self, disk_name)

source code 

Return information about a named disk.

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

Parameters:
  • disk_name - Name of the disk
Returns: objects.Disk
the disk object

GetDiskInfoByName(self, disk_name)

source code 

Return information about a named disk.

This is a simple wrapper over _UnlockedGetDiskInfoByName.

Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetDiskList(self)

source code 

Get the list of disks.

Returns:
array of disks, ex. ['disk2-uuid', 'disk1-uuid']

GetAllDisksInfo(self)

source code 

Get the configuration of all disks.

This is a simple wrapper over _UnlockedGetAllDisksInfo.

Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetAllDisksInfo(self)

source code 

Get the configuration of all disks.

Returns: dict
dict of (disk, disk_info), where disk_info is what would GetDiskInfo return for the node

_AllInstanceNodes(self, inst_uuid)

source code 

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

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

Parameters:
  • inst_uuid (string) - 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

_UnlockedGetInstanceNodes(self, inst_uuid)

source code 

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 (string) - 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

GetInstanceNodes(self, inst_uuid)

source code 

Get all disk-related nodes for an instance.

This is just a wrapper over _UnlockedGetInstanceNodes

Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetInstanceSecondaryNodes(self, inst_uuid)

source code 

Get the list of secondary nodes.

Parameters:
  • inst_uuid (string) - 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

GetInstanceSecondaryNodes(self, inst_uuid)

source code 

Get the list of secondary nodes.

This is a simple wrapper over _UnlockedGetInstanceSecondaryNodes.

Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetInstanceLVsByNode(self, inst_uuid, lvmap=None)

source code 

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

Parameters:
  • inst_uuid (string) - 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()

GetInstanceLVsByNode(self, inst_uuid, lvmap=None)

source code 

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

This is a simple wrapper over _UnlockedGetInstanceLVsByNode

Decorators:
  • @ConfigSync(shared= 1)

GetGroupDiskParams(self, group)

source code 

Get the disk params populated with inherit chain.

Parameters:
Returns:
A dict with the filled in disk params
Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetGroupDiskParams(self, group)

source code 

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

Parameters:
Returns:
A dict with the filled in disk params

GetPotentialMasterCandidates(self)

source code 

Gets the list of node names of potential master candidates.

Returns: list of str
list of node names of potential master candidates
Decorators:
  • @ConfigSync(shared= 1)

GenerateMAC(self, net_uuid, _ec_id)

source code 

Generate a MAC for an instance.

This should check the current instances for duplicates.

ReserveMAC(self, mac, _ec_id)

source code 

Reserve a MAC for an instance.

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

CommitTemporaryIps(self, _ec_id)

source code 

Tell WConfD to commit all temporary ids

Decorators:
  • @ConfigSync(shared= 1)

ReleaseIp(self, net_uuid, address, _ec_id)

source code 

Give a specific IP address back to an IP pool.

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

ReserveLV(self, lv_name, _ec_id)

source code 

Reserve an VG/LV pair for an instance.

Parameters:
  • lv_name (string) - the logical volume name to reserve

GenerateDRBDSecret(self, _ec_id)

source code 

Generate a DRBD secret.

This checks the current disks for duplicates.

_AllIDs(self, include_temporary)

source code 

Compute the list of all UUIDs and names we have.

Parameters:
  • include_temporary (boolean) - whether to include the _temporary_ids set
Returns: set
a set of IDs

_GenerateUniqueID(self, ec_id)

source code 

Generate an unique UUID.

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

Returns: string
the unique id

GenerateUniqueID(self, ec_id)

source code 

Generate an unique ID.

This is just a wrapper over the unlocked version.

Parameters:
  • ec_id (string) - unique id for the job to reserve the id to
Decorators:
  • @ConfigSync(shared= 1)

_AllMACs(self)

source code 

Return all MACs present in the config.

Returns: list
the list of all MACs

_AllDRBDSecrets(self)

source code 

Return all DRBD secrets present in the config.

Returns: list
the list of all DRBD secrets

_VerifyDisks(data, result)
Static Method

source code 

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

_UnlockedVerifyConfig(self)

source code 

Verify function.

Returns: list
a list of error messages; a non-empty list signifies configuration errors

VerifyConfigAndLog(self, feedback_fn=None)

source code 

A simple wrapper around _UnlockedVerifyConfigAndLog

Decorators:
  • @ConfigSync(shared= 1)

_UnlockedVerifyConfigAndLog(self, feedback_fn=None)

source code 

Verify the configuration and log any errors.

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

Parameters:
  • feedback_fn - Callable feedback function
Returns: list
a list of error messages; a non-empty list signifies configuration errors

VerifyConfig(self)

source code 

Verify function.

This is just a wrapper over _UnlockedVerifyConfig.

Returns: list
a list of error messages; a non-empty list signifies configuration errors
Decorators:
  • @ConfigSync(shared= 1)

GetPortList(self)

source code 

Returns a copy of the current port list.

Decorators:
  • @ConfigSync(shared= 1)

ComputeDRBDMap(self)

source code 

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).
Decorators:
  • @ConfigSync(shared= 1)

AllocateDRBDMinor(self, node_uuids, disk_uuid)

source code 

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 strings) - the nodes in which we allocate minors
  • disk_uuid (string) - the disk for which we allocate minors
Returns: list of ints
A list of minors in the same order as the passed nodes

ReleaseDRBDMinors(self, disk_uuid)

source code 

Release temporary drbd minors allocated for a given disk.

This is just a wrapper over a call to WConfd.

Parameters:
  • disk_uuid (string) - the disk for which temporary minors should be released

GetInstanceDiskTemplate(self, inst_uuid)

source code 

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 (str) - The uuid of the instance.
Decorators:
  • @ConfigSync(shared= 1)

GetConfigVersion(self)

source code 

Get the configuration version.

Returns:
Config version
Decorators:
  • @ConfigSync(shared= 1)

GetClusterName(self)

source code 

Get cluster name.

Returns:
Cluster name
Decorators:
  • @ConfigSync(shared= 1)

GetMasterNode(self)

source code 

Get the UUID of the master node for this cluster.

Returns:
Master node UUID
Decorators:
  • @ConfigSync(shared= 1)

GetMasterNodeName(self)

source code 

Get the hostname of the master node for this cluster.

Returns:
Master node hostname
Decorators:
  • @ConfigSync(shared= 1)

GetMasterNodeInfo(self)

source code 

Get the master node information for this cluster.

Returns: objects.Node
Master node objects.Node object
Decorators:
  • @ConfigSync(shared= 1)

GetMasterIP(self)

source code 

Get the IP of the master node for this cluster.

Returns:
Master IP
Decorators:
  • @ConfigSync(shared= 1)

GetMasterNetdev(self)

source code 

Get the master network device for this cluster.

Decorators:
  • @ConfigSync(shared= 1)

GetMasterNetmask(self)

source code 

Get the netmask of the master node for this cluster.

Decorators:
  • @ConfigSync(shared= 1)

GetUseExternalMipScript(self)

source code 

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

Decorators:
  • @ConfigSync(shared= 1)

GetFileStorageDir(self)

source code 

Get the file storage dir for this cluster.

Decorators:
  • @ConfigSync(shared= 1)

GetSharedFileStorageDir(self)

source code 

Get the shared file storage dir for this cluster.

Decorators:
  • @ConfigSync(shared= 1)

GetGlusterStorageDir(self)

source code 

Get the Gluster storage dir for this cluster.

Decorators:
  • @ConfigSync(shared= 1)

GetHypervisorType(self)

source code 

Get the hypervisor type for this cluster.

Decorators:
  • @ConfigSync(shared= 1)

GetRsaHostKey(self)

source code 

Return the rsa hostkey from the config.

Returns: string
the rsa hostkey
Decorators:
  • @ConfigSync(shared= 1)

GetDsaHostKey(self)

source code 

Return the dsa hostkey from the config.

Returns: string
the dsa hostkey
Decorators:
  • @ConfigSync(shared= 1)

GetDefaultIAllocator(self)

source code 

Get the default instance allocator for this cluster.

Decorators:
  • @ConfigSync(shared= 1)

GetDefaultIAllocatorParameters(self)

source code 

Get the default instance allocator parameters for this cluster.

Returns: dict
dict of iallocator parameters
Decorators:
  • @ConfigSync(shared= 1)

GetPrimaryIPFamily(self)

source code 

Get cluster primary ip family.

Returns:
primary ip family
Decorators:
  • @ConfigSync(shared= 1)

GetMasterNetworkParameters(self)

source code 

Get network parameters of the master node.

Returns: object.MasterNetworkParameters
network parameters of the master node
Decorators:
  • @ConfigSync(shared= 1)

GetInstallImage(self)

source code 

Get the install image location

Returns: string
location of the install image
Decorators:
  • @ConfigSync(shared= 1)

SetInstallImage(self, install_image)

source code 

Set the install image location

Parameters:
  • install_image (string) - location of the install image
Decorators:
  • @ConfigSync()

GetInstanceCommunicationNetwork(self)

source code 

Get cluster instance communication network

Returns: string
instance communication network, which is the name of the network used for instance communication
Decorators:
  • @ConfigSync(shared= 1)

SetInstanceCommunicationNetwork(self, network_name)

source code 

Set cluster instance communication network

Parameters:
  • network_name (string) - instance communication network, which is the name of the network used for instance communication
Decorators:
  • @ConfigSync()

GetZeroingImage(self)

source code 

Get the zeroing image location

Returns: string
the location of the zeroing image
Decorators:
  • @ConfigSync(shared= 1)

GetCompressionTools(self)

source code 

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
Decorators:
  • @ConfigSync(shared= 1)

SetCompressionTools(self, tools)

source code 

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
Decorators:
  • @ConfigSync()

AddNodeGroup(self, group, ec_id, check_uuid=True)

source code 

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_id (string) - unique id for the job to use when creating a missing UUID
  • check_uuid (bool) - 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
Decorators:
  • @ConfigSync()

RemoveNodeGroup(self, group_uuid)

source code 

Remove a node group from the configuration.

Parameters:
  • group_uuid (string) - the UUID of the node group to remove
Decorators:
  • @ConfigSync()

_UnlockedLookupNodeGroup(self, target)

source code 

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:

LookupNodeGroup(self, target)

source code 

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
Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetNodeGroup(self, uuid)

source code 

Lookup a node group.

Parameters:
  • uuid (string) - group UUID
Returns: objects.NodeGroup or None
nodegroup object, or None if not found

GetNodeGroup(self, uuid)

source code 

Lookup a node group.

Parameters:
  • uuid (string) - group UUID
Returns: objects.NodeGroup or None
nodegroup object, or None if not found
Decorators:
  • @ConfigSync(shared= 1)

GetAllNodeGroupsInfo(self)

source code 

Get the configuration of all node groups.

Decorators:
  • @ConfigSync(shared= 1)

GetAllNodeGroupsInfoDict(self)

source code 

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

Decorators:
  • @ConfigSync(shared= 1)

GetNodeGroupList(self)

source code 

Get a list of node groups.

Decorators:
  • @ConfigSync(shared= 1)

GetNodeGroupMembersByNodes(self, nodes)

source code 

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

Decorators:
  • @ConfigSync(shared= 1)

GetMultiNodeGroupInfo(self, group_uuids)

source code 

Get the configuration of multiple node groups.

Parameters:
  • group_uuids - List of node group UUIDs
Returns: list
List of tuples of (group_uuid, group_info)
Decorators:
  • @ConfigSync(shared= 1)

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

source code 

Add an instance to the config.

This should be used after creating a new instance.

Parameters:
  • instance (objects.Instance) - the instance object
  • replace (bool) - if true, expect the instance to be present and replace rather than add.

_EnsureUUID(self, item, ec_id)

source code 

Ensures a given object has a valid UUID.

Parameters:
  • item - the instance or node to be checked
  • ec_id - the execution context id for the uuid reservation

_CheckUniqueUUID(self, item, include_temporary)

source code 

Checks that the UUID of the given object is unique.

Parameters:
  • item - the instance or node to be checked
  • include_temporary - 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.

_CheckUUIDpresent(self, item)

source code 

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

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

source code 

Set the instance's status to a given value.

Returns: objects.Instance
the updated instance object

MarkInstanceUp(self, inst_uuid)

source code 

Mark the instance status to up in the config.

This also sets the instance disks active flag.

Returns: objects.Instance
the updated instance object

MarkInstanceOffline(self, inst_uuid)

source code 

Mark the instance status to down in the config.

This also clears the instance disks active flag.

Returns: objects.Instance
the updated instance object

RenameInstance(self, inst_uuid, new_name)

source code 

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.

Decorators:
  • @ConfigSync()

MarkInstanceDown(self, inst_uuid)

source code 

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

MarkInstanceUserDown(self, inst_uuid)

source code 

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.

MarkInstanceDisksActive(self, inst_uuid)

source code 

Mark the status of instance disks active.

Returns: objects.Instance
the updated instance object

MarkInstanceDisksInactive(self, inst_uuid)

source code 

Mark the status of instance disks inactive.

Returns: objects.Instance
the updated instance object

_UnlockedGetInstanceList(self)

source code 

Get the list of instances.

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

GetInstanceList(self)

source code 

Get the list of instances.

Returns:
array of instances, ex. ['instance2-uuid', 'instance1-uuid']
Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetInstanceInfo(self, inst_uuid)

source code 

Returns information about an instance.

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

GetInstanceInfo(self, inst_uuid)

source code 

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 - UUID of the instance
Returns: objects.Instance
the instance object
Decorators:
  • @ConfigSync(shared= 1)

GetInstanceNodeGroups(self, inst_uuid, primary_only=False)

source code 

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

Returns: frozenset
Decorators:
  • @ConfigSync(shared= 1)

GetInstanceNetworks(self, inst_uuid)

source code 

Returns set of network UUIDs for instance's nics.

Returns: frozenset
Decorators:
  • @ConfigSync(shared= 1)

GetMultiInstanceInfo(self, inst_uuids)

source code 

Get the configuration of multiple instances.

Parameters:
  • inst_uuids - 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
Decorators:
  • @ConfigSync(shared= 1)

GetMultiInstanceInfoByName(self, inst_names)

source code 

Get the configuration of multiple instances.

Parameters:
  • inst_names - 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
Decorators:
  • @ConfigSync(shared= 1)

GetAllInstancesInfo(self)

source code 

Get the configuration of all instances.

Returns: dict
dict of (instance, instance_info), where instance_info is what would GetInstanceInfo return for the node
Decorators:
  • @ConfigSync(shared= 1)

GetInstancesInfoByFilter(self, filter_fn)

source code 

Get instance configuration with a filter.

Parameters:
  • filter_fn (callable) - 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.
Decorators:
  • @ConfigSync(shared= 1)

GetInstanceInfoByName(self, inst_name)

source code 

Get the objects.Instance object for a named instance.

Parameters:
  • inst_name (string) - name of the instance to get information for
Returns:
the corresponding objects.Instance instance or None if no information is available
Decorators:
  • @ConfigSync(shared= 1)

GetInstanceName(self, inst_uuid)

source code 

Gets the instance name for the passed instance.

Parameters:
  • inst_uuid (string) - instance UUID to get name for
Returns: string
instance name
Decorators:
  • @ConfigSync(shared= 1)

GetInstanceNames(self, inst_uuids)

source code 

Gets the instance names for the passed list of nodes.

Parameters:
  • inst_uuids (list of strings) - list of instance UUIDs to get names for
Returns: list of strings
list of instance names
Decorators:
  • @ConfigSync(shared= 1)

SetInstancePrimaryNode(self, inst_uuid, target_node_uuid)

source code 

Sets the primary node of an existing instance

Parameters:
  • inst_uuid (string) - instance UUID
  • target_node_uuid (string) - the new primary node UUID

SetDiskNodes(self, disk_uuid, nodes)

source code 

Sets the nodes of an existing disk

Parameters:
  • disk_uuid (string) - disk UUID
  • nodes (list of node uuids) - the new nodes for the disk
Decorators:
  • @ConfigSync()

SetDiskLogicalID(self, disk_uuid, logical_id)

source code 

Sets the logical_id of an existing disk

Parameters:
  • disk_uuid (string) - disk UUID
  • logical_id (tuple) - the new logical_id for the disk
Decorators:
  • @ConfigSync()

_UnlockedAddNode(self, node, ec_id)

source code 

Add a node to the configuration.

Parameters:

AddNode(self, node, ec_id)

source code 

Add a node to the configuration.

Parameters:
Decorators:
  • @ConfigSync()

RemoveNode(self, node_uuid)

source code 

Remove a node from the configuration.

Decorators:
  • @ConfigSync()

_UnlockedGetNodeInfo(self, node_uuid)

source code 

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_uuid - the node UUID
Returns: objects.Node
the node object

GetNodeInfo(self, node_uuid)

source code 

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

This is just a locked wrapper over _UnlockedGetNodeInfo.

Parameters:
  • node_uuid - the node UUID
Returns: objects.Node
the node object
Decorators:
  • @ConfigSync(shared= 1)

GetNodeInstances(self, node_uuid)

source code 

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

Parameters:
  • node_uuid - the node UUID
Returns: (list, list)
a tuple with two lists: the primary and the secondary instances
Decorators:
  • @ConfigSync(shared= 1)

GetNodeGroupInstances(self, uuid, primary_only=False)

source code 

Get the instances of a node group.

Parameters:
  • uuid - Node group UUID
  • primary_only - Whether to only consider primary nodes
Returns: frozenset
List of instance UUIDs in node group
Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetHvparamsString(self, hvname)

source code 

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

See Also: GetHvparams

GetHvparamsString(self, hvname)

source code 

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
Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetNodeList(self)

source code 

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

GetNodeList(self)

source code 

Return the list of nodes which are in the configuration.

Decorators:
  • @ConfigSync(shared= 1)

GetOnlineNodeList(self)

source code 

Return the list of nodes which are online.

Decorators:
  • @ConfigSync(shared= 1)

GetVmCapableNodeList(self)

source code 

Return the list of nodes which are not vm capable.

Decorators:
  • @ConfigSync(shared= 1)

GetNonVmCapableNodeList(self)

source code 

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

Decorators:
  • @ConfigSync(shared= 1)

GetNonVmCapableNodeNameList(self)

source code 

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

Decorators:
  • @ConfigSync(shared= 1)

GetMultiNodeInfo(self, node_uuids)

source code 

Get the configuration of multiple nodes.

Parameters:
  • node_uuids - 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
Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetAllNodesInfo(self)

source code 

Gets configuration of all nodes.

Note: See GetAllNodesInfo

GetAllNodesInfo(self)

source code 

Get the configuration of all nodes.

Returns: dict
dict of (node, node_info), where node_info is what would GetNodeInfo return for the node
Decorators:
  • @ConfigSync(shared= 1)

GetNodeInfoByName(self, node_name)

source code 

Get the objects.Node object for a named node.

Parameters:
  • node_name (string) - name of the node to get information for
Returns:
the corresponding objects.Node instance or None if no information is available
Decorators:
  • @ConfigSync(shared= 1)

GetNodeGroupInfoByName(self, nodegroup_name)

source code 

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

Parameters:
  • nodegroup_name (string) - name of the node group to get information for
Returns:
the corresponding objects.NodeGroup instance or None if no information is available
Decorators:
  • @ConfigSync(shared= 1)

GetNodeName(self, node_spec)

source code 

Gets the node name for the passed node.

Parameters:
  • node_spec (either node UUID or a objects.Node object) - node to get names for
Returns: string
node name
Decorators:
  • @ConfigSync(shared= 1)

GetNodeNames(self, node_specs)

source code 

Gets the node names for the passed list of nodes.

Parameters:
  • node_specs (list of either node UUIDs or objects.Node objects) - list of nodes to get names for
Returns: list of strings
list of node names
Decorators:
  • @ConfigSync(shared= 1)

GetNodeGroupsFromNodes(self, node_uuids)

source code 

Returns groups for a list of nodes.

Parameters:
  • node_uuids (list of string) - List of node UUIDs
Returns: frozenset
Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetMasterCandidateUuids(self)

source code 

Get the list of UUIDs of master candidates.

Returns: list of strings
list of UUIDs of all master candidates.

GetMasterCandidateUuids(self)

source code 

Get the list of UUIDs of master candidates.

Returns: list of strings
list of UUIDs of all master candidates.
Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetMasterCandidateStats(self, exceptions=None)

source code 

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)

GetMasterCandidateStats(self, exceptions=None)

source code 

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)
Decorators:
  • @ConfigSync(shared= 1)

MaintainCandidatePool(self, exception_node_uuids)

source code 

Try to grow the candidate pool to the desired size.

Parameters:
  • exception_node_uuids (list) - if passed, list of nodes that should be ignored
Returns: list
list with the adjusted nodes (objects.Node instances)
Decorators:
  • @ConfigSync()

AssignGroupNodes(self, mods)

source code 

Changes the group of a number of nodes.

Parameters:
  • mods (list of tuples; (node name, new group UUID)) - Node membership modifications
Decorators:
  • @ConfigSync()

GetConfigManager(self, shared=False, forcelock=False)

source code 

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.

_UpgradeConfig(self, saveafter=False)

source code 

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.

Warning: if 'saveafter' is 'True', this function will call _WriteConfig() so it needs to be called only from a "safe" place.

_GetAllHvparamsStrings(self, hypervisors)

source code 

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

_ExtendByAllHvparamsStrings(ssconf_values, all_hvparams)
Static Method

source code 

Extends the ssconf_values dictionary by hvparams.

Parameters:
  • ssconf_values (dict of strings) - dictionary mapping ssconf_keys to strings representing the content of ssconf files
  • all_hvparams (dict of strings) - dictionary mapping hypervisor names to a string representation of their hvparams
Returns: same as ssconf_values
the ssconf_values dictionary extended by hvparams

_UnlockedGetSsconfValues(self)

source code 

Return the values needed by ssconf.

Returns: dict
a dictionary with keys the ssconf names and values their associated value

GetSsconfValues(self)

source code 

Wrapper using lock around _UnlockedGetSsconf().

Decorators:
  • @ConfigSync(shared= 1)

GetVGName(self)

source code 

Return the volume group name.

Decorators:
  • @ConfigSync(shared= 1)

SetVGName(self, vg_name)

source code 

Set the volume group name.

Decorators:
  • @ConfigSync()

GetDRBDHelper(self)

source code 

Return DRBD usermode helper.

Decorators:
  • @ConfigSync(shared= 1)

SetDRBDHelper(self, drbd_helper)

source code 

Set DRBD usermode helper.

Decorators:
  • @ConfigSync()

GetMACPrefix(self)

source code 

Return the mac prefix.

Decorators:
  • @ConfigSync(shared= 1)

GetClusterInfo(self)

source code 

Returns information about the cluster

Returns: objects.Cluster
the cluster object
Decorators:
  • @ConfigSync(shared= 1)

DisksOfType(self, dev_type)

source code 

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

Decorators:
  • @ConfigSync(shared= 1)

GetDetachedConfig(self)

source code 

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

Decorators:
  • @ConfigSync(shared= 1)

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

source code 

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:

UpdateOfflineCluster(self, target, feedback_fn)

source code 
Decorators:
  • @ConfigSync()

GetAllNetworksInfo(self)

source code 

Get configuration info of all the networks.

Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetNetworkList(self)

source code 

Get the list of networks.

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

GetNetworkList(self)

source code 

Get the list of networks.

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

GetNetworkNames(self)

source code 

Get a list of network names

Decorators:
  • @ConfigSync(shared= 1)

_UnlockedGetNetwork(self, uuid)

source code 

Returns information about a network.

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

GetNetwork(self, uuid)

source code 

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
Decorators:
  • @ConfigSync(shared= 1)

AddNetwork(self, net, ec_id, check_uuid=True)

source code 

Add a network to the configuration.

Parameters:
  • net (objects.Network) - the Network object to add
  • ec_id (string) - unique id for the job to use when creating a missing UUID
Decorators:
  • @ConfigSync()

_UnlockedLookupNetwork(self, target)

source code 

Lookup a network's UUID.

Parameters:
  • target (string) - network name or UUID
Returns: string
network UUID
Raises:

LookupNetwork(self, target)

source code 

Lookup a network's UUID.

This function is just a wrapper over _UnlockedLookupNetwork.

Parameters:
  • target (string) - network name or UUID
Returns: string
network UUID
Decorators:
  • @ConfigSync(shared= 1)

RemoveNetwork(self, network_uuid)

source code 

Remove a network from the configuration.

Parameters:
  • network_uuid (string) - the UUID of the network to remove
Decorators:
  • @ConfigSync()

_UnlockedGetGroupNetParams(self, net_uuid, node_uuid)

source code 

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

Get a network's netparams for a given node.

Parameters:
  • net_uuid (string) - network uuid
  • node_uuid (string) - node UUID
Returns: dict or None
netparams

GetGroupNetParams(self, net_uuid, node_uuid)

source code 

Locking wrapper of _UnlockedGetGroupNetParams()

Decorators:
  • @ConfigSync(shared= 1)

CheckIPInNodeGroup(self, ip, node_uuid)

source code 

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_uuid (string) - node UUID
Returns: (string, dict) or (None, None)
(network name, netparams)
Decorators:
  • @ConfigSync(shared= 1)

GetCandidateCerts(self)

source code 

Returns the candidate certificate map.

Decorators:
  • @ConfigSync(shared= 1)

SetCandidateCerts(self, certs)

source code 

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.
Decorators:
  • @ConfigSync()

AddNodeToCandidateCerts(self, node_uuid, cert_digest, info_fn=logging.info, warn_fn=logging.warn)

source code 

Adds an entry to the candidate certificate map.

Parameters:
  • node_uuid (string) - the node's UUID
  • cert_digest (string) - the digest of the node's client SSL certificate
  • info_fn (function) - logging function for information messages
  • warn_fn (function) - logging function for warning messages
Decorators:
  • @ConfigSync()

RemoveNodeFromCandidateCerts(self, node_uuid, warn_fn=logging.warn)

source code 

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

Parameters:
  • node_uuid (string) - the node's UUID
  • warn_fn (function) - logging function for warning messages
Decorators:
  • @ConfigSync()

FlushConfig(self)

source code 

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.

FlushConfigGroup(self, uuid)

source code 

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.

GetAllDiskInfo(self)

source code 

Get the configuration of all disks.

Returns: dict
dict of (disk, disk_info), where disk_info is what would GetDiskInfo return for disk
Decorators:
  • @ConfigSync(shared= 1)

GetInstanceForDisk(self, disk_uuid)

source code 

Returns the instance the disk is currently attached to.

Parameters:
  • disk_uuid (string) - the identifier of the disk in question.
Returns: string
uuid of instance the disk is attached to.
Decorators:
  • @ConfigSync(shared= 1)

Instance Variable Details [hide private]

_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)