On Thu, Sep 19, 2013 at 03:15:01PM +0200, Radek Pazdera wrote:
This commit adds a checkf for machine duplicity in the pool.
one might forget an old slavemachine in the pool. Having two configs
reference the same machine will most likely lead to lockups.
This situation is very hard to debug, so we're adding a check for it.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
lnst/Controller/SlavePool.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py
index bd81f81..a7a0df4 100644
@@ -87,6 +87,18 @@ class SlavePool:
xml_data = parser.parse()
machine_spec = self._process_machine_xml_data(m_id, xml_data)
+ # Check if there isn't any machine with the same
+ # hostname or libvirt_domain already in the pool
+ for pm_id, m in self._pool.iteritems():
+ pm = m["params"]
+ rm = machine_spec["params"]
+ print pm_id, m
Please, don't apply, I just realized I left a debug print there :-/.
I'm sorry about that. Will post v2.
+ if pm["hostname"] ==
rm["hostname"] or \
+ pm["libvirt_domain"] == rm["libvirt_domain"]:
+ msg = "You have the same machine listed twice in " \
+ "your pool ('%s' and '%s')." % (m_id,
+ raise SlaveMachineError(msg)
available = False