From: Ondrej Lichtner <olichtne(a)redhat.com>
This boolean attribute signifies if the specific Machine object is
mapped and in use by the currently executed recipe. This is significant
for the message dispatcher when ignoring disconnects for slaves that are
not used for the recipe.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/Controller.py | 2 ++
lnst/Controller/Machine.py | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/lnst/Controller/Controller.py b/lnst/Controller/Controller.py
index f306319..00b15d9 100644
--- a/lnst/Controller/Controller.py
+++ b/lnst/Controller/Controller.py
@@ -155,6 +155,7 @@ class Controller(object):
machine.set_id(m_id)
self._prepare_machine(machine, recipe)
+ machine.set_mapped(True)
for if_id, i in m["interfaces"].items():
host._map_device(if_id, i)
@@ -183,6 +184,7 @@ class Controller(object):
machine.cleanup()
#clean-up slave logger
self._log_ctl.remove_slave(m_id)
+ machine.set_mapped(False)
self._machines.clear()
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index 11055c8..1265265 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -49,6 +49,7 @@ class Machine(object):
libvirt_domain=None, rpcport=None, security=None):
self._id = m_id
self._hostname = hostname
+ self._mapped = False
self._ctl_config = ctl_config
self._slave_desc = None
self._connection = None
@@ -97,6 +98,12 @@ class Machine(object):
def get_id(self):
return self._id
+ def set_mapped(self, new_value):
+ self._mapped = new_value
+
+ def get_mapped(self):
+ return self._mapped
+
def get_configuration(self):
configuration = {}
configuration["id"] = self._id
--
2.17.0