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, _lockfile=pathutils.SSCONF_LOCK_FILE)
x.__init__(...) initializes x; see help(type(x)) 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
dict
ReadAll(self)
Reads all keys and returns their values.
source code
 
WriteFiles(self, values, dry_run=False)
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
 
GetSharedFileStorageDir(self)
Get the shared 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
 
GetMasterNetmask(self)
Get the master netmask.
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
 
GetOnlineNodeList(self)
Return the list of online 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
 
GetNetworkList(self)
Return the list of networks.
source code
 
GetClusterTags(self)
Return the cluster tags.
source code
 
GetHypervisorList(self)
Return the list of enabled hypervisors.
source code
dict of strings
GetHvparamsForHypervisor(self, hvname)
Return the hypervisor parameters of the given hypervisor.
source code
dict of dict of strings
GetHvparams(self)
Return the hypervisor parameters of all 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__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, cfg_location=None, _lockfile=pathutils.SSCONF_LOCK_FILE)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) 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.

ReadAll(self)

source code 

Reads all keys and returns their values.

Returns: dict
Dictionary, ssconf key as key, value as value

WriteFiles(self, values, dry_run=False)

source code 

Writes ssconf files used by external scripts.

Parameters:
  • values (dict) - Dictionary of (name, value) @type dry_run boolean
  • dry_run - Whether to perform a dry run

GetFileList(self)

source code 

Return the list of all config files.

This is used for computing node replication data.

GetHvparamsForHypervisor(self, hvname)

source code 

Return the hypervisor parameters of the given hypervisor.

Parameters:
  • hvname (string) - name of the hypervisor, must be in constants.HYPER_TYPES
Returns: dict of strings
dictionary with hypervisor parameters

GetHvparams(self)

source code 

Return the hypervisor parameters of all hypervisors.

Returns: dict of dict of strings
dictionary mapping hypervisor names to hvparams

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