Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: setup: Prompt if host non-operational
......................................................................

packaging: setup: Prompt if host non-operational

If user set up required networks but did not press 'activate',
host will remain non-operational.

Prompt if non-operational and suggest to activate.

This patch assumes that "non-operational" should not be possible
as a state the host can be in during deployment. No harm in
prompting anyway.

Change-Id: I481cb082adef25238bc06280e8d274b6d4cd8c9e
Related-To: https://bugzilla.redhat.com/1178535
Related-To: https://bugzilla.redhat.com/1086032
Signed-off-by: Yedidyah Bar David <d...@redhat.com>
---
M src/ovirt_hosted_engine_setup/constants.py
M src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
2 files changed, 50 insertions(+), 3 deletions(-)


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

diff --git a/src/ovirt_hosted_engine_setup/constants.py 
b/src/ovirt_hosted_engine_setup/constants.py
index 82a053c..a37f4ce 100644
--- a/src/ovirt_hosted_engine_setup/constants.py
+++ b/src/ovirt_hosted_engine_setup/constants.py
@@ -402,6 +402,7 @@
         return 'OVEHOSTED_ENGINE/clusterName'
 
     TEMPORARY_CERT_FILE = 'OVEHOSTED_ENGINE/temporaryCertificate'
+    PROMPT_NON_OPERATIONAL = 'OVEHOSTED_ENGINE/promptNonOperational'
 
 
 @util.export
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 43bc0a9..b5e3a05 100644
--- a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
+++ b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
@@ -238,12 +238,12 @@
                 self.logger.info(_('The VDSM Host is now operational'))
             else:
                 if state == 'non_operational':
-                    if not self._check_network_configuration(
+                    if not self._retry_non_operational(
                         engine_api,
                         self.environment[ohostedcons.EngineEnv.APP_HOST_NAME],
                     ):
                         # It's up, but non-operational and missing some
-                        # required networks. _check_network_configuration
+                        # required networks. _retry_non_operational
                         # already gave enough info, rest of code can assume
                         # it's up.
                         isUp = True
@@ -259,7 +259,7 @@
             ))
         return isUp
 
-    def _check_network_configuration(self, engine_api, host):
+    def _retry_non_operational(self, engine_api, host):
         """Return True if we should continue trying to add the host"""
         ret = True
         try:
@@ -336,6 +336,48 @@
                             '  # service ovirt-ha-broker restart\n'
                         )
                     )
+            else:
+                # No missing required networks, perhaps some other issue?
+                self.dialog.note(
+                    _(
+                        'The host {host} is in non-operational state.\n'
+                        'Please try to activate it via the engine '
+                        'webadmin UI.\n'
+                    ).format(
+                        host=host,
+                    )
+                )
+                ret  = (
+                    False if not self.environment[
+                        ohostedcons.EngineEnv.PROMPT_NON_OPERATIONAL
+                    ] else
+                    self.dialog.queryString(
+                        name='OVEHOSTED_NON_OPERATIONAL',
+                        note=_(
+                            'Retry checking host status or ignore this '
+                            'and continue '
+                            "(@VALUES@)[@DEFAULT@]? "
+                        ),
+                        prompt=True,
+                        validValues=(_('Retry'), _('Ignore')),
+                        caseSensitive=False,
+                        default=_('Retry'),
+                    ) == _('Retry').lower()
+                )
+                if not ret:
+                    self.logger.warning(
+                        _('Host left in non-operational state')
+                    )
+                    self.dialog.note(
+                        _(
+                            'To finish deploying, please:\n'
+                            '- activate it\n'
+                            '- restart the hosted-engine high availability '
+                            'services by running on this machine:\n'
+                            '  # service ovirt-ha-agent restart\n'
+                            '  # service ovirt-ha-broker restart\n'
+                        )
+                    )
 
         except Exception as exc:
             # Sadly all ovirtsdk errors inherit only from Exception
@@ -404,6 +446,10 @@
             ohostedcons.NetworkEnv.PROMPT_REQUIRED_NETWORKS,
             True
         )
+        self.environment.setdefault(
+            ohostedcons.EngineEnv.PROMPT_NON_OPERATIONAL,
+            True
+        )
         self._selinux_enabled = False
 
     @plugin.event(


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I481cb082adef25238bc06280e8d274b6d4cd8c9e
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