For prettier output machines in result setup description are sorted by id's of machines
Signed-off-by: Jiri Prochazka jprochaz@redhat.com --- lnst/Controller/NetTestResultSerializer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst/Controller/NetTestResultSerializer.py b/lnst/Controller/NetTestResultSerializer.py index fbe4392..e4fe086 100644 --- a/lnst/Controller/NetTestResultSerializer.py +++ b/lnst/Controller/NetTestResultSerializer.py @@ -94,7 +94,7 @@ class NetTestResultSerializer: "Setup is using virtual machines.", ""))
- for m_id, m in match["machines"].iteritems(): + for m_id, m in sorted(match["machines"].iteritems()): output_pairs.append((4*" " + "host "%s" uses "%s"" %\ (m_id, m["target"]), "")) for if_id, pool_if in m["interfaces"].iteritems():
For prettier output machines in setup description are sorted by id's of machines
Signed-off-by: Jiri Prochazka jprochaz@redhat.com --- lnst/Controller/NetTestController.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py index 1e90688..cce1fec 100644 --- a/lnst/Controller/NetTestController.py +++ b/lnst/Controller/NetTestController.py @@ -244,7 +244,7 @@ class NetTestController: logging.info("Pool match description:") if sp.is_setup_virtual(): logging.info(" Setup is using virtual machines.") - for m_id, m in match["machines"].iteritems(): + for m_id, m in sorted(match["machines"].iteritems()): logging.info(" host "%s" uses "%s"" % (m_id, m["target"])) for if_id, match in m["interfaces"].iteritems(): pool_id = match["target"]
For prettier output, machines are sorted before querying for availability and the output of available machines is also sorted by machine's ids
Signed-off-by: Jiri Prochazka jprochaz@redhat.com --- lnst/Controller/SlavePool.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py index 1a1114d..21dd3e7 100644 --- a/lnst/Controller/SlavePool.py +++ b/lnst/Controller/SlavePool.py @@ -78,7 +78,7 @@ class SlavePool:
if self._pool_checks: check_sockets = {} - for m_id, m in pool.iteritems(): + for m_id, m in sorted(pool.iteritems()): hostname = m["params"]["hostname"] if "rpc_port" in m["params"]: port = m["params"]["rpc_port"] @@ -111,7 +111,7 @@ class SlavePool: for m_id in pool.keys(): pool[m_id]["available"] = True
- for m_id in list(pool.keys()): + for m_id in sorted(list(pool.keys())): m = pool[m_id] if m["available"]: if 'libvirt_domain' in m['params']:
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@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)
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@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@lists.fedorahosted.org https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedorahoste...
Mon, Feb 01, 2016 at 04:49:52PM CET, olichtne@redhat.com wrote:
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
I agree. I've just checked with sorting the interface stack and this will actually change the hashes also on our bare metal setups, not just virtual ones.
Unfortunate. But I think there's no other way how to do this properly.
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@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@lists.fedorahosted.org https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedorahoste...
LNST-developers mailing list lnst-developers@lists.fedorahosted.org https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedorahoste...
Wed, Feb 03, 2016 at 05:02:52PM CET, jtluka@redhat.com wrote:
Mon, Feb 01, 2016 at 04:49:52PM CET, olichtne@redhat.com wrote:
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
I agree. I've just checked with sorting the interface stack and this will actually change the hashes also on our bare metal setups, not just virtual ones.
Unfortunate. But I think there's no other way how to do this properly.
Actually it's doable. Attached is two versions of interface sorting patch I tried.
v1.patch: With the first one the match changed compared to the previous runs.
v2.patch: With the second the match remains the same. The only change is that in addition to sorting the reverse is added.
Let me know what you think.
-Jan
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
Version 2: Sort also interfaces and use reverse sorting just to make sure we're processing the hostnames and interfaces in alphabetical order while matching.
Signed-off-by: Jiri Prochazka jprochaz@redhat.com Signed-off-by: Jan Tluka jtluka@redhat.com --- lnst/Controller/SlavePool.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py index 21dd3e7..87bc850 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(), reverse=True)
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(), reverse=True): if self._virtual_matching: if "libvirt_domain" in p_machine["params"]: self._unmatched_pool_machines.append(p_id) @@ -450,9 +450,9 @@ class SetupMapper(object): if self._check_machine_compatibility(mreq_m_id, pool_m_id): #map compatible pool machine stack_top["current_match"] = pool_m_id - pool_ifs = self._pool[pool_m_id]["interfaces"].keys() - stack_top["unmatched_pool_ifs"] = list(pool_ifs) - + stack_top["unmatched_pool_ifs"] = \ + sorted(self._pool[pool_m_id]["interfaces"].keys(), + reverse=True) self._unmatched_pool_machines.remove(pool_m_id) break
@@ -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(), reverse=True): if self._virtual_matching: if "libvirt_domain" in p_machine["params"]: self._unmatched_pool_machines.append(p_id) @@ -550,7 +550,8 @@ class SetupMapper(object): machine_match["if_stack"] = []
machine = self._mreqs[machine_match["m_id"]] - machine_match["unmatched_ifs"] = machine["interfaces"].keys() + machine_match["unmatched_ifs"] = sorted(machine["interfaces"].keys(), + reverse=True) machine_match["unmatched_pool_ifs"] = []
if self._virtual_matching:
Thu, Jan 28, 2016 at 05:53:36PM CET, jprochaz@redhat.com wrote:
For prettier output machines in result setup description are sorted by id's of machines
Signed-off-by: Jiri Prochazka jprochaz@redhat.com
lnst/Controller/NetTestResultSerializer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst/Controller/NetTestResultSerializer.py b/lnst/Controller/NetTestResultSerializer.py index fbe4392..e4fe086 100644 --- a/lnst/Controller/NetTestResultSerializer.py +++ b/lnst/Controller/NetTestResultSerializer.py @@ -94,7 +94,7 @@ class NetTestResultSerializer: "Setup is using virtual machines.", ""))
for m_id, m in match["machines"].iteritems():
for m_id, m in sorted(match["machines"].iteritems()): output_pairs.append((4*" " + "host \"%s\" uses \"%s\"" %\ (m_id, m["target"]), "")) for if_id, pool_if in m["interfaces"].iteritems():
-- 2.4.3 _______________________________________________ LNST-developers mailing list lnst-developers@lists.fedorahosted.org https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedorahoste...
Ack to series Acked-by: Jan Tluka jtluka@redhat.com
lnst-developers@lists.fedorahosted.org