Bug 1821018

Summary: [RFE] Use only "engine-backup --mode=restore" for restoration of every possible databases by default instead of "--provision-all-databases"
Product: [oVirt] ovirt-engine Reporter: Shir Fishbain <sfishbai>
Component: Backup-Restore.EngineAssignee: Yedidyah Bar David <didi>
Status: CLOSED CURRENTRELEASE QA Contact: Guilherme Santos <gdeolive>
Severity: low Docs Contact:
Priority: medium    
Version: 4.4.0CC: bugs, gdeolive, mperina
Target Milestone: ovirt-4.5.0-1Keywords: FutureFeature, VerifiedUpstream
Target Release: 4.5.0Flags: sbonazzo: ovirt-4.5?
pm-rhel: planning_ack?
pm-rhel: devel_ack+
gdeolive: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-4.5.0 Doc Type: Enhancement
Doc Text:
If this bug requires documentation, please select an appropriate Doc Type value.
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-30 08:29:19 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 Shir Fishbain 2020-04-05 12:36:36 UTC
Description of problem:
Using only "engine-backup --mode=restore" for restoring all possible databases from the backup archive by default.

Version-Release number of selected component (if applicable):
ovirt-engine-4.4.0-0.29.master.el8ev.noarch

Expected results:
Restore should be performed as in the example with "engine-backup --mode=restore" by default instead of using specific "--provision-all-databases"

For example:
storage-ge-09 ~]# engine-backup --mode=restore --file=/root/cinderlib_from_old_engine --log=/root/log_cinderlib_from_old_engine --provision-all-databases --restore-permissions
Start of engine-backup with mode 'restore'

Comment 1 Yedidyah Bar David 2020-09-03 07:28:27 UTC
Thanks for opening this RFE. I have been thinking about opening it myself for some time now, see also bug 1530031 comment 1 (and 3 and 6), but eventually didn't handle it then. Partially copying it here. Logic should be, more-or-less:

If not "--change-*db-credentials"
    and mode=restore
    and db host = 'localhost'
    and db port = 5432 (default)
    and not secured connection
    and not secured host validation
    and user=default ('engine' for engine, 'ovirt_engine_history' for dwh)
    and db=default
    and password is not empty
    and postgresql is stopped
    and perhaps pg's data directory is empty or does not exist
then:
    provision all databases

Comment 2 Yedidyah Bar David 2022-01-17 12:20:53 UTC
The condition for automatically provisioning databases is:
- No '--change*credentials' options passed
- All databases are on 'localhost'
- An attempt to connect to the databases fails

Some relevant flows:

I.
1. Install, setup and backup an engine.
2. Reinstall the machine, install but do not setup an engine
3. Restore with 'engine-backup --mode=restore'

II.
1. Install, setup and backup an engine.
2. engine-cleanup
3. Restore
This will not auto-provision, because it's still possible to
connect to the databases (cleanup does not drop them), and will
fail, saying you must pass one of --*restore-permissions.

II.
1. Install, setup and backup an engine.
2. engine-cleanup
3. systemctl stop postgresql.service
4. rm -rf /var/lib/pgsql/data/*
5. Restore
This should work.