SAFplus Runtime Director API  3.0.5
aspAmfCreate Namespace Reference

Classes

class  NameMgr
 

Functions

def Modifiers2Sg
 Helper function that translates and moves configuration modifiers into a Python-level SG representation. More...
 
def CreateServiceInstance
 Create a service instance and related component service instances. More...
 
def CreateServiceUnits
 Add a bunch of SUs into an existing SG – used during upgrade. More...
 
def CreateApp
 Create the SAF entity hierarchy to run a set of applications on a set of nodes. More...
 

Variables

int DefaultStandbyWorkPerComp = 100
 
int DefaultActiveWorkPerComp = 100
 

Function Documentation

def aspAmfCreate.CreateApp (   appnames,
  nodes,
  cfg,
  svcInsts,
  basename = None,
  associatedData = {},
  index = 0,
  namesTaken = None 
)

Create the SAF entity hierarchy to run a set of applications on a set of nodes.

This is a huge top-level function that creates an entire SAF SG hierarchy. To do all of this in one function certain assumptions must be made. So if you have a strange desired configuration this function might not support it. However it can still be useful tocall since it returns all created entities. You may then modify them before committing them to the AMF. Commit to AMF by passing all entities to aspAmf.Session.InstallApp() when all of your tweaking is done.

Parameters:

Parameters
appnamesis a process name or a list of process names. All processes will be run within the same service unit
nodesis either a list of nodes, or a list of list of nodes (type AmfNode), depending on whether you want 1 or many service group instances
cfgis a dictionary of key/value pairs describing the detailed configuration of this application. The values are essentially what is allowed in the "modifiers" section of the appcfg.xml file.
svcInstsis a dictionary of dictionaries or a list of dictionaries, where each dictionary describes the key/value pairs in the service group. All CSIs get all kv pairs defined in the SI; there is no way to specify different values for different CSIs within the same SI
basenameis a string prefix used to name of all created entities. For example passing "foo" -> SG name "fooSGi0"
indexis a number that is used in the creation of names to identify an entity instance. If multiple service groups are specified, the index is incremented.

Returns: a list of all the entities that need to be created/modified in order to create this application. You may modify these entities, and then pass the list to

def aspAmfCreate.CreateServiceInstance (   sg,
  name = None,
  kvdict = None,
  cfg = None 
)

Create a service instance and related component service instances.

One CSI is created per component (process) defined in the sg and every item in kvdict is put into every CSI. Therefore every CSI contains the exact same set of name/value pairs within an SI. Note that this is a small simplification from the SAF definition which allows CSIs to contain different name/value pairs. Since components can just ignore name/value pairs that do not pertain to them, this simplification is considered harmless. If you don't like it then go ahead an write your own Create routine (its not hard!)

Note that this function just created RAM entities; it does not create them in the AMF. Do that using aspAmf.Session.InstallApp()

Parameters: sg: An object of type aspAmfEntity.AmfServiceGroup that is the parent of the SI name: The string name of the SI kvdict: A dictionary of key/value strings that will become the name/value pairs in each CSI.

Returns: (created, modified) created: A list of aspAmfEntity objects that were created during this function call modified: A list of aspAmfEntity objects that were modified during this function call (in this case, just the SG is modified)

def aspAmfCreate.CreateServiceUnits (   sg,
  nodesInSg,
  appnames,
  cfg,
  basename,
  csiLut,
  index = 0,
  namesTaken = None 
)

Add a bunch of SUs into an existing SG – used during upgrade.

This function creates a Service Unit for every node passed in the nodesInSg list.

Note that this function just creates RAM entities; it does not create them in the AMF. Do that by passing all entities to aspAmf.Session.InstallApp() when all of your creating is done.

Parameters: sg: An object of type aspAmfEntity.AmfServiceGroup that is the parent of the SUs nodesInSg: A list of nodes; an SU will be created in each one of these nodes. appnames: A list of strings that name every application. Every SU have children SAF components, one for each of these names. cfg: A Dot() object that specifies any extended configuration that should be applied to the created SUs or Components, including: appDir: The location of the application binaries (for example the full component instantiation path for the first application will be cfg["appDir"]/appname[0]) basename: The root name of every SU created. csiLut: csi Look up table: Understanding the CSILUT requires detailed understanding of the SAF information model. Basically, it is a mapping by application of the csiTypes that can be assigned to that application. index: (default 0) What number to start with when numbering the new SUs.

Returns: (created,modified,appInstLut) created: A list of aspAmfEntity objects that were created during this function call modified: A list of aspAmfEntity objects that were modified during this function call (in this case, just the SG is modified) appInstLut: A look up table of all program instances (i.e on particular nodes) indexed by name. This can be used to connect CSIs to app instances if you are creating your CSIs AFTER your SUs (if they are already created, use the csiLut parameter to this function).

def aspAmfCreate.Modifiers2Sg (   mods,
  sg 
)

Helper function that translates and moves configuration modifiers into a Python-level SG representation.

This SG can then be sent to the AMF (aspAmf.Session.InstallEntities()) to write these configuration modifiers into the AMF.

Parameters: mods: A Dot() object or other entity with SG configuration parameters expressed as member variables. The SG configuration parameters are exactly as written in ClAmsSGConfigT C structure located in clAmsEntities.h sg: An object of type aspAmfEntity.AmfServiceGroup that should receive the parameters.

Variable Documentation

int aspAmfCreate.DefaultActiveWorkPerComp = 100
int aspAmfCreate.DefaultStandbyWorkPerComp = 100