SAFplus Runtime Director API  3.0.5
clusterinfo.ClusterInfo Class Reference

This singleton class represents the current cluster state and configuration; use the clusterinfo.ci global variable instead of creating one yourself. More...

Public Member Functions

def neverCallMeDoxygenTrick
 
def __init__
 
def retrieve_css
 
def retrieve_javascript
 
def log
 Private, log wrapper for clusterinfo class. More...
 
def setAppDb
 Tell me about the application database. More...
 
def addSuppliedData
 Tell me about data from other sources (like node usernames/passwords) More...
 
def refresh
 Reload the AMF database if it hasn't been reloaded recently (within the RefreshInterval time) More...
 
def load
 Load or re-load the AMF database into Python objects. More...
 
def __getattr__
 Get the cluster data. More...
 
def getDependentEntities
 Returns a list of entities that contains this entity and all children/dependents. More...
 
def redundancyMigrate
 Change redundancy modes using the underlying C clAmsMgmtMigrateSG "one-stop-shopping" function Note that you can also modify redundancy modes by hand (add Service Units) using the Python layers directly. More...
 

Public Attributes

 entities
 Dictionary to access any entity (aspAmfEntity.AmfEntity) by AMF name. More...
 
 nodes
 Dictionary to access nodes (aspAmfEntity.AmfNode) by slot, name or IP address. More...
 
 nodeList
 List of all nodes (aspAmfEntity.AmfNode) More...
 
 sgs
 Dictionary to access service groups (aspAmfEntity.AmfServiceGroup) by name. More...
 
 sgList
 List of all service groups (aspAmfEntity.AmfServiceGroup) More...
 
 sus
 Dictionary to access service units (aspAmfEntity.AmfServiceUnit) by name. More...
 
 suList
 List of all service units (aspAmfEntity.AmfServiceUnit) More...
 
 sis
 Dictionary to access service instances (aspAmfEntity.AmfServiceInstance) by name. More...
 
 siList
 List of all service instances (aspAmfEntity.AmfServiceInstance) More...
 
 comps
 Dictionary to access components (aspAmfEntity.AmfComponent) by name. More...
 
 compList
 List of components (aspAmfEntity.AmfComponent) More...
 
 amf
 
 appDb
 
 associatedDataKey
 The key to use in the AMF to access clusterinfo specific data associated with each entity. More...
 
 cfgfile
 
 d
 All the cluster data – only use to take a thread-safe "snapshot" of the cluster state. More...
 
 lock
 Thread lock – do not use. More...
 
 suppliedData
 

Detailed Description

This singleton class represents the current cluster state and configuration; use the clusterinfo.ci global variable instead of creating one yourself.

The class reloads itself from the underlying hardware only ON DEMAND – see the load(), and refresh() functions. To implement this reload atomically (and therefore guarantee a consistent cluster view), it uses the following "trick" described below.

All member variables are actually members of a child object called "d" (of type clusterinfo.data), and the "getattr" member function is overloaded to automatically translate access through the this child. Therefore the member variables may not appear in some Python idioms such as this.__dict__. When load() is called, a completely NEW set of member objects are created by creating a new data object and then setting the "d" member variable to this object.

This means that references to any objects, entities, etc that you hold will never change. In order to get updated copies, you must first call ci.log() and then access the new copies through the ci global variable. This system makes writing software simpler because you can rely on objects not disappearing during some computation (unless you do a load()), even though the underlying entity in the AMF might have disappeared.

Note that this class also uses a file called "clustercfg.xml" located in the "asp/etc" directory that supplies data about nodes that is not accessible from the AMF (see the addSuppliedData function). This data includes IP addresses, usernames and passwords that are necessary to deploy software.

Constructor & Destructor Documentation

def clusterinfo.ClusterInfo.__init__ (   self,
  appDb = None,
  associatedDataKey = None 
)

Member Function Documentation

def clusterinfo.ClusterInfo.__getattr__ (   self,
  name 
)

Get the cluster data.

def clusterinfo.ClusterInfo.addSuppliedData (   self,
  d,
  below = None 
)

Tell me about data from other sources (like node usernames/passwords)

Parameters
dDictionary of key/value pairs to be added to the data
below(Optional) location to add the Supplied data
def clusterinfo.ClusterInfo.getDependentEntities (   self,
  entity 
)

Returns a list of entities that contains this entity and all children/dependents.

Dependents are entities that would have no meaning if this entity was deleted.

Parameters
entityString name of the entity or aspAmfEntity object
def clusterinfo.ClusterInfo.load (   self)

Load or re-load the AMF database into Python objects.

Note that this is an expensive operation, so unless you MUST have the latest it is better to use refresh.

def clusterinfo.ClusterInfo.log (   self,
  s,
  severity = asp.CL_LOG_SEV_DEBUG 
)

Private, log wrapper for clusterinfo class.

def clusterinfo.ClusterInfo.neverCallMeDoxygenTrick ( )
def clusterinfo.ClusterInfo.redundancyMigrate (   self,
  sgName,
  prefix,
  active,
  standby 
)

Change redundancy modes using the underlying C clAmsMgmtMigrateSG "one-stop-shopping" function Note that you can also modify redundancy modes by hand (add Service Units) using the Python layers directly.

This may be necessary if this function does not provide that exact functionality you need. See aspAmfEntity and aspAmfModify APIs

Parameters
sgNameA string containing the name of the Service Group to be modified
prefixA string containing the basename for any newly created entities
activeThe desired number of active SUs in this SG (SUs will be added or removed to match this value)
standbyThe desired number of standby SUs in this SG (SUs will be added or removed to match this value)
def clusterinfo.ClusterInfo.refresh (   self)

Reload the AMF database if it hasn't been reloaded recently (within the RefreshInterval time)

def clusterinfo.ClusterInfo.retrieve_css (   self)
def clusterinfo.ClusterInfo.retrieve_javascript (   self)
def clusterinfo.ClusterInfo.setAppDb (   self,
  appDb 
)

Tell me about the application database.

Parameters
appDbObject of type aspApp.AppDb

Member Data Documentation

clusterinfo.ClusterInfo.amf
clusterinfo.ClusterInfo.appDb
clusterinfo.ClusterInfo.associatedDataKey

The key to use in the AMF to access clusterinfo specific data associated with each entity.

Do not use.

clusterinfo.ClusterInfo.cfgfile
clusterinfo.ClusterInfo.compList

List of components (aspAmfEntity.AmfComponent)

clusterinfo.ClusterInfo.comps

Dictionary to access components (aspAmfEntity.AmfComponent) by name.

clusterinfo.ClusterInfo.d

All the cluster data – only use to take a thread-safe "snapshot" of the cluster state.

clusterinfo.ClusterInfo.entities

Dictionary to access any entity (aspAmfEntity.AmfEntity) by AMF name.

clusterinfo.ClusterInfo.lock

Thread lock – do not use.

clusterinfo.ClusterInfo.nodeList

List of all nodes (aspAmfEntity.AmfNode)

clusterinfo.ClusterInfo.nodes

Dictionary to access nodes (aspAmfEntity.AmfNode) by slot, name or IP address.

clusterinfo.ClusterInfo.sgList

List of all service groups (aspAmfEntity.AmfServiceGroup)

clusterinfo.ClusterInfo.sgs

Dictionary to access service groups (aspAmfEntity.AmfServiceGroup) by name.

clusterinfo.ClusterInfo.siList

List of all service instances (aspAmfEntity.AmfServiceInstance)

clusterinfo.ClusterInfo.sis

Dictionary to access service instances (aspAmfEntity.AmfServiceInstance) by name.

clusterinfo.ClusterInfo.suList

List of all service units (aspAmfEntity.AmfServiceUnit)

clusterinfo.ClusterInfo.suppliedData
clusterinfo.ClusterInfo.sus

Dictionary to access service units (aspAmfEntity.AmfServiceUnit) by name.