avoid attempting to stop services for nodes that are not considered up
This commit is contained in:
parent
3846f2b5bd
commit
c66ee04db5
4 changed files with 7 additions and 13 deletions
|
@ -1556,7 +1556,8 @@ class Session:
|
||||||
funcs = []
|
funcs = []
|
||||||
for node_id in self.nodes:
|
for node_id in self.nodes:
|
||||||
node = self.nodes[node_id]
|
node = self.nodes[node_id]
|
||||||
if isinstance(node, CoreNodeBase):
|
if not isinstance(node, CoreNodeBase) or not node.up:
|
||||||
|
continue
|
||||||
args = (node,)
|
args = (node,)
|
||||||
funcs.append((self.services.stop_services, args, {}))
|
funcs.append((self.services.stop_services, args, {}))
|
||||||
utils.threadpool(funcs)
|
utils.threadpool(funcs)
|
||||||
|
|
|
@ -284,6 +284,7 @@ class CoreNodeBase(NodeBase):
|
||||||
self.config_services = {}
|
self.config_services = {}
|
||||||
self.nodedir = None
|
self.nodedir = None
|
||||||
self.tmpnodedir = False
|
self.tmpnodedir = False
|
||||||
|
self.up = False
|
||||||
|
|
||||||
def add_config_service(self, service_class: "ConfigServiceType") -> None:
|
def add_config_service(self, service_class: "ConfigServiceType") -> None:
|
||||||
"""
|
"""
|
||||||
|
@ -503,7 +504,6 @@ class CoreNode(CoreNodeBase):
|
||||||
)
|
)
|
||||||
self.client = None
|
self.client = None
|
||||||
self.pid = None
|
self.pid = None
|
||||||
self.up = False
|
|
||||||
self.lock = threading.RLock()
|
self.lock = threading.RLock()
|
||||||
self._mounts = []
|
self._mounts = []
|
||||||
self.bootsh = bootsh
|
self.bootsh = bootsh
|
||||||
|
|
|
@ -289,7 +289,6 @@ class Rj45Node(CoreNodeBase, CoreInterface):
|
||||||
"""
|
"""
|
||||||
CoreNodeBase.__init__(self, session, _id, name, start, server)
|
CoreNodeBase.__init__(self, session, _id, name, start, server)
|
||||||
CoreInterface.__init__(self, session, self, name, mtu, server)
|
CoreInterface.__init__(self, session, self, name, mtu, server)
|
||||||
self.up = False
|
|
||||||
self.lock = threading.RLock()
|
self.lock = threading.RLock()
|
||||||
self.ifindex = None
|
self.ifindex = None
|
||||||
# the following are PyCoreNetIf attributes
|
# the following are PyCoreNetIf attributes
|
||||||
|
|
|
@ -923,20 +923,14 @@ class CoreXmlReader:
|
||||||
|
|
||||||
if link_options.unidirectional == 1 and node_set in node_sets:
|
if link_options.unidirectional == 1 and node_set in node_sets:
|
||||||
logging.info(
|
logging.info(
|
||||||
"updating link node_one(%s) node_two(%s): %s",
|
"updating link node_one(%s) node_two(%s)", node_one, node_two
|
||||||
node_one,
|
|
||||||
node_two,
|
|
||||||
link_options,
|
|
||||||
)
|
)
|
||||||
self.session.update_link(
|
self.session.update_link(
|
||||||
node_one, node_two, interface_one.id, interface_two.id, link_options
|
node_one, node_two, interface_one.id, interface_two.id, link_options
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
logging.info(
|
logging.info(
|
||||||
"adding link node_one(%s) node_two(%s): %s",
|
"adding link node_one(%s) node_two(%s)", node_one, node_two
|
||||||
node_one,
|
|
||||||
node_two,
|
|
||||||
link_options,
|
|
||||||
)
|
)
|
||||||
self.session.add_link(
|
self.session.add_link(
|
||||||
node_one, node_two, interface_one, interface_two, link_options
|
node_one, node_two, interface_one, interface_two, link_options
|
||||||
|
|
Loading…
Add table
Reference in a new issue