Simone Tiraboschi has uploaded a new change for review.

Change subject: packaging: setup: configuring cluster CPU type only on the 
first host
......................................................................

packaging: setup: configuring cluster CPU type only on the first host

No need to reconfigure the cluster CPU type for each additional host

Change-Id: I82916788b8e2582bbf3bebc3c285e1833b7678ad
Bug-Url: https://bugzilla.redhat.com/1086032
Signed-off-by: Simone Tiraboschi <[email protected]>
---
M src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
1 file changed, 42 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/34/34834/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 c2e70b3..ca6d269 100644
--- a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
+++ b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
@@ -517,48 +517,54 @@
                     cluster=cluster_name,
                 )
             )
-        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 not self.environment[
+            ohostedcons.CoreEnv.IS_ADDITIONAL_HOST
+        ]:
+            up = self._wait_host_ready(
+                engine_api,
+                self.environment[ohostedcons.EngineEnv.APP_HOST_NAME]
             )
-        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,
-                )
+            if not up:
                 self.logger.error(
                     _(
-                        'Cannot automatically set CPU level '
-                        'of cluster {cluster}:\n{details}\n'
+                        'Unable to add {host} to the manager'
                     ).format(
-                        cluster=cluster_name,
-                        details=e.detail
+                        host=self.environment[
+                            ohostedcons.EngineEnv.APP_HOST_NAME
+                        ],
                     )
                 )
+            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/34834
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I82916788b8e2582bbf3bebc3c285e1833b7678ad
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Simone Tiraboschi <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to