We want to have matching algorithm deterministic. For that we need to
secure, that data are entered in the same order each time. This patch
adds sorting of machines by their id's before they enter matching algorithm
so it shouldn't happen that for same setup, machines are mapped differently
in more runs
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
lnst/Controller/SlavePool.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py
index 21dd3e7..53ad362 100644
--- a/lnst/Controller/SlavePool.py
+++ b/lnst/Controller/SlavePool.py
@@ -402,7 +402,7 @@ class SetupMapper(object):
def reset_match_state(self):
self._net_label_mapping = {}
self._machine_stack = []
- self._unmatched_req_machines = self._mreqs.keys()
+ self._unmatched_req_machines = sorted(self._mreqs.keys())
self._pool_stack = list(self._pools.keys())
if len(self._pool_stack) > 0:
@@ -410,7 +410,7 @@ class SetupMapper(object):
self._pool = self._pools[self._pool_name]
self._unmatched_pool_machines = []
- for p_id, p_machine in self._pool.iteritems():
+ for p_id, p_machine in sorted(self._pool.iteritems()):
if self._virtual_matching:
if "libvirt_domain" in p_machine["params"]:
self._unmatched_pool_machines.append(p_id)
@@ -475,7 +475,7 @@ class SetupMapper(object):
self._pool_name)
self._unmatched_pool_machines = []
- for p_id, p_machine in self._pool.iteritems():
+ for p_id, p_machine in sorted(self._pool.iteritems()):
if self._virtual_matching:
if "libvirt_domain" in
p_machine["params"]:
self._unmatched_pool_machines.append(p_id)
--
2.4.3