def loadAssociatedData(self,key=None): """Iterates through the entity list loading all associated data into each entities' self.associatedData field. @param key Optional associated data key that will override the clusterinfo default key """ if key is None: key = self.associatedDataKey if key is not None: ckey = asp.ClNameT() setCNameT(ckey,key) self.log("Loading associated data using key [%s]" % key) for (n,e) in self.entities.items(): SetCEntity(self.amf.entity,e) try: if key is None: result = asp.clAmsMgmtEntityUserDataGet(self.amf.hdl,self.amf.entity) else: result = asp.clAmsMgmtEntityUserDataGetKey(self.amf.hdl,self.amf.entity,ckey) self.log("Associated data result [%s]" % str(result)) except SystemError,ex: if ErrCode(ex[0]) != asp.CL_ERR_NOT_EXIST: # Associated data may not exist... self.log("Associated data key '%s'. Exception on entity %s. Return Code: 0x%x" % (key, e.name,ex[0])) raise result = None if result: e.associatedData = result self.log("Entity [%s] data [%s]" % (str(e.name),str(e.associatedData))) try: e.unpickleAssociatedData(result) except AttributeError: # No parser defined pass
def loadAssociatedData(self,key=None): """Iterates through the entity list loading all associated data into each entities' self.associatedData field. @param key Optional associated data key that will override the clusterinfo default key """ if key is None: key = self.associatedDataKey if key is not None: ckey = asp.SaNameT() setCNameT(ckey,key) self.log("Loading associated data using key [%s]" % key) for (n,e) in self.entities.items(): SetCEntity(self.amf.entity,e) try: if key is None: result = asp.clAmsMgmtEntityUserDataGet(self.amf.hdl,self.amf.entity) else: result = asp.clAmsMgmtEntityUserDataGetKey(self.amf.hdl,self.amf.entity,ckey) self.log("Associated data result [%s]" % str(result)) except SystemError,ex: if ErrCode(ex[0]) != asp.CL_ERR_NOT_EXIST: # Associated data may not exist... self.log("Associated data key '%s'. Exception on entity %s. Return Code: 0x%x" % (key, e.name,ex[0])) raise result = None if result: e.associatedData = result self.log("Entity [%s] data [%s]" % (str(e.name),str(e.associatedData))) try: e.unpickleAssociatedData(result) except AttributeError: # No parser defined pass
def GetAssociatedData(self,entity,key=None): """Sets user data to be associated with this entity. @param entity An object derived from AmfEntity or a (type,name) pair @param key The key to use to retrieve this data. If None or unspecified, the default key for this session will be used. """ if key is None: key = self.defaultAssociatedDataKey if key is not None: setCNameT(self.cname,key) SetCEntity(self.entity,entity) if key is None: result = asp.clAmsMgmtEntityUserDataGet(self.hdl,self.entity) else: result = asp.clAmsMgmtEntityUserDataGetKey(self.hdl,self.entity,self.cname) return result