Bug 987939 - engine-setup after partial engine-cleanup fails
engine-setup after partial engine-cleanup fails
Status: CLOSED CURRENTRELEASE
Product: oVirt
Classification: Community
Component: ovirt-engine-installer (Show other bugs)
3.3
Unspecified Unspecified
unspecified Severity unspecified
: ---
: 3.3.1
Assigned To: Yedidyah Bar David
sefi litmanovich
integration
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-24 08:44 EDT by Tomas Jelinek
Modified: 2013-11-25 06:50 EST (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-25 06:50:26 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
logs (167.37 KB, text/x-log)
2013-07-24 08:44 EDT, Tomas Jelinek
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 19689 None None None Never
oVirt gerrit 20203 None None None Never

  None (edit)
Description Tomas Jelinek 2013-07-24 08:44:46 EDT
Created attachment 777762 [details]
logs

have a fedora 19 and ovirt-engine 3.3 beta1
reproduce:
1: run engine-setup
2: run engine-cleanup
   (approve cleanup of the database)
3: run engine-setup

The setup will fail with: "TypeError: argument of type 'NoneType' is not iterable"

logs attached.
Comment 1 Alon Bar-Lev 2013-07-24 08:50:11 EDT
Have you approved only database or all?

2013-07-24 07:50:49 DEBUG otopi.plugins.ovirt_engine_setup.legacy.config config._customization:72 Upgrading from 3.3.z legacy
2013-07-24 07:50:49 DEBUG otopi.context context._executeMethod:132 method exception
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/otopi/context.py", line 122, in _executeMethod
    method['method']()
  File "/usr/share/ovirt-engine/setup/bin/../plugins/ovirt-engine-setup/legacy/config.py", line 95, in _customization
    'ssl=true' in config.get('ENGINE_DB_URL')
TypeError: argument of type 'NoneType' is not iterable
2013-07-24 07:50:49 ERROR otopi.context context._executeMethod:141 Failed to execute stage 'Environment customization': argument of type 'NoneType' is not iterable
Comment 2 Tomas Jelinek 2013-07-24 08:57:41 EDT
Tried twice. First time I have let it to delete the DB but did not let it to delete the certificates and the keys, second time (on a different machine) I let it delete the DB and the certificates but not the keys. Same result.
Comment 3 Alon Bar-Lev 2013-07-24 09:17:21 EDT
Sandro,

The legacy config should deal with that state... or we should fail setup if environment is insane...

the question is why the setup thought it is legacy, this I will investigate.

Alon
Comment 4 Alon Bar-Lev 2013-07-24 09:18:25 EDT
Tomas,
For now you can just remove the /etc/pki/ovirt-engine/ca.pem to be able to continue.
Comment 5 Sandro Bonazzola 2013-07-24 10:56:29 EDT
(In reply to Alon Bar-Lev from comment #3)
> Sandro,
> 
> The legacy config should deal with that state... or we should fail setup if
> environment is insane...
> 
> the question is why the setup thought it is legacy, this I will investigate.
> 
> Alon


I think that running engine-cleanup post-install files was cleaned up as always and pki files were not removed by user choice.
In this configuration running engine-setup from otopi will lead to finding the pki certs and not the post install file so it assumes it's upgrade from legacy.

This is a bit tricky because running otopi engine-cleanup we can have pki
files not cleaned (user choose to not remove them), database still there
(user choose to preserve it), and so on.
We can be sure we're upgrading from otopi if we find the post install
config file. But determining if we're upgrading from legacy is not trivial.
I don't think we can assume we're upgrading from legacy if pki is
configured and the database is in place right?

I think the only way for detecting upgrade from legacy is using these
conditions:
- post install config is not there
- database is in place
- pki is configured
- versionlock.list is configured (engine-cleanup always cleans versionlock.list)
Comment 6 Alon Bar-Lev 2013-07-24 11:08:44 EDT
I have no problem with any solution that works.

I also think that the clean should not delete core if one of the options were skipped... need to confirm.
Comment 7 Robert Story 2013-07-31 22:37:04 EDT
Still issues with ovirt-engine-setup-3.3.0-0.3.beta1.fc19.noarch

# engine-cleanup
[ INFO  ] Stage: Initializing
[ INFO  ] Stage: Environment setup
          Log file: /tmp/ovirt-engine-remove-20130731165838.log
          Version: otopi-1.1.0_master
          Configuration files: ['/etc/ovirt-engine-setup.conf.d/10-packaging-aio.conf', '/etc/ovirt-engine-setup.conf.d/10-packaging.conf']
[ INFO  ] Stage: Environment packages setup
[ INFO  ] Stage: Programs detection
[ INFO  ] Stage: Environment customization
          Do you want to remove Engine DB content? All data will be lost (Yes, No) [No]: Yes
[ INFO  ] Stage: Setup validation
          During execution engine service will be stopped (OK, Cancel) [OK]: 
          ovirt-engine is about to be removed, data will be lost (OK, Cancel) [Cancel]: OK
[ INFO  ] Stage: Transaction setup
[ INFO  ] Stopping engine service
[ INFO  ] Stage: Package installation
[ INFO  ] Stage: Misc configuration
[ INFO  ] Removing added lines
[ INFO  ] Removing files
[ INFO  ] Stage: Transaction commit
[ INFO  ] Stage: Closing up
         
          --== SUMMARY ==--
         
          Engine setup successfully cleaned up
         
          --== END OF SUMMARY ==--
         
[ INFO  ] Stage: Clean up
          Log file is located at /tmp/ovirt-engine-remove-20130731165838.log
[ INFO  ] Stage: Pre-termination
[ INFO  ] Stage: Termination


# engine-setup 
[ INFO  ] Stage: Initializing
[ INFO  ] Stage: Environment setup
          Log file: /tmp/ovirt-engine-setup-20130731223213.log
          Version: otopi-1.1.0_master
          Configuration files: ['/etc/ovirt-engine-setup.conf.d/10-packaging-aio.conf', '/etc/ovirt-engine-setup.conf.d/10-packaging.conf']
[ INFO  ] Hardware supports virtualization
[ ERROR ] Failed to execute stage 'Environment setup': Unexpected empty database during upgrade
[ INFO  ] Stage: Clean up
          Log file is located at /tmp/ovirt-engine-setup-20130731223213.log
[ INFO  ] Stage: Pre-termination
[ INFO  ] Stage: Termination

relevant excerpt from the log:
2013-07-31 22:32:14 DEBUG otopi.context context._executeMethod:118 Stage setup METHOD otopi.plugins.ovirt_engine_setup.legacy.database.Plugin._setup
2013-07-31 22:32:14 DEBUG otopi.plugins.ovirt_engine_setup.legacy.database database._setup:55 Existing database pgpass found
2013-07-31 22:32:14 DEBUG otopi.ovirt_engine_setup.database database.execute:123 Database: 'engine', Statement: '
                    select 1
                ', args: {}
2013-07-31 22:32:14 DEBUG otopi.ovirt_engine_setup.database database.execute:128 Creating own connection
2013-07-31 22:32:14 DEBUG otopi.ovirt_engine_setup.database database.execute:181 Result: [{'?column?': 1}]
2013-07-31 22:32:14 DEBUG otopi.ovirt_engine_setup.database database.tryDatabaseConnect:289 Connection succeeded
2013-07-31 22:32:14 DEBUG otopi.ovirt_engine_setup.database database.execute:123 Database: 'engine', Statement: '
                select count(*) as count
                from information_schema.tables
                where table_name=%(table)s
            ', args: {'table': 'schema_version'}
2013-07-31 22:32:14 DEBUG otopi.ovirt_engine_setup.database database.execute:128 Creating own connection
2013-07-31 22:32:14 DEBUG otopi.ovirt_engine_setup.database database.execute:181 Result: [{'count': 0L}]
2013-07-31 22:32:14 DEBUG otopi.context context._executeMethod:132 method exception
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/otopi/context.py", line 122, in _executeMethod
    method['method']()
  File "/usr/share/ovirt-engine/setup/bin/../plugins/ovirt-engine-setup/legacy/database.py", line 84, in _setup
    'Unexpected empty database '
RuntimeError: Unexpected empty database during upgrade
Comment 8 Yedidyah Bar David 2013-08-07 06:33:12 EDT
(In reply to Sandro Bonazzola from comment #5)
> (In reply to Alon Bar-Lev from comment #3)
> > Sandro,
> > 
> > The legacy config should deal with that state... or we should fail setup if
> > environment is insane...
> > 
> > the question is why the setup thought it is legacy, this I will investigate.
> > 
> > Alon
> 
> 
> I think that running engine-cleanup post-install files was cleaned up as
> always and pki files were not removed by user choice.
> In this configuration running engine-setup from otopi will lead to finding
> the pki certs and not the post install file so it assumes it's upgrade from
> legacy.
> 
> This is a bit tricky because running otopi engine-cleanup we can have pki
> files not cleaned (user choose to not remove them), database still there
> (user choose to preserve it), and so on.
> We can be sure we're upgrading from otopi if we find the post install
> config file. But determining if we're upgrading from legacy is not trivial.
> I don't think we can assume we're upgrading from legacy if pki is
> configured and the database is in place right?
> 
> I think the only way for detecting upgrade from legacy is using these
> conditions:
> - post install config is not there
> - database is in place
> - pki is configured
> - versionlock.list is configured (engine-cleanup always cleans
> versionlock.list)

I think that if we manage to connect to a working database, we should check inside it to see the exact version we are using, then decide what we have and what we need to do. Otherwise, it's not an upgrade. We might use existing files if found (might need to ask the user if we should), but I would not call it an upgrade if we create a new database.
Comment 9 Ofer Schreiber 2013-08-27 10:07:36 EDT
removing from 3.3 blocker list, partial remove is not in the critical path.
Comment 10 Sandro Bonazzola 2013-10-21 09:58:15 EDT
Included in 3.3.1 beta
Comment 11 Sandro Bonazzola 2013-11-25 06:50:26 EST
oVirt 3.3.1 has been released

Note You need to log in before you can comment on or make changes to this bug.