Bug 1109929

Summary: Failure to add initial host to Default cluster prevents the 'engine_api' variable from being set properly
Product: Red Hat Enterprise Virtualization Manager Reporter: wdaniel
Component: ovirt-hosted-engine-setupAssignee: Simone Tiraboschi <stirabos>
Status: CLOSED ERRATA QA Contact: sefi litmanovich <slitmano>
Severity: high Docs Contact:
Priority: medium    
Version: 3.3.0CC: aburden, benglish, dfediuck, didi, iheim, lveyde, oblaut, sbonazzo, sherold, stirabos
Target Milestone: ---   
Target Release: 3.5.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: integration
Fixed In Version: ovirt-3.5.0-beta1.1 Doc Type: Bug Fix
Doc Text:
Previously, if the host could not be added to the Default cluster during hosted engine deployment, the deployment would fail with an ambiguous error. Now, the issue is properly detected and a specific error is raised to make the user aware of the problem.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-11 20:40:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1142923, 1156165    

Description wdaniel 2014-06-16 15:55:48 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 wdaniel 2014-06-16 16:04:57 UTC
Description of problem:

It appears that if the initial HA host can not be added to the Default cluster, the 'engine_api' variable is never set, thus causing Tracebacks in the next few steps:

(from add_host.py)
    def _closeup(self):
        self._getPKICert()
        self._getSSHkey()
        try:
            self.logger.debug('Connecting to the Engine')
            engine_api = self._ovirtsdk_api.API(                         <==== 'engine_api' gets assigned if the try statement works
                url='https://{fqdn}/api'.format(
                    fqdn=self.environment[
                        ohostedcons.NetworkEnv.OVIRT_HOSTED_ENGINE_FQDN
                    ],
                ),
                username='admin@internal',
                password=self.environment[
                    ohostedcons.EngineEnv.ADMIN_PASSWORD
                ],
                ca_file=self.cert,
            )

<snip>

        except ovirtsdk.infrastructure.errors.RequestError as e:
            self.logger.debug(
                'Cannot add the host to the Default cluster',
                exc_info=True,
            )
            self.logger.error(
                _(
                    'Cannot automatically add the host '
                    'to the Default cluster:\n{details}\n'
                ).format(
                    details=e.detail
                )
            )
        up = self._wait_host_ready(                                <======= 'engine_api' is called here as a parameter, but it's not set in the 'except' clause so it doesn't exist
            engine_api,
            self.environment[ohostedcons.EngineEnv.APP_HOST_NAME]
        )

I couldn't find any other code that would assign this variable in the python file .

How reproducible:

Have not been able to yet, working on trying t ofind a way to fail at the appropriate time.

Actual results:

The hosted-engine script fails out with Traceback errors, halting deployment of the VM

Expected results:

Hosted-engine script could warn of the particular issue - in this case it appears as if the rhevm bridge had been created but didn't have an IP address. Script should make sure the engine_api variable is properly set and handled either outside this try/except clause, or in the except statement in addition to the try statement.

Comment 7 Simone Tiraboschi 2014-07-08 13:37:03 UTC
Please check if is somehow related to this one:
https://bugzilla.redhat.com/show_bug.cgi?id=1116009

Comment 8 sefi litmanovich 2015-01-15 14:02:13 UTC
Verified with ovirt-hosted-engine-setup-1.2.1-8.el7ev.noarch, installing rhevm-3.5.0-0.28.el6ev.noarch as engine.

To invoke the error at the 'Enter the name of the cluster to which you want to add the host (Default) [Default]:' stage I commented out the ip and hostname of the vm from the host's /etc/hosts and also blocked connection between the two with iptables before hitting return.

the error I got:
[ ERROR ] Failed to execute stage 'Closing up': [ERROR]::RHEV API connection failure, [Errno -2] Name or service not known

as expected.

Comment 10 errata-xmlrpc 2015-02-11 20:40:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0161.html