daemon: Wait longer for EMANE network interfaces to exist.
When EMANE is still running.
This commit is contained in:
parent
6d1b5d28a1
commit
b1beff1eba
2 changed files with 29 additions and 1 deletions
|
@ -1153,6 +1153,22 @@ class Emane(ConfigurableManager):
|
||||||
self.session.sdt.updatenodegeo(node.objid, lat, long, alt)
|
self.session.sdt.updatenodegeo(node.objid, lat, long, alt)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def emanerunning(self, node):
|
||||||
|
'''\
|
||||||
|
Return True if an EMANE process associated with the given node
|
||||||
|
is running, False otherwise.
|
||||||
|
'''
|
||||||
|
status = -1
|
||||||
|
cmd = ['pkill', '-0', '-x', 'emane']
|
||||||
|
try:
|
||||||
|
if self.version < self.EMANE092:
|
||||||
|
status = subprocess.call(cmd)
|
||||||
|
else:
|
||||||
|
status = node.cmd(cmd, wait=True)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return status == 0
|
||||||
|
|
||||||
def emane_version():
|
def emane_version():
|
||||||
'Return the locally installed EMANE version identifier and string.'
|
'Return the locally installed EMANE version identifier and string.'
|
||||||
cmd = ('emane', '--version')
|
cmd = ('emane', '--version')
|
||||||
|
|
|
@ -116,7 +116,19 @@ class TunTap(PyCoreNetIf):
|
||||||
def nodedevexists():
|
def nodedevexists():
|
||||||
cmd = (IP_BIN, 'link', 'show', self.name)
|
cmd = (IP_BIN, 'link', 'show', self.name)
|
||||||
return self.node.cmd(cmd)
|
return self.node.cmd(cmd)
|
||||||
self.waitfor(nodedevexists)
|
count = 0
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
self.waitfor(nodedevexists)
|
||||||
|
break
|
||||||
|
except RuntimeError:
|
||||||
|
# check if this is an EMANE interface; if so, continue
|
||||||
|
# waiting if EMANE is still running
|
||||||
|
if count < 5 and isinstance(self.net, EmaneNode) and \
|
||||||
|
self.node.session.emane.emanerunning(self.node):
|
||||||
|
count += 1
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
''' Install this TAP into its namespace. This is not done from the
|
''' Install this TAP into its namespace. This is not done from the
|
||||||
|
|
Loading…
Reference in a new issue