def GetNodes(self): """Return a list of existing nodes where each node is a dictionary The \ref clusterinfo module provides a much more extensive API """ nodes = self.GetConfiguredNodeNames() running = asppycustom.GetRunningNodeList() name2slot = {} for r in running: name2slot[r['name']] = r['slot'] ret = [] for nodename in nodes: config = asp.clAmsMgmtNodeGetConfig(self.hdl,nodename) state = asp.clAmsMgmtNodeGetStatus(self.hdl,nodename) slot = name2slot.get(nodename, None) n = AmfNode(nodename,slot) n.setConfig(config) n.setState(state) ret.append(n) return ret
def GetNodes(self): """Return a list of existing nodes where each node is a dictionary The \ref clusterinfo module provides a much more extensive API """ nodes = self.GetConfiguredNodeNames() running = asppycustom.GetRunningNodeList() name2slot = {} for r in running: name2slot[r['name']] = r['slot'] ret = [] for nodename in nodes: config = asp.clAmsMgmtNodeGetConfig(self.hdl, nodename) state = asp.clAmsMgmtNodeGetStatus(self.hdl, nodename) slot = name2slot.get(nodename, None) n = AmfNode(nodename, slot) n.setConfig(config) n.setState(state) ret.append(n) return ret
def loadNodes(self, oldObj=None): """Private: Reloads the node information from the C layers (call load() instead)""" self.log("Loading node config and status") if fake: return nodes = asppycustom.GetConfiguredEntities(NodeType) self.log("Loading live node list") #livenodelist = asppycustom.GetRunningNodeList() livenodes = self.alive = self.amf.GetAllWorkAssignments() self.log("Loading live nodes complete") for node in nodes: name = node[1] liveInfo = livenodes.get(name, None) # Create the node if liveInfo: nodeSlot = liveInfo['slot'] else: nodeSlot = 0 n = AmfNode(name, nodeSlot) try: installInfo = asp.clAmsMgmtGetAspInstallInfo( self.amf.hdl, name, 255) installInfo = dict( [x.split("=") for x in installInfo.split(",")]) n.setIntraclusterAccess(installInfo['interface'].split(":")[1], None, None, installInfo.get('dir', None)) n.aspVersion = installInfo['version'] except SystemError, e: pass # Add the configured info try: nsd = self.suppliedData.nodes[name] except KeyError: self.log( "Supplied configuration does not contain blade definition [%s]" % name) nsd = None except AttributeError: # it doesn't even have .nodes self.log( "Supplied configuration does not contain any blade definitions" ) nsd = None # Add the AMF status and config config = asp.clAmsMgmtNodeGetConfig(self.amf.hdl, name) status = asp.clAmsMgmtNodeGetStatus(self.amf.hdl, name) n.setConfig(config) n.setStatus(status) if nsd: # Set Intracluster Access n.setIntraclusterAccess(nsd.ip, nsd.user, nsd.password, nsd.aspdir) # Allow it to be indexed by IP self.nodes[nsd.ip] = n if oldObj: oldnode = oldObj.entities.get(name, None) if oldnode: n.copyLocalState(oldnode) # Allow it to be indexed by name self.nodes[name] = n self.entities[name] = n # Allow it to be indexed by slot (if it has one) if n.slot: self.nodes[n.slot] = n # Allow an iterator to hit only the nodes self.nodeList.append(n)
def loadNodes(self,oldObj=None): """Private: Reloads the node information from the C layers (call load() instead)""" self.log("Loading node config and status") if fake: return nodes = asppycustom.GetConfiguredEntities(NodeType) self.log("Loading live node list") #livenodelist = asppycustom.GetRunningNodeList() livenodes = self.alive = self.amf.GetAllWorkAssignments() self.log("Loading live nodes complete") for node in nodes: name = node[1] liveInfo = livenodes.get(name,None) # Create the node if liveInfo: nodeSlot = liveInfo['slot'] else: nodeSlot = 0 n = AmfNode(name,nodeSlot) try: installInfo = asp.clAmsMgmtGetAspInstallInfo(self.amf.hdl,name,255) installInfo = dict([x.split("=") for x in installInfo.split(",")]) n.setIntraclusterAccess(installInfo['interface'].split(":")[1],None,None,installInfo.get('dir',None)) n.aspVersion = installInfo['version'] except SystemError,e: pass # Add the configured info try: nsd = self.suppliedData.nodes[name] except KeyError: self.log("Supplied configuration does not contain blade definition [%s]" % name) nsd = None except AttributeError: # it doesn't even have .nodes self.log("Supplied configuration does not contain any blade definitions") nsd = None # Add the AMF status and config config = asp.clAmsMgmtNodeGetConfig(self.amf.hdl,name) status = asp.clAmsMgmtNodeGetStatus(self.amf.hdl,name) n.setConfig(config) n.setStatus(status) if nsd: # Set Intracluster Access n.setIntraclusterAccess(nsd.ip,nsd.user,nsd.password,nsd.aspdir) # Allow it to be indexed by IP self.nodes[nsd.ip] = n if oldObj: oldnode=oldObj.entities.get(name,None) if oldnode: n.copyLocalState(oldnode) # Allow it to be indexed by name self.nodes[name] = n self.entities[name] = n # Allow it to be indexed by slot (if it has one) if n.slot: self.nodes[n.slot] = n # Allow an iterator to hit only the nodes self.nodeList.append(n)