Bug 1314847

Summary: Restore fails with ovirt-engine-dwh conf, though that was not on backup
Product: [oVirt] ovirt-engine Reporter: Scott Nolin <scott.nolin>
Component: Backup-Restore.EngineAssignee: Yedidyah Bar David <didi>
Status: CLOSED CURRENTRELEASE QA Contact: Gonza <grafuls>
Severity: medium Docs Contact:
Priority: high    
Version: 3.6.3.3CC: bugs, dfediuck, mgoldboi, sbonazzo, scott.nolin, ylavi
Target Milestone: ovirt-3.6.5Flags: rule-engine: ovirt-3.6.z+
ylavi: planning_ack+
sbonazzo: devel_ack+
pnovotny: testing_ack+
Target Release: 3.6.5   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-21 14:39:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Scott Nolin 2016-03-04 16:36:09 UTC
Description of problem:

When recovering a backup to a new machine the restore fails with

FATAL: Can not find /etc/ovirt-engine-dwh/ovirt-engine-dwhd.conf.d/10-setup-database.conf

However, the datawarehouse is not installed on the backed up host.

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

3.6.3.4-1

How reproducible:

Easily for my example systems, haven't tested other systems.

Steps to Reproduce:
1. Do the engine backup on machine A
2. Set up the empty database and do a recover with change-db-credentials on machine B

Actual results:

FATAL: Can not find /etc/ovirt-engine-dwh/ovirt-engine-dwhd.conf.d/10-setup-database.conf


Expected results:

Normal output of "you should now run engine-setup. Done"

Additional info:

Searched for some kind of flag to disable that particular database on the restore, but found nothing.

I managed to work around this by hacking the DWH- stuff out of engine-backup.sh - and everything restored just fine.

Comment 1 Scott Nolin 2016-03-04 16:38:01 UTC
Original system (backed up) was ovirt-3.5, upgraded to ovirt-3.6 and in production for a while before the backup. Restore system was simply installed with 3.6.

Comment 2 Doron Fediuck 2016-03-08 07:21:32 UTC
(In reply to Scott Nolin from comment #1)
> Original system (backed up) was ovirt-3.5, upgraded to ovirt-3.6 and in
> production for a while before the backup. Restore system was simply
> installed with 3.6.

Was the backup performed on the upgraded 3.6 engine of did you restore a 3.5
backup into the upgraded 3.6 engine?

Comment 3 Scott Nolin 2016-03-08 14:33:49 UTC
(In reply to Doron Fediuck from comment #2)
> (In reply to Scott Nolin from comment #1)
> > Original system (backed up) was ovirt-3.5, upgraded to ovirt-3.6 and in
> > production for a while before the backup. Restore system was simply
> > installed with 3.6.
> 
> Was the backup performed on the upgraded 3.6 engine of did you restore a 3.5
> backup into the upgraded 3.6 engine?

Backup was performed on the upgraded 3.6 engine, so restoring 3.6 to 3.6

I did a few additional backup just to be certain after finding the problem.

Scott

Comment 4 Yedidyah Bar David 2016-03-09 14:13:37 UTC
To reproduce/verify:

1. Install/Setup engine only (no dwh or reports)
2. backup and copy the backup somewhere
3. engine-cleanup, or create a new machine (or restore from snapshot)
4. restore with '--change-db-credentials' (and all required credentials)

On broken version will fail as in comment 0. On fixed version will succeed.

Note that it will not fail if you do not pass '--change-db-credentials', which usually should work immediately after 'engine-cleanup' (because the user/password are left as they were with it).

Workaround - simply create an empty file there:

1. mkdir -p /etc/ovirt-engine-dwh/ovirt-engine-dwhd.conf.d
2. touch /etc/ovirt-engine-dwh/ovirt-engine-dwhd.conf.d/10-setup-database.conf
3. chown ovirt:ovirt /etc/ovirt-engine-dwh/ovirt-engine-dwhd.conf.d/10-setup-database.conf
4. chmod 600 /etc/ovirt-engine-dwh/ovirt-engine-dwhd.conf.d/10-setup-database.conf
5. Run restore. If you already did, it will tell you that 'engine db is not empty'. Run engine-cleanup, then try again.

Comment 5 Gonza 2016-04-06 10:07:52 UTC
Verified with:
rhevm-3.6.5-0.1.el6.noarch
rhevm-tools-backup-3.6.5-0.1.el6.noarch

# engine-backup --mode=restore --file=engine.bkp --log=restore.log --change-db-credentials --db-host=`hostname` --db-user=engine --db-password --db-name=engine --no-restore-permissions
Enter Engine database password: 
Preparing to restore:
- Setting credentials for Engine database 'engine'
- Unpacking file 'engine.bkp'
Restoring:
- Files
- Engine database 'engine'
  - Cleaning up temporary tables in engine database 'engine'
Rewriting /etc/ovirt-engine/engine.conf.d/10-setup-database.conf
You should now run engine-setup.
Done.