class documentation

class SimpleStore(object):

View In Hierarchy

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:

  • keys are restricted to predefined values
Method __init__ Undocumented
Method GetClusterName Get the cluster name.
Method GetClusterTags Return the cluster tags.
Method GetEnabledUserShutdown Return whether user shutdown is enabled.
Method GetFileList Return the list of all config files.
Method GetFileStorageDir Get the file storage dir.
Method GetGlusterStorageDir Get the Gluster storage dir.
Method GetHvparams Return the hypervisor parameters of all hypervisors.
Method GetHvparamsForHypervisor Return the hypervisor parameters of the given hypervisor.
Method GetHypervisorList Return the list of enabled hypervisors.
Method GetMaintainNodeHealth Return the value of the maintain_node_health option.
Method GetMasterCandidates Return the list of master candidates.
Method GetMasterCandidatesCertMap Returns the map of master candidate UUIDs to ssl cert.
Method GetMasterCandidatesIPList Return the list of master candidates' primary IP.
Method GetMasterIP Get the IP of the master node for this cluster.
Method GetMasterNetdev Get the netdev to which we'll add the master ip.
Method GetMasterNetmask Get the master netmask.
Method GetMasterNode Get the hostname of the master node for this cluster.
Method GetNetworkList Return the list of networks.
Method GetNodegroupList Return the list of nodegroups.
Method GetNodeList Return the list of cluster nodes.
Method GetNodePrimaryIPList Return the list of cluster nodes' primary IP.
Method GetNodeSecondaryIPList Return the list of cluster nodes' secondary IP.
Method GetNodesVmCapable Return the cluster nodes' vm capable value.
Method GetOnlineNodeList Return the list of online cluster nodes.
Method GetPrimaryIPFamily Return the cluster-wide primary address family.
Method GetSharedFileStorageDir Get the shared file storage dir.
Method GetSshPortMap Returns the map of node names to SSH port.
Method GetUidPool Return the user-id pool definition string.
Method KeyToFilename Convert a given key into filename.
Method ReadAll Reads all keys and returns their values.
Method WriteFiles Writes ssconf files used by external scripts.
Method _GetDictOfSsconfMap Reads a file with lines like key=value and returns a dict.
Method _ReadFile Generic routine to read keys.
Instance Variable _cfg_dir Undocumented
Instance Variable _lockfile Undocumented
def __init__(self, cfg_location=None, _lockfile=pathutils.SSCONF_LOCK_FILE):

Undocumented

def GetClusterName(self):

Get the cluster name.

def GetClusterTags(self):

Return the cluster tags.

def GetEnabledUserShutdown(self):

Return whether user shutdown is enabled.

Returns
bool'True' if user shutdown is enabled, 'False' otherwise
def GetFileList(self):

Return the list of all config files.

This is used for computing node replication data.

def GetFileStorageDir(self):

Get the file storage dir.

def GetGlusterStorageDir(self):

Get the Gluster storage dir.

def GetHvparams(self):

Return the hypervisor parameters of all hypervisors.

Returns
dict of dict of stringsdictionary mapping hypervisor names to hvparams
def GetHvparamsForHypervisor(self, hvname):

Return the hypervisor parameters of the given hypervisor.

Parameters
hvname:stringname of the hypervisor, must be in constants.HYPER_TYPES
Returns
dict of stringsdictionary with hypervisor parameters
def GetHypervisorList(self):

Return the list of enabled hypervisors.

def GetMaintainNodeHealth(self):

Return the value of the maintain_node_health option.

def GetMasterCandidates(self):

Return the list of master candidates.

def GetMasterCandidatesCertMap(self):

Returns the map of master candidate UUIDs to ssl cert.

Returns
dict of string to stringdictionary mapping the master candidates' UUIDs to their SSL certificate digests
def GetMasterCandidatesIPList(self):

Return the list of master candidates' primary IP.

def GetMasterIP(self):

Get the IP of the master node for this cluster.

def GetMasterNetdev(self):

Get the netdev to which we'll add the master ip.

def GetMasterNetmask(self):

Get the master netmask.

def GetMasterNode(self):

Get the hostname of the master node for this cluster.

def GetNetworkList(self):

Return the list of networks.

def GetNodegroupList(self):

Return the list of nodegroups.

def GetNodeList(self):

Return the list of cluster nodes.

def GetNodePrimaryIPList(self):

Return the list of cluster nodes' primary IP.

def GetNodeSecondaryIPList(self):

Return the list of cluster nodes' secondary IP.

def GetNodesVmCapable(self):

Return the cluster nodes' vm capable value.

Returns
dict of string to boolmapping of node names to vm capable values
def GetOnlineNodeList(self):

Return the list of online cluster nodes.

def GetPrimaryIPFamily(self):

Return the cluster-wide primary address family.

def GetSharedFileStorageDir(self):

Get the shared file storage dir.

def GetSshPortMap(self):

Returns the map of node names to SSH port.

Returns
dict of string to stringdictionary mapping the node names to their SSH port
def GetUidPool(self):

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")
def KeyToFilename(self, key):

Convert a given key into filename.

def ReadAll(self):

Reads all keys and returns their values.

Returns
dictDictionary, ssconf key as key, value as value
def WriteFiles(self, values, dry_run=False):

Writes ssconf files used by external scripts.

Parameters
values:dictDictionary of (name, value) @type dry_run boolean
dry_runWhether to perform a dry run
def _GetDictOfSsconfMap(self, ss_file_key):

Reads a file with lines like key=value and returns a dict.

This utility function reads a file containing ssconf values of the form "key=value", splits the lines at "=" and returns a dictionary mapping the keys to the values.

Parameters
ss_file_key:stringthe constant referring to an ssconf file
Returns
dict of string to stringa dictionary mapping the keys to the values
def _ReadFile(self, key, default=None):

Generic routine to read keys.

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

_cfg_dir =

Undocumented

_lockfile =

Undocumented