commit 2ed4e1e80de597309833a2b144682a63fcea3e74
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Fri Sep 20 12:53:46 2013 +0200
SlavePool: Check for duplicate configs
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>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/SlavePool.py | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py
index 301ea60..ebd3c2a 100644
--- a/lnst/Controller/SlavePool.py
+++ b/lnst/Controller/SlavePool.py
@@ -84,6 +84,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
Show replies by date