Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: setup: query cluster on attempts loop
......................................................................

packaging: setup: query cluster on attempts loop

_wait_cluster_cpu_ready queried 'cluster.get_cpu()' in a loop, but
this did not actually query the engine. So if we did not get the cpu
type on first attempt we repeatedly tried checking the same values
until timeout.

Bug-Url: https://bugzilla.redhat.com/1088572
Change-Id: I334d7eafda68843827af3f5ceb5132aefaf73f4a
Signed-off-by: Yedidyah Bar David <d...@redhat.com>
---
M src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
1 file changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/66/26966/1

diff --git a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py 
b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
index cd6449d..f0659d8 100644
--- a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
+++ b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
@@ -241,11 +241,12 @@
             ))
         return isUp
 
-    def _wait_cluster_cpu_ready(self, cluster):
+    def _wait_cluster_cpu_ready(self, engine_api, cluster_name):
         tries = self.VDSM_RETRIES
         cpu = None
         while cpu is None and tries > 0:
             tries -= 1
+            cluster = engine_api.clusters.get(cluster_name)
             cpu = cluster.get_cpu()
             if cpu is None:
                 self.logger.debug(
@@ -269,7 +270,7 @@
                 'Timed out while waiting for cluster to become ready. '
                 'Please check the logs.'
             ))
-        return cpu
+        return cluster, cpu
 
     @plugin.event(
         stage=plugin.Stages.STAGE_INIT,
@@ -462,9 +463,10 @@
             #This works only if the host is up.
             self.logger.debug('Setting CPU for the cluster')
             try:
-                cluster = engine_api.clusters.get('Default')
-                self.logger.debug(cluster.__dict__)
-                cpu = self._wait_cluster_cpu_ready(cluster)
+                cluster, cpu = self._wait_cluster_cpu_ready(
+                    engine_api,
+                    'Default'
+                )
                 self.logger.debug(cpu.__dict__)
                 cpu.set_id(self.environment[ohostedcons.VDSMEnv.ENGINE_CPU])
                 cluster.set_cpu(cpu)


-- 
To view, visit http://gerrit.ovirt.org/26966
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I334d7eafda68843827af3f5ceb5132aefaf73f4a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: ovirt-hosted-engine-setup-1.1
Gerrit-Owner: Yedidyah Bar David <d...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to