Package ganeti :: Module ssconf :: Class SimpleStore
[hide private]
[frames] | no frames]

Class SimpleStore

source code


Interface to static cluster data.

This is different that the config.ConfigWriter and SimpleConfigReader classes in that it holds data that will always be present, even on nodes which don't have all the cluster data.

Other particularities of the datastore:

Instance Methods [hide private]
 
__init__(self, cfg_location=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
KeyToFilename(self, key)
Convert a given key into filename.
source code
 
_ReadFile(self, key, default=None)
Generic routine to read keys.
source code
 
WriteFiles(self, values)
Writes ssconf files used by external scripts.
source code
 
GetFileList(self)
Return the list of all config files.
source code
 
GetClusterName(self)
Get the cluster name.
source code
 
GetFileStorageDir(self)
Get the file storage dir.
source code
 
GetMasterCandidates(self)
Return the list of master candidates.
source code
 
GetMasterCandidatesIPList(self)
Return the list of master candidates' primary IP.
source code
 
GetMasterIP(self)
Get the IP of the master node for this cluster.
source code
 
GetMasterNetdev(self)
Get the netdev to which we'll add the master ip.
source code
 
GetMasterNode(self)
Get the hostname of the master node for this cluster.
source code
 
GetNodeList(self)
Return the list of cluster nodes.
source code
 
GetNodePrimaryIPList(self)
Return the list of cluster nodes' primary IP.
source code
 
GetNodeSecondaryIPList(self)
Return the list of cluster nodes' secondary IP.
source code
 
GetNodegroupList(self)
Return the list of nodegroups.
source code
 
GetClusterTags(self)
Return the cluster tags.
source code
 
GetHypervisorList(self)
Return the list of enabled hypervisors.
source code
 
GetMaintainNodeHealth(self)
Return the value of the maintain_node_health option.
source code
 
GetUidPool(self)
Return the user-id pool definition string.
source code
 
GetPrimaryIPFamily(self)
Return the cluster-wide primary address family.
source code

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

Class Variables [hide private]
  _SS_FILEPREFIX = "ssconf_"
  _VALID_KEYS = constants.SS_CLUSTER_NAME, constants.SS_CLUSTER_...
  _MAX_SIZE = 131072
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, cfg_location=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

_ReadFile(self, key, default=None)

source code 

Generic routine to read keys.

This will read the file which holds the value requested. Errors will be changed into ConfigurationErrors.

WriteFiles(self, values)

source code 

Writes ssconf files used by external scripts.

Parameters:
  • values (dict) - Dictionary of (name, value)

GetFileList(self)

source code 

Return the list of all config files.

This is used for computing node replication data.

GetUidPool(self)

source code 

Return the user-id pool definition string.

The separator character is a newline.

The return value can be parsed using uidpool.ParseUidPool():

 ss = ssconf.SimpleStore()
 uid_pool = uidpool.ParseUidPool(ss.GetUidPool(), separator="\n")

Class Variable Details [hide private]

_VALID_KEYS

Value:
constants.SS_CLUSTER_NAME, constants.SS_CLUSTER_TAGS, constants.SS_FIL\
E_STORAGE_DIR, constants.SS_MASTER_CANDIDATES, constants.SS_MASTER_CAN\
DIDATES_IPS, constants.SS_MASTER_IP, constants.SS_MASTER_NETDEV, const\
ants.SS_MASTER_NODE, constants.SS_NODE_LIST, constants.SS_NODE_PRIMARY\
_IPS, constants.SS_NODE_SECONDARY_IPS, constants.SS_OFFLINE_NODES, con\
stants.SS_ONLINE_NODES, constants.SS_PRIMARY_IP_FAMILY, constants.SS_I\
NSTANCE_LIST, constants.SS_RELEASE_VERSION, constants.SS_HYPERVISOR_LI\
ST, constants.SS_MAINTAIN_NODE_HEALTH, constants.SS_UID_POOL, constant\
...