I think we should probably sort the interface stack as well, just in
case there's more option for the interface match.
What do you think?
-Ondrej
On Thu, Jan 28, 2016 at 05:53:39PM +0100, Jiri Prochazka wrote:
> 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
> _______________________________________________
> LNST-developers mailing list
> lnst-developers(a)lists.fedorahosted.org
>
https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedoraho...