removed node boot/validate methods, since it was using a circular reference to run a CoreService method

This commit is contained in:
Blake J. Harnden 2018-06-22 11:59:16 -07:00
parent 37517c45f4
commit 0efcd910db
6 changed files with 3 additions and 47 deletions

View file

@ -515,9 +515,7 @@ class EmuSession(Session):
if self.state == EventTypes.RUNTIME_STATE.value and is_boot_node:
self.write_objects()
self.add_remove_control_interface(node=node, remove=False)
# TODO: common method to both Physical and LxcNodes, but not the common PyCoreNode
node.boot()
self.services.bootnodeservices(node)
return node

View file

@ -156,14 +156,6 @@ class SimpleLxcNode(PyCoreNode):
self.client.close()
self.up = False
def boot(self):
"""
Boot logic.
:return: nothing
"""
return None
def cmd(self, args, wait=True):
"""
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)
self._mounts.append((source, target))
def newifindex(self):
"""
Retrieve a new interface index.
@ -511,22 +502,6 @@ class LxcNode(SimpleLxcNode):
if start:
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):
"""
Startup logic for the node.

View file

@ -25,12 +25,6 @@ class PhysicalNode(PyCoreNode):
if start:
self.startup()
def boot(self):
self.session.services.bootnodeservices(self)
def validate(self):
self.session.services.validatenodeservices(self)
def startup(self):
with self.lock:
self.makenodedir()

View file

@ -386,7 +386,6 @@ class CoreServices(object):
:return:
"""
files = []
if not service.custom:
return files
@ -479,16 +478,6 @@ class CoreServices(object):
return True
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):
"""
Run the validation command(s) for a service.

View file

@ -727,7 +727,7 @@ class Session(object):
# add a control interface if configured
logger.info("booting node: %s", obj.name)
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)
pool.close()

View file

@ -160,7 +160,7 @@ def main():
n.cmd([constants.SYSCTL_BIN, "net.ipv4.icmp_echo_ignore_broadcasts=0"])
if options.services is not None:
session.services.addservicestonode(n, "", options.services.split("|"))
n.boot()
session.services.bootnodeservices(n)
nodelist.append(n)
if i % 25 == 0:
print "\n%s nodes created " % i,