Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: setup: always wait for host addition
......................................................................

packaging: setup: always wait for host addition

Without this patch, we wait only on first host and not on additional.

This causes (among other things?) HA to start before host-deploy.
At that point, the vdsm cert has the hostname as CN. host-deploy then
creates it again with the IP address as CN (caused by HE deploy, a
different matter).

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


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/24/36624/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 9730ca0..cd9a006 100644
--- a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
+++ b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
@@ -606,6 +606,21 @@
                 )
             )
 
+        up = self._wait_host_ready(
+            engine_api,
+            self.environment[ohostedcons.EngineEnv.APP_HOST_NAME]
+        )
+        if not up:
+            self.logger.error(
+                _(
+                    'Unable to add {host} to the manager'
+                ).format(
+                    host=self.environment[
+                        ohostedcons.EngineEnv.APP_HOST_NAME
+                    ],
+                )
+            )
+
         if self.environment[
             ohostedcons.CoreEnv.IS_ADDITIONAL_HOST
         ]:
@@ -613,51 +628,36 @@
                 engine_api,
                 self.environment[ohostedcons.EngineEnv.APP_HOST_NAME],
             )
-        else:
-            up = self._wait_host_ready(
-                engine_api,
-                self.environment[ohostedcons.EngineEnv.APP_HOST_NAME]
-            )
-            if not up:
+        elif up:
+            # This works only if the host is up.
+            self.logger.debug('Setting CPU for the cluster')
+            try:
+                cluster, cpu = self._wait_cluster_cpu_ready(
+                    engine_api,
+                    cluster_name
+                )
+                self.logger.debug(cpu.__dict__)
+                cpu.set_id(
+                    self.environment[ohostedcons.VDSMEnv.ENGINE_CPU]
+                )
+                cluster.set_cpu(cpu)
+                cluster.update()
+            except ovirtsdk.infrastructure.errors.RequestError as e:
+                self.logger.debug(
+                    'Cannot set CPU level of cluster {cluster}'.format(
+                        cluster=cluster_name,
+                    ),
+                    exc_info=True,
+                )
                 self.logger.error(
                     _(
-                        'Unable to add {host} to the manager'
+                        'Cannot automatically set CPU level '
+                        'of cluster {cluster}:\n{details}\n'
                     ).format(
-                        host=self.environment[
-                            ohostedcons.EngineEnv.APP_HOST_NAME
-                        ],
+                        cluster=cluster_name,
+                        details=e.detail
                     )
                 )
-            else:
-                # This works only if the host is up.
-                self.logger.debug('Setting CPU for the cluster')
-                try:
-                    cluster, cpu = self._wait_cluster_cpu_ready(
-                        engine_api,
-                        cluster_name
-                    )
-                    self.logger.debug(cpu.__dict__)
-                    cpu.set_id(
-                        self.environment[ohostedcons.VDSMEnv.ENGINE_CPU]
-                    )
-                    cluster.set_cpu(cpu)
-                    cluster.update()
-                except ovirtsdk.infrastructure.errors.RequestError as e:
-                    self.logger.debug(
-                        'Cannot set CPU level of cluster {cluster}'.format(
-                            cluster=cluster_name,
-                        ),
-                        exc_info=True,
-                    )
-                    self.logger.error(
-                        _(
-                            'Cannot automatically set CPU level '
-                            'of cluster {cluster}:\n{details}\n'
-                        ).format(
-                            cluster=cluster_name,
-                            details=e.detail
-                        )
-                    )
         engine_api.disconnect()
 
     @plugin.event(


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib8537b25493fa0263d09887b04935796d601c6eb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
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