This commit adds a checkf for machine duplicity in the pool. Sometimes,
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 | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py
index bd81f81..ea4bb46 100644
--- a/lnst/Controller/SlavePool.py
+++ b/lnst/Controller/SlavePool.py
@@ -87,6 +87,17 @@ 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"]
+ 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,
pm_id)
+ raise SlaveMachineError(msg)
+
if self._pool_checks:
available = False
--
1.8.3.1
Show replies by thread
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
---
lnst/Controller/SlavePool.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py
index ea4bb46..a49159b 100644
--- a/lnst/Controller/SlavePool.py
+++ b/lnst/Controller/SlavePool.py
@@ -57,6 +57,9 @@ class SlavePool:
for dirent in dentries:
res.append(self.add_file("%s/%s" % (pool_dir, dirent)))
+ if len(res) == 0:
+ logging.warn("No machines found in this directory")
+
max_len = 0
for m_id, _ in res:
if len(m_id) > max_len:
--
1.8.3.1