Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1121961

Summary: engine-backup: FATAL: Errors while restoring database with different db user
Product: Red Hat Enterprise Virtualization Manager Reporter: Tareq Alayan <talayan>
Component: ovirt-engineAssignee: Yedidyah Bar David <didi>
Status: CLOSED CURRENTRELEASE QA Contact: Jiri Belka <jbelka>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.5.0CC: bazulay, dfediuck, didi, gklein, lsurette, rbalakri, Rhev-m-bugs, yeylon, ykaul
Target Milestone: ovirt-3.6.0-rc   
Target Release: 3.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: engine-backup uses pg_dump (without the '--no-owner' option) for backup, and psql to restore. Some errors from psql are filtered. Non-filtered errors cause engine-backup to abort. Consequence: Using options to change db credentials to use another user on restore, cause psql to fail, while trying to run the commands to grant permissions to the previous owner. Fix: The list of filtered errors was extended to include errors about the previous user not existing. Result: engine-backup --mode=restore, with options to change database credentials, including a different database user, does not fail, even if restoring to a database in which the previous user does not exist.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-11 07:32:32 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:
Attachments:
Description Flags
logs none

Description Tareq Alayan 2014-07-22 08:56:42 UTC
Description of problem:
restoring environment with different user will fail

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


How reproducible:
rhevm-3.4.1-0.30.el6ev.noarch


Steps to Reproduce:
I did the following and it didnot work can u please take a look, i may have done something wrong wrong, it still not fixed:

(1) 
engine-backup --mode=backup --scope=all --file=testjuly21.bkp --log=/var/log/testjul21.log

(2) 
stop postgres service 
rm -rf /var/lib/pgsql/data
su postgres -c 'initdb /var/lib/pgsql/data'
start postgres service

(3)
postgres=# create user engine password 'redhat';
CREATE ROLE
postgres=# create user engine_history password 'redhat';
CREATE ROLE
postgres=# create user ovirt_engine_reports password 'redhat';      
CREATE ROLE
postgres=# create user sdam password 'redhat';
CREATE ROLE
postgres=# create database engine owner engine template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
CREATE DATABASE
postgres=# create database ovirt_engine_history owner engine_history template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
CREATE DATABASE
postgres=# create database ovirt_engine_reports owner ovirt_engine_reports template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
CREATE DATABASE

(3)
engine-backup --mode=restore --scope=all --file=testjuly21.bkp --log=/root/rst.log --change-db-credentials --db-host=localhost --db-user=engine --db-name=engine --db-password=redhat --change-dwh-db-credentials --dwh-db-host=localhost --dwh-db-user=engine_history --dwh-db-name=ovirt_engine_history --dwh-db-password=redhat --change-reports-db-credentials --reports-db-host=localhost --reports-db-user=ovirt_engine_reports --reports-db-name=ovirt_engine_reports --reports-db-password=redhat
Preparing to restore:
- Setting credentials for Engine database 'engine'
- Setting credentials for DWH database 'ovirt_engine_history'
- Setting credentials for Reports database 'ovirt_engine_reports'
- Unpacking file 'testjuly21.bkp'
Restoring:
- Files
- Engine database 'engine'
- DWH database 'ovirt_engine_history'
FATAL: Errors while restoring database ovirt_engine_history

Additional info:
logs attaced

Comment 1 Tareq Alayan 2014-07-22 08:59:15 UTC
Created attachment 919842 [details]
logs

rst.log = restore log 
testjuly21.bkp = backup all 
testjul21.log = backup log

Comment 3 Sandro Bonazzola 2015-02-20 11:07:53 UTC
Automated message: can you please update doctext or set it as not required?

Comment 5 Jiri Belka 2016-01-11 16:43:22 UTC
ok, rhevm-tools-3.6.2-0.1.el6.noarch

restore ok with my own user-defined