daemon: Remove tracking remote node boot status.
The instantiation-complete status of remote servers should indicate when all nodes are running.
This commit is contained in:
parent
d33147154c
commit
6d1b5d28a1
2 changed files with 2 additions and 40 deletions
|
@ -71,7 +71,6 @@ class CoreBroker(ConfigurableManager):
|
||||||
self.nodemap_lock = threading.Lock()
|
self.nodemap_lock = threading.Lock()
|
||||||
# reference counts of nodes on servers
|
# reference counts of nodes on servers
|
||||||
self.nodecounts = {}
|
self.nodecounts = {}
|
||||||
self.bootcount = 0
|
|
||||||
# set of node numbers that are link-layer nodes (networks)
|
# set of node numbers that are link-layer nodes (networks)
|
||||||
self.nets = set()
|
self.nets = set()
|
||||||
# set of node numbers that are PhysicalNode nodes
|
# set of node numbers that are PhysicalNode nodes
|
||||||
|
@ -117,7 +116,6 @@ class CoreBroker(ConfigurableManager):
|
||||||
if count < 1:
|
if count < 1:
|
||||||
self.delserver(server)
|
self.delserver(server)
|
||||||
self.nodecounts.clear()
|
self.nodecounts.clear()
|
||||||
self.bootcount = 0
|
|
||||||
self.nodemap_lock.release()
|
self.nodemap_lock.release()
|
||||||
self.nets.clear()
|
self.nets.clear()
|
||||||
self.phys.clear()
|
self.phys.clear()
|
||||||
|
@ -197,12 +195,6 @@ class CoreBroker(ConfigurableManager):
|
||||||
nodenum = msg.gettlv(coreapi.CORE_TLV_NODE_NUMBER)
|
nodenum = msg.gettlv(coreapi.CORE_TLV_NODE_NUMBER)
|
||||||
if nodenum is not None:
|
if nodenum is not None:
|
||||||
count = self.delnodemap(server, nodenum)
|
count = self.delnodemap(server, nodenum)
|
||||||
# snoop node add response to increment booted node count
|
|
||||||
# (only CoreNodes send these response messages)
|
|
||||||
elif msgflags & \
|
|
||||||
(coreapi.CORE_API_ADD_FLAG | coreapi.CORE_API_LOC_FLAG):
|
|
||||||
self.incrbootcount()
|
|
||||||
self.session.checkruntime()
|
|
||||||
elif msgtype == coreapi.CORE_API_LINK_MSG:
|
elif msgtype == coreapi.CORE_API_LINK_MSG:
|
||||||
# this allows green link lines for remote WLANs
|
# this allows green link lines for remote WLANs
|
||||||
msg = coreapi.CoreLinkMessage(msgflags, msghdr, msgdata)
|
msg = coreapi.CoreLinkMessage(msgflags, msghdr, msgdata)
|
||||||
|
@ -462,17 +454,6 @@ class CoreBroker(ConfigurableManager):
|
||||||
self.nodecounts[server] = count
|
self.nodecounts[server] = count
|
||||||
return count
|
return count
|
||||||
|
|
||||||
def incrbootcount(self):
|
|
||||||
''' Count a node that has booted.
|
|
||||||
'''
|
|
||||||
self.bootcount += 1
|
|
||||||
return self.bootcount
|
|
||||||
|
|
||||||
def getbootcount(self):
|
|
||||||
''' Return the number of booted nodes.
|
|
||||||
'''
|
|
||||||
return self.bootcount
|
|
||||||
|
|
||||||
def getserversbynode(self, nodenum):
|
def getserversbynode(self, nodenum):
|
||||||
''' Retrieve a set of emulation servers given a node number.
|
''' Retrieve a set of emulation servers given a node number.
|
||||||
'''
|
'''
|
||||||
|
@ -673,12 +654,6 @@ class CoreBroker(ConfigurableManager):
|
||||||
# do not record server name for networks since network
|
# do not record server name for networks since network
|
||||||
# nodes are replicated across all server
|
# nodes are replicated across all server
|
||||||
return servers
|
return servers
|
||||||
if issubclass(nodecls, PyCoreNet) and \
|
|
||||||
nodetype == coreapi.CORE_NODE_WLAN:
|
|
||||||
# special case where remote WLANs not in session._objs, and no
|
|
||||||
# node response message received, so they are counted here
|
|
||||||
if msg.gettlv(coreapi.CORE_TLV_NODE_EMUSRV) is not None:
|
|
||||||
self.incrbootcount()
|
|
||||||
elif issubclass(nodecls, PyCoreNode):
|
elif issubclass(nodecls, PyCoreNode):
|
||||||
name = msg.gettlv(coreapi.CORE_TLV_NODE_NAME)
|
name = msg.gettlv(coreapi.CORE_TLV_NODE_NAME)
|
||||||
if name:
|
if name:
|
||||||
|
|
|
@ -647,7 +647,7 @@ class Session(object):
|
||||||
self.broadcastraw(None, msg)
|
self.broadcastraw(None, msg)
|
||||||
# assume either all nodes have booted already, or there are some
|
# assume either all nodes have booted already, or there are some
|
||||||
# nodes on slave servers that will be booted and those servers will
|
# nodes on slave servers that will be booted and those servers will
|
||||||
# send a node status response message
|
# send a status response message
|
||||||
self.checkruntime()
|
self.checkruntime()
|
||||||
|
|
||||||
def getnodecount(self):
|
def getnodecount(self):
|
||||||
|
@ -680,20 +680,7 @@ class Session(object):
|
||||||
return
|
return
|
||||||
if self.getstate() == coreapi.CORE_EVENT_RUNTIME_STATE:
|
if self.getstate() == coreapi.CORE_EVENT_RUNTIME_STATE:
|
||||||
return
|
return
|
||||||
session_node_count = int(self.node_count)
|
# check if all servers have completed instantiation
|
||||||
nc = self.getnodecount()
|
|
||||||
# count booted nodes not emulated on this server
|
|
||||||
# TODO: let slave server determine RUNTIME and wait for Event Message
|
|
||||||
# broker.getbootocunt() counts all CoreNodes from status reponse
|
|
||||||
# messages, plus any remote WLANs; remote EMANE, hub, switch, etc.
|
|
||||||
# are already counted in self._objs
|
|
||||||
nc += self.broker.getbootcount()
|
|
||||||
self.info("Checking for runtime with %d of %d session nodes" % \
|
|
||||||
(nc, session_node_count))
|
|
||||||
if nc < session_node_count:
|
|
||||||
return # do not have information on all nodes yet
|
|
||||||
# information on all nodes has been received and they have been started
|
|
||||||
# enter the runtime state
|
|
||||||
if not self.broker.instantiation_complete():
|
if not self.broker.instantiation_complete():
|
||||||
return
|
return
|
||||||
state = coreapi.CORE_EVENT_RUNTIME_STATE
|
state = coreapi.CORE_EVENT_RUNTIME_STATE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue