Bug 1229398 - [engine-backup] reports fails after restore with --change-dwh-db-credentials
Summary: [engine-backup] reports fails after restore with --change-dwh-db-credentials
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-reports
Version: 3.4.5
Hardware: All
OS: Linux
medium
medium
Target Milestone: ovirt-3.6.0-rc
: 3.6.0
Assignee: Yedidyah Bar David
QA Contact: Lukas Svaty
URL:
Whiteboard:
Depends On: 1254639
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-08 15:26 UTC by Ulhas Surse
Modified: 2019-07-16 12:00 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Previously, the reports plugin for engine-setup did not recreate the data warehouse data source on upgrade, but instead kept the existing data sources. There was an option in engine-backup to restore data warehouse with changed database credentials, but this relied on engine-setup to configure reports to be able to access the data warehouse database. This meant that after restoring a system with a data warehouse and reports, where the data warehouse was restored to a different database, reports could not access the data warehouse database. Now, the reports engine-setup plugin has been changed to always create the data warehouse data source, so that reports can access the data warehouse database.
Clone Of:
Environment:
Last Closed: 2016-03-09 21:19:47 UTC
oVirt Team: Integration
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1212752 0 medium CLOSED [engine-backup] restore fails if using change-{,dwh}-db-credentials and previous user exists 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1217402 0 high CLOSED [engine-backup] unable to restore if backup contains read only user for DWH DB access 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHEA-2016:0425 0 normal SHIPPED_LIVE rhevm-reports bug fix and enhancement update 2016-03-10 01:21:14 UTC
oVirt gerrit 43810 0 master MERGED packaging: setup: Recreate dwh data source on upgrade Never

Internal Links: 1212752 1217402

Description Ulhas Surse 2015-06-08 15:26:24 UTC
Description of problem:
 restore of reports fails if using change-{,dwh}-db-credentials and --change-reports-db-credentials options.

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

How reproducible:
always

Steps to Reproduce:
1. Create backup.
2. Creating db and user roles and set new passwd. Decide to handle the new password when recovering using 'engine-backup
3. restore with: 
# engine-backup --mode=restore --scope=all --file=/tmp/rhevm-backup/backup.20150513100001.tar.bz2 --log=/tmp/restore.log --change-db-credentials --db-host=localhost --db-user=engine --db-password=recvrTesTEngine --db-name=engine --change-dwh-db-credentials --dwh-db-host=localhost --dwh-db-user=ovirt_engine_history --dwh-db-password=recvrTesTdwh --dwh-db-name=ovirt_engine_history --change-reports-db-credentials --reports-db-host=localhost --reports-db-user=ovirt_engine_reports --reports-db-password=recvrTesTreports --reports-db-name=ovirt_engine_reports

This will not set password for reports. 


Actual results:
Unexpected error

com.jaspersoft.jasperserver.api.JSExeption:jesxecption.error.creating.connection

Expected results:
The restore should work.

Additional info:

The same ovirt bugzilla exists: 

  [engine-backup] restore fails if using change-{,dwh}-db-credentials and previous user exists
https://bugzilla.redhat.com/show_bug.cgi?id=1212752

Comment 1 Yedidyah Bar David 2015-07-13 13:28:43 UTC
Now reproduced under 3.4.5.

This bug is unrelated to others linked above.

It's caused by [1] - on upgrade, we export the existing dwh datasource, then deploy new jasper, then import the datasource.

This means that changing dwh creds will not affect those saved there.

Yaniv - any reason to save/restore them and not just recreate? Do we (want to) support adding new datasources, or editing them?

If we do, we'll have to somehow edit it to get the new credentials.

[1] https://gerrit.ovirt.org/gitweb?p=ovirt-reports.git;a=blob;f=packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py;h=d2299fcce0e72ee8b2fa2363e4dd83935e17a69a;hb=HEAD#l327

Also tried to find a workaround by editing the table jijdbcdatasource directly, but it's "encrypted" (one might say obfuscated) there and I can't easily find out how. A possible workaround is to export the datasources, editing, then importing back. We can even add this to the reports-tool... Yaniv - please help with this too if you think it's important (or you can easily point to a solution).

Comment 2 Yedidyah Bar David 2015-07-13 13:29:59 UTC
BTW, depending on the accepted solution, we might change the component - if recreating dwh datasource, the fix will be in reports (and not in engine-backup).

Comment 3 Yaniv Lavi 2015-07-21 22:24:46 UTC
(In reply to Yedidyah Bar David from comment #1)
> Now reproduced under 3.4.5.
> 
> This bug is unrelated to others linked above.
> 
> It's caused by [1] - on upgrade, we export the existing dwh datasource, then
> deploy new jasper, then import the datasource.
> 
> This means that changing dwh creds will not affect those saved there.
> 
> Yaniv - any reason to save/restore them and not just recreate? Do we (want
> to) support adding new datasources, or editing them?

We will not support new user datasources. I would only object to save/restore them due to stability concerns that flow we do not think of will break.

> 
> If we do, we'll have to somehow edit it to get the new credentials.
> 
> [1]
> https://gerrit.ovirt.org/gitweb?p=ovirt-reports.git;a=blob;f=packaging/setup/
> plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py;
> h=d2299fcce0e72ee8b2fa2363e4dd83935e17a69a;hb=HEAD#l327
> 
> Also tried to find a workaround by editing the table jijdbcdatasource
> directly, but it's "encrypted" (one might say obfuscated) there and I can't
> easily find out how. A possible workaround is to export the datasources,
> editing, then importing back. We can even add this to the reports-tool...
> Yaniv - please help with this too if you think it's important (or you can
> easily point to a solution).

We should not touch the Jasper tables.
We can create a simple kbase on how to change the dwh cred after restore, I do not consider this a major issue. This can be admin user edited via the UI.

Comment 4 Yedidyah Bar David 2015-07-26 09:38:09 UTC
(In reply to Yaniv Dary from comment #3)
> We will not support new user datasources. I would only object to
> save/restore them due to stability concerns that flow we do not think of
> will break.

Not sure I follow. You object to save/restore? Or to always rewrite?

Already explained what flow will break: If a user somehow manually edits the datasource.

In previous versions (e.g. 3.2->3.3 upgrade) we didn't keep it but rewritten. So the principle flow was already used (in a different code base).

Moving to post for now. The linked patch rewrites the datasource on upgrades.

Comment 5 Yaniv Lavi 2015-08-02 11:38:36 UTC
Since there a workaround and customer case is closed, only fixing for 3.6.

Comment 6 Lukas Svaty 2015-08-20 10:09:42 UTC
Can you confirm these verification steps? Tried also changing users credentials with no difference of restore, however I believe step 2 is not essential.

verification steps:
1. Create backup:
# engine-backup --mode=backup --file=/rootbackup.tar.bz2 --log=/tmp/backup.log

2. Resore:
# engine-backup --mode=restore --file=/root/backup.tar.bz2 --scope=all --log=/tmp/rhevm_restore.log --db-host=localhost --db-user=newengine --db-password=newpass --db-name=newengine --dwh-db-host=localhost --dwh-db-name=newdwh --dwh-db-user=newdwh --dwh-db-password=newpass --change-db-credentials --change-dwh-db-credentials

Result log:
2015-08-20 11:43:13 12488: Start of engine-backup mode restore scope all file /root/backup.tgx
2015-08-20 11:43:13 12488: OUTPUT: Preparing to restore:
2015-08-20 11:43:13 12488: OUTPUT: - Setting credentials for Engine database 'newengine'
2015-08-20 11:43:13 12488: pg_cmd running: psql -w -U newengine -h 127.0.0.1 -p 5432  newengine -c select 1
psql: FATAL:  Ident authentication failed for user "newengine"
2015-08-20 11:43:13 12488: FATAL: Can't connect to database 'newengine'. Please see '/usr/bin/engine-backup --help'.

Comment 7 Lukas Svaty 2015-09-02 08:58:48 UTC
After discussion on this bug with assignee moving back to ON_QA will be verified after blocker is solved.

Comment 8 Yedidyah Bar David 2015-09-02 09:37:49 UTC
The fix was in reports, changing component.

Comment 10 Yedidyah Bar David 2015-09-06 14:07:26 UTC
(In reply to Yaniv Dary from comment #5)
> Since there a workaround and customer case is closed, only fixing for 3.6.

What's the workaround?

I didn't suggest one. I just said I looked for one and failed to find...

I understood from you that it's possible to manually edit the data source from the web interface. If indeed, please verify and document. Thanks!

Comment 11 Yaniv Lavi 2015-10-14 12:34:42 UTC
(In reply to Yedidyah Bar David from comment #10)
> (In reply to Yaniv Dary from comment #5)
> > Since there a workaround and customer case is closed, only fixing for 3.6.
> 
> What's the workaround?
> 
> I didn't suggest one. I just said I looked for one and failed to find...
> 
> I understood from you that it's possible to manually edit the data source
> from the web interface. If indeed, please verify and document. Thanks!

Using admin user. Go to 'view' and press on 'repository'.
Drill to folder 'RHEVM Reports'->'Resources'->'JDBC'->'Data Sources'->'oVirt History'. 
Edit the resource and setup the db location.
Press save.

Comment 12 Yedidyah Bar David 2016-03-06 06:56:26 UTC
"has be" -> "was" plus a few commas :-)

Comment 13 Megan Lewis 2016-03-07 04:53:19 UTC
Thanks for the feedback. :)

Comment 15 errata-xmlrpc 2016-03-09 21:19:47 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/RHEA-2016-0425.html


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