Bug 1359844

Summary: [downsream clone - 3.6.9] engine-setup should warn users running within hosted engine to set to maintenance
Product: Red Hat Enterprise Virtualization Manager Reporter: rhev-integ
Component: ovirt-engineAssignee: Lev Veyde <lveyde>
Status: CLOSED ERRATA QA Contact: Jiri Belka <jbelka>
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: bugs, dfediuck, didi, gklein, lsurette, lveyde, mavital, melewis, mkalinin, rbalakri, Rhev-m-bugs, rmartins, sbonazzo, srevivo, stirabos, ykaul, ylavi
Target Milestone: ovirt-3.6.9Keywords: EasyFix, ZStream
Target Release: 3.6.9   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
With this update, users are now warned to set the system in global maintenance mode before running the engine-setup command. This is because data corruption may occur if the engine-setup command is run without setting the system into global maintenance mode. This update means that the user is warned and the setup will be aborted if the system is not in global maintenance mode and the engine is running in the hosted engine configuration.
Story Points: ---
Clone Of: 1290073 Environment:
Last Closed: 2016-09-21 18:05:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1290073    
Bug Blocks: 1375161    

Comment 2 Jiri Belka 2016-09-12 11:12:26 UTC
ok, rhevm-3.6.9-2

~~~
...
[ INFO  ] Stage: Setup validation
          During execution engine service will be stopped (OK, Cancel) [OK]: 
[ ERROR ] It seems that you are running your engine inside of the hosted-engine VM and are not in "Global M
aintenance" mode. In that case you should put the system into the "Global Maintenance" mode before running 
engine-setup, or the hosted-engine HA agent might kill the machine, which might corrupt your data. 
[ ERROR ] Failed to execute stage 'Setup validation': Hosted Engine setup detected, but Global Maintenance 
is not set.
[ INFO  ] Stage: Clean up
          Log file is located at /var/log/ovirt-engine/setup/ovirt-engine-setup-20160912125329-zljjsj.log
[ INFO  ] Generating answer file '/var/lib/ovirt-engine/setup/answers/20160912130140-setup.conf'
[ INFO  ] Stage: Pre-termination
[ INFO  ] Stage: Termination
[ ERROR ] Execution of setup failed
~~~

with global maintenance enabled no such error is visible.

Comment 3 Jiri Belka 2016-09-13 07:04:29 UTC
Ooops, this causes broken upgrade of SHE (engine) from 3.5 to 3.6:

~~~
2016-09-13 08:56:16 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: '
                select version, option_value
                from vdc_options
                where option_name = %(name)s
            ', args: {'name': 'HostedEngineVmName'}
2016-09-13 08:56:16 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:176 Creating own connection
2016-09-13 08:56:16 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: []
2016-09-13 08:56:16 DEBUG otopi.context context._executeMethod:156 method exception
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/otopi/context.py", line 146, in _executeMethod
    method['method']()
  File "/usr/share/ovirt-engine/setup/bin/../plugins/ovirt-engine-common/ovirt-engine-common/system/he.py", line 71, in _validate
    ownConnection=True,
  File "/usr/share/ovirt-engine/setup/ovirt_engine_setup/engine/vdcoption.py", line 86, in getVdcOption
    ownConnection=ownConnection,
  File "/usr/share/ovirt-engine/setup/ovirt_engine_setup/engine/vdcoption.py", line 61, in getVdcOptionVersions
    name=name,
RuntimeError: Cannot locate application option HostedEngineVmName
2016-09-13 08:56:16 ERROR otopi.context context._executeMethod:165 Failed to execute stage 'Setup validation': Cannot locate application option HostedEngineVmName
~~~

3.5 engine obviously doesn't know this:

~~~
engine=# select version, option_name,option_value from vdc_options where option_name = 'HostedEngineVmName
';
 version | option_name | option_value 
---------+-------------+--------------
(0 rows)
~~~

Comment 5 Jiri Belka 2016-09-13 07:07:21 UTC
(In reply to Jiri Belka from comment #3)
> Ooops, this causes broken upgrade of SHE (engine) from 3.5 to 3.6:
> 
> ~~~
> 2016-09-13 08:56:16 DEBUG otopi.ovirt_engine_setup.engine_common.database
> database.execute:171 Database: 'None', Statement: '
>                 select version, option_value
>                 from vdc_options
>                 where option_name = %(name)s
>             ', args: {'name': 'HostedEngineVmName'}
> 2016-09-13 08:56:16 DEBUG otopi.ovirt_engine_setup.engine_common.database
> database.execute:176 Creating own connection
> 2016-09-13 08:56:16 DEBUG otopi.ovirt_engine_setup.engine_common.database
> database.execute:221 Result: []
> 2016-09-13 08:56:16 DEBUG otopi.context context._executeMethod:156 method
> exception
> Traceback (most recent call last):
>   File "/usr/lib/python2.6/site-packages/otopi/context.py", line 146, in
> _executeMethod
>     method['method']()
>   File
> "/usr/share/ovirt-engine/setup/bin/../plugins/ovirt-engine-common/ovirt-
> engine-common/system/he.py", line 71, in _validate
>     ownConnection=True,
>   File
> "/usr/share/ovirt-engine/setup/ovirt_engine_setup/engine/vdcoption.py", line
> 86, in getVdcOption
>     ownConnection=ownConnection,
>   File
> "/usr/share/ovirt-engine/setup/ovirt_engine_setup/engine/vdcoption.py", line
> 61, in getVdcOptionVersions
>     name=name,
> RuntimeError: Cannot locate application option HostedEngineVmName
> 2016-09-13 08:56:16 ERROR otopi.context context._executeMethod:165 Failed to
> execute stage 'Setup validation': Cannot locate application option
> HostedEngineVmName
> ~~~
> 
> 3.5 engine obviously doesn't know this:
> 
> ~~~
> engine=# select version, option_name,option_value from vdc_options where
> option_name = 'HostedEngineVmName
> ';
>  version | option_name | option_value 
> ---------+-------------+--------------
> (0 rows)
> ~~~

Steps:

1. have 3.5 SHE env
2. global maintenance
3. update rpms inside engine VM
4. engine-setup

Comment 6 Jiri Belka 2016-09-13 07:21:17 UTC
Workaround:

curl -o /tmp/patch 'https://gerrit.ovirt.org/gitweb?p=ovirt-engine.git;a=patch;h=23e9a25de622eb374efa8ffcf8c0bb613082cfc5'
cd /usr/share/ovirt-engine
patch -p2 -R < /tmp/patch

Comment 7 Jiri Belka 2016-09-16 11:24:53 UTC
ok, rhevm-setup-plugin-ovirt-engine-3.6.9.2-0.1.el6.noarch

Comment 9 errata-xmlrpc 2016-09-21 18:05:14 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/RHSA-2016-1929.html