removed node boot/validate methods, since it was using a circular reference to run a CoreService method
This commit is contained in:
parent
37517c45f4
commit
0efcd910db
6 changed files with 3 additions and 47 deletions
|
@ -515,9 +515,7 @@ class EmuSession(Session):
|
||||||
if self.state == EventTypes.RUNTIME_STATE.value and is_boot_node:
|
if self.state == EventTypes.RUNTIME_STATE.value and is_boot_node:
|
||||||
self.write_objects()
|
self.write_objects()
|
||||||
self.add_remove_control_interface(node=node, remove=False)
|
self.add_remove_control_interface(node=node, remove=False)
|
||||||
|
self.services.bootnodeservices(node)
|
||||||
# TODO: common method to both Physical and LxcNodes, but not the common PyCoreNode
|
|
||||||
node.boot()
|
|
||||||
|
|
||||||
return node
|
return node
|
||||||
|
|
||||||
|
|
|
@ -156,14 +156,6 @@ class SimpleLxcNode(PyCoreNode):
|
||||||
self.client.close()
|
self.client.close()
|
||||||
self.up = False
|
self.up = False
|
||||||
|
|
||||||
def boot(self):
|
|
||||||
"""
|
|
||||||
Boot logic.
|
|
||||||
|
|
||||||
:return: nothing
|
|
||||||
"""
|
|
||||||
return None
|
|
||||||
|
|
||||||
def cmd(self, args, wait=True):
|
def cmd(self, args, wait=True):
|
||||||
"""
|
"""
|
||||||
Runs shell command on node, with option to not wait for a result.
|
Runs shell command on node, with option to not wait for a result.
|
||||||
|
@ -222,7 +214,6 @@ class SimpleLxcNode(PyCoreNode):
|
||||||
raise CoreCommandError(status, cmd, output)
|
raise CoreCommandError(status, cmd, output)
|
||||||
self._mounts.append((source, target))
|
self._mounts.append((source, target))
|
||||||
|
|
||||||
|
|
||||||
def newifindex(self):
|
def newifindex(self):
|
||||||
"""
|
"""
|
||||||
Retrieve a new interface index.
|
Retrieve a new interface index.
|
||||||
|
@ -511,22 +502,6 @@ class LxcNode(SimpleLxcNode):
|
||||||
if start:
|
if start:
|
||||||
self.startup()
|
self.startup()
|
||||||
|
|
||||||
def boot(self):
|
|
||||||
"""
|
|
||||||
Boot the node.
|
|
||||||
|
|
||||||
:return: nothing
|
|
||||||
"""
|
|
||||||
self.session.services.bootnodeservices(self)
|
|
||||||
|
|
||||||
def validate(self):
|
|
||||||
"""
|
|
||||||
Validate the node.
|
|
||||||
|
|
||||||
:return: nothing
|
|
||||||
"""
|
|
||||||
self.session.services.validatenodeservices(self)
|
|
||||||
|
|
||||||
def startup(self):
|
def startup(self):
|
||||||
"""
|
"""
|
||||||
Startup logic for the node.
|
Startup logic for the node.
|
||||||
|
|
|
@ -25,12 +25,6 @@ class PhysicalNode(PyCoreNode):
|
||||||
if start:
|
if start:
|
||||||
self.startup()
|
self.startup()
|
||||||
|
|
||||||
def boot(self):
|
|
||||||
self.session.services.bootnodeservices(self)
|
|
||||||
|
|
||||||
def validate(self):
|
|
||||||
self.session.services.validatenodeservices(self)
|
|
||||||
|
|
||||||
def startup(self):
|
def startup(self):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
self.makenodedir()
|
self.makenodedir()
|
||||||
|
|
|
@ -386,7 +386,6 @@ class CoreServices(object):
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
files = []
|
files = []
|
||||||
|
|
||||||
if not service.custom:
|
if not service.custom:
|
||||||
return files
|
return files
|
||||||
|
|
||||||
|
@ -479,16 +478,6 @@ class CoreServices(object):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def validatenodeservices(self, node):
|
|
||||||
"""
|
|
||||||
Run validation commands for all services on a node.
|
|
||||||
|
|
||||||
:param core.netns.vnode.LxcNode node: node to validate services for
|
|
||||||
:return: nothing
|
|
||||||
"""
|
|
||||||
for service in node.services:
|
|
||||||
self.validatenodeservice(node, service)
|
|
||||||
|
|
||||||
def validatenodeservice(self, node, service):
|
def validatenodeservice(self, node, service):
|
||||||
"""
|
"""
|
||||||
Run the validation command(s) for a service.
|
Run the validation command(s) for a service.
|
||||||
|
|
|
@ -727,7 +727,7 @@ class Session(object):
|
||||||
# add a control interface if configured
|
# add a control interface if configured
|
||||||
logger.info("booting node: %s", obj.name)
|
logger.info("booting node: %s", obj.name)
|
||||||
self.add_remove_control_interface(node=obj, remove=False)
|
self.add_remove_control_interface(node=obj, remove=False)
|
||||||
result = pool.apply_async(obj.boot)
|
result = pool.apply_async(self.services.bootnodeservices, (obj,))
|
||||||
results.append(result)
|
results.append(result)
|
||||||
|
|
||||||
pool.close()
|
pool.close()
|
||||||
|
|
|
@ -160,7 +160,7 @@ def main():
|
||||||
n.cmd([constants.SYSCTL_BIN, "net.ipv4.icmp_echo_ignore_broadcasts=0"])
|
n.cmd([constants.SYSCTL_BIN, "net.ipv4.icmp_echo_ignore_broadcasts=0"])
|
||||||
if options.services is not None:
|
if options.services is not None:
|
||||||
session.services.addservicestonode(n, "", options.services.split("|"))
|
session.services.addservicestonode(n, "", options.services.split("|"))
|
||||||
n.boot()
|
session.services.bootnodeservices(n)
|
||||||
nodelist.append(n)
|
nodelist.append(n)
|
||||||
if i % 25 == 0:
|
if i % 25 == 0:
|
||||||
print "\n%s nodes created " % i,
|
print "\n%s nodes created " % i,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue