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

Bug 1090817

Summary: [RHEVM-SETUP] 'table_count' type in ovirt engine history db is left owned by postgres, during upgrade
Product: Red Hat Enterprise Virtualization Manager Reporter: Barak Dagan <bdagan>
Component: ovirt-engine-setupAssignee: Yedidyah Bar David <didi>
Status: CLOSED NOTABUG QA Contact: Pavel Stehlik <pstehlik>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.4.0CC: acathrow, alonbl, bazulay, bdagan, didi, emesika, iheim, pstehlik, Rhev-m-bugs, yeylon, ylavi
Target Milestone: ---   
Target Release: 3.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: integration
Fixed In Version: Doc Type: Release Note
Doc Text:
We support custom objects as long as it is done with the user that owns the database which is 'engine' So either 1) do not add any objects to he engine db 2) if you must , add objects that are owned by 'engine' 3) If you still add objects with a different user, you can fix that by using the utility
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-24 13:25:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
setup log none

Description Barak Dagan 2014-04-24 08:42:07 UTC
Created attachment 889202 [details]
setup log

Description of problem:
setup was upgraded from 3.3.2 to av4.
Upgrading from av4 to av6.1 fails due to: 
"[ ERROR ] Failed to execute stage 'Setup validation': Cannot upgrade the DWH database schema due to wrong ownership of some database entities. Please execute: /usr/share/ovirt-engine/setup/dbutils/changedbowner.sh -s localhost -p 5432 -d ovirt_engine_history -f postgres -t engine_history Using the password of the "postgres" user."

from log:
2014-04-24 09:37:06 DEBUG otopi.ovirt_engine_setup.database database.execute:217 Result: [{'owner': 'postgres', 'object_name': 'table_count', 'object_type': 'TYPE', 'object_schema': 'public'}]
2014-04-24 09:37:06 ERROR otopi.context context._executeMethod:161 Failed to execute stage 'Setup validation': Cannot upgrade the DWH database schema due to wrong ownership of some database entities.


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

How reproducible:
often

Steps to Reproduce:
1. install is35.1 + dwh & reports
2. upgarde to av4
3. upgrade to av6.1

Actual results:
setup fails

Expected results:


Additional info:

Comment 2 Alon Bar-Lev 2014-04-24 09:06:10 UTC
So please execute the command suggested?

Please execute: /usr/share/ovirt-engine/setup/dbutils/changedbowner.sh -s localhost -p 5432 -d ovirt_engine_history -f postgres -t engine_history Using the password of the "postgres" user."

if it is 3.4 originated, something really bad was done before, as all access to database is using regular user.

if it is 3.3 originated database, it is expected that the changedbowner might be required.

Comment 3 Barak Dagan 2014-04-24 10:06:31 UTC
[root@vm-161-241 Scripts]# su - postgres -c "/usr/share/ovirt-engine/setup/dbutils/changedbowner.sh -s localhost -p 5432 -d ovirt_engine_history -f postgres -t engine_history"
Changing database ovirt_engine_history objects ownership
psql: FATAL:  Ident authentication failed for user "postgres"
pg_dump: [archiver (db)] connection to database "ovirt_engine_history" failed: FATAL:  Ident authentication failed for user "postgres"
Failed to change DB ovirt_engine_history objects ownership.

Comment 4 Yaniv Lavi 2014-04-24 10:21:52 UTC
(In reply to Barak Dagan from comment #3)
> [root@vm-161-241 Scripts]# su - postgres -c
> "/usr/share/ovirt-engine/setup/dbutils/changedbowner.sh -s localhost -p 5432
> -d ovirt_engine_history -f postgres -t engine_history"
> Changing database ovirt_engine_history objects ownership
> psql: FATAL:  Ident authentication failed for user "postgres"
> pg_dump: [archiver (db)] connection to database "ovirt_engine_history"
> failed: FATAL:  Ident authentication failed for user "postgres"
> Failed to change DB ovirt_engine_history objects ownership.

Then use postgres user and run this line again.

Comment 5 Barak Dagan 2014-04-24 10:26:04 UTC
This was done using postgres user, afaiu.

Comment 6 Alon Bar-Lev 2014-04-24 10:39:31 UTC
# PGPASSWORD="xxxx" /usr/share/ovirt-engine/setup/dbutils/changedbowner.sh -s localhost -p 5432 -d ovirt_engine_history -f postgres -t engine_history"

Comment 7 Barak Dagan 2014-04-24 11:46:11 UTC
After fixing the pg_hba file:
host    all             postgres        127.0.0.1/32      password

# PGPASSWORD="postgres" /usr/share/ovirt-engine/setup/dbutils/changedbowner.sh -s 127.0.0.1 -p 5432 -d ovirt_engine_history -f postgres -t engine_history

it worked:
ALTER TABLE
...
ALTER TABLE
Changing database ovirt_engine_history ownership
ALTER DATABASE
Changing database ovirt_engine_history ownership from postgres to engine_history completed successfully.

Comment 8 Yedidyah Bar David 2014-04-24 12:36:02 UTC
(In reply to Barak Dagan from comment #0)
> Created attachment 889202 [details]
> setup log
> 
> Description of problem:
> setup was upgraded from 3.3.2 to av4.
> Upgrading from av4 to av6.1 fails due to: 
> "[ ERROR ] Failed to execute stage 'Setup validation': Cannot upgrade the
> DWH database schema due to wrong ownership of some database entities. Please
> execute: /usr/share/ovirt-engine/setup/dbutils/changedbowner.sh -s localhost
> -p 5432 -d ovirt_engine_history -f postgres -t engine_history Using the
> password of the "postgres" user."
> 
> from log:
> 2014-04-24 09:37:06 DEBUG otopi.ovirt_engine_setup.database
> database.execute:217 Result: [{'owner': 'postgres', 'object_name':
> 'table_count', 'object_type': 'TYPE', 'object_schema': 'public'}]

This is the only object owned by postgres. Eli - what is it? Does it make sense that it will be owned by postgres? If yes, we should make the check ignore it (and similar?). If no, we should try to find out in the described flow what caused it to be.

Comment 9 Yaniv Lavi 2014-04-24 12:56:26 UTC
(In reply to Yedidyah Bar David from comment #8)
> (In reply to Barak Dagan from comment #0)
> > Created attachment 889202 [details]
> > setup log
> > 
> > Description of problem:
> > setup was upgraded from 3.3.2 to av4.
> > Upgrading from av4 to av6.1 fails due to: 
> > "[ ERROR ] Failed to execute stage 'Setup validation': Cannot upgrade the
> > DWH database schema due to wrong ownership of some database entities. Please
> > execute: /usr/share/ovirt-engine/setup/dbutils/changedbowner.sh -s localhost
> > -p 5432 -d ovirt_engine_history -f postgres -t engine_history Using the
> > password of the "postgres" user."
> > 
> > from log:
> > 2014-04-24 09:37:06 DEBUG otopi.ovirt_engine_setup.database
> > database.execute:217 Result: [{'owner': 'postgres', 'object_name':
> > 'table_count', 'object_type': 'TYPE', 'object_schema': 'public'}]
> 
> This is the only object owned by postgres. Eli - what is it? Does it make
> sense that it will be owned by postgres? 

It's a object that bdagan created, it's private and used only for his testing.


Yaniv

> If yes, we should make the check
> ignore it (and similar?). If no, we should try to find out in the described
> flow what caused it to be.

Comment 10 Yedidyah Bar David 2014-04-24 13:25:53 UTC
(In reply to Yaniv Dary from comment #9)
> (In reply to Yedidyah Bar David from comment #8)
> > (In reply to Barak Dagan from comment #0)
> > > Created attachment 889202 [details]
> > > setup log
> > > 
> > > Description of problem:
> > > setup was upgraded from 3.3.2 to av4.
> > > Upgrading from av4 to av6.1 fails due to: 
> > > "[ ERROR ] Failed to execute stage 'Setup validation': Cannot upgrade the
> > > DWH database schema due to wrong ownership of some database entities. Please
> > > execute: /usr/share/ovirt-engine/setup/dbutils/changedbowner.sh -s localhost
> > > -p 5432 -d ovirt_engine_history -f postgres -t engine_history Using the
> > > password of the "postgres" user."
> > > 
> > > from log:
> > > 2014-04-24 09:37:06 DEBUG otopi.ovirt_engine_setup.database
> > > database.execute:217 Result: [{'owner': 'postgres', 'object_name':
> > > 'table_count', 'object_type': 'TYPE', 'object_schema': 'public'}]
> > 
> > This is the only object owned by postgres. Eli - what is it? Does it make
> > sense that it will be owned by postgres? 
> 
> It's a object that bdagan created, it's private and used only for his
> testing.

OK, closing. Barak - if reproducible on a clean setup, please reopen.