Simone Tiraboschi has uploaded a new change for review.

Change subject: packaging: setup: enforcing required networks configuration 
additional hosts
......................................................................

packaging: setup: enforcing required networks configuration additional hosts

On additional hosts, waiting for the user to configure
the additional required networks before checking
host status.

Change-Id: I259b78e6a5c3009c29a7e3c8573500f12247acbc
Bug-Url: https://bugzilla.redhat.com/1086032
Signed-off-by: Simone Tiraboschi <stira...@redhat.com>
---
M src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
1 file changed, 61 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/89/34789/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..88a4e11 100644
--- a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
+++ b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
@@ -205,6 +205,67 @@
             'Waiting for the host to become operational in the engine. '
             'This may take several minutes...'
         ))
+        try:
+            cluster = engine_api.clusters.get(
+                self.environment[
+                    ohostedcons.EngineEnv.HOST_CLUSTER_NAME
+                ]
+            )
+            h = engine_api.hosts.get(host)
+
+            poll = True
+            while poll:
+                required_networks = set(
+                    [
+                        rn.get_id()
+                        for rn in cluster.networks.list(required=True)
+                    ]
+                )
+                configured_networks = set(
+                    [
+                        nic.get_network().get_id()
+                        for nic in h.nics.list()
+                        if nic.get_network()
+                    ]
+                )
+                if required_networks <= configured_networks:
+                    poll = False
+                if poll:
+                    tbc = required_networks - configured_networks
+                    rnet = [
+                        engine_api.networks.get(id=rn).get_name() for rn in tbc
+                    ]
+                    proceed = self.dialog.queryString(
+                        name='OVEHOSTED_ENGINE_NET_UP',
+                        note=_(
+                            'The following required networks\n'
+                            '    {rnet}\n'
+                            'still need to be configured on {host} '
+                            'in order to make it operational.\n'
+                            'Please setup them via the engine '
+                            'webadmin UI\n'
+                            'or flag them as not required '
+                            'before continuing.'
+                            'Please proceed when done '
+                            '(@VALUES@)[@DEFAULT@]: '
+                        ).format(
+                            rnet=rnet,
+                            host=host,
+                        ),
+                        prompt=True,
+                        validValues=(_('Done'), _('Abort')),
+                        caseSensitive=False,
+                        default=_('Done')
+                    ) == _('Done').lower()
+                    if not proceed:
+                        raise RuntimeError('Aborted by user')
+        except Exception as exc:
+            self.logger.debug(
+                'Error fetching the network configuration: {error}'.format(
+                    error=str(exc),
+                )
+            )
+
         tries = self.VDSM_RETRIES
         isUp = False
         while not isUp and tries > 0:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I259b78e6a5c3009c29a7e3c8573500f12247acbc
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Simone Tiraboschi <stira...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to