Bug 1378921

Summary: engine-setup after DB restore fails with EDB on ownership check
Product: [oVirt] ovirt-engine Reporter: Lucie Leistnerova <lleistne>
Component: Setup.EngineAssignee: Yedidyah Bar David <didi>
Status: CLOSED WONTFIX QA Contact: Lucie Leistnerova <lleistne>
Severity: high Docs Contact:
Priority: low    
Version: 4.0.4CC: bugs, dfediuck, didi, emesika, lleistne, mkalinin, mperina, ylavi
Target Milestone: ---Flags: sbonazzo: ovirt-4.3-
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-04 19:43:27 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:
Bug Depends On:    
Bug Blocks: 1324882    

Description Lucie Leistnerova 2016-09-23 14:01:48 UTC
Version-Release number of selected component (if applicable):
ovirt-engine-setup-4.0.4.4-0.1.el7ev.noarch

Description of problem:
engine-setup checks ownership of database entities, but it searches also entities in schemas, that could not have anything to do with engine

file: /usr/share/ovirt-engine/setup/plugins/ovirt-engine-setup/ovirt-engine/db/schema.py

function: def _checkDatabaseOwnership(self):

sql:
...
where
    nsp.nspname not in ('information_schema', 'pg_catalog')

Customer can have his own schemas with tables/views/functions and so he fails to install engine.

Failed to execute stage 'Setup validation': Cannot upgrade the Engine database schema due to wrong ownership of some database entities. Please execute: /usr/share/ovirt-engine/setup/dbutils/changedbowner.sh -s xxx -p xxx -d engine -f postgres -t engine Using the password of the "postgres" user.

I can't test if the changeowner.sh changes ownership of this tables too, because of Bug 1371501. Or it doesn't and the engine-setup always fails on this check.

Comment 1 Martin Perina 2016-09-24 19:27:27 UTC
Eli, could you please take a look?

Comment 2 Oved Ourfali 2016-09-25 06:02:40 UTC
Martin - isn't it integration?

Comment 3 Yedidyah Bar David 2016-09-25 06:08:32 UTC
(In reply to Lucie Leistnerova from comment #0)
> Version-Release number of selected component (if applicable):
> ovirt-engine-setup-4.0.4.4-0.1.el7ev.noarch
> 
> Description of problem:
> engine-setup checks ownership of database entities, but it searches also
> entities in schemas, that could not have anything to do with engine
> 
> file:
> /usr/share/ovirt-engine/setup/plugins/ovirt-engine-setup/ovirt-engine/db/
> schema.py
> 
> function: def _checkDatabaseOwnership(self):
> 
> sql:
> ...
> where
>     nsp.nspname not in ('information_schema', 'pg_catalog')
> 
> Customer can have his own schemas with tables/views/functions and so he
> fails to install engine.

In the engine database? Why would the customer want/need this? IMO engine database should be considered "private".

Customer can store whatever customer wants in other databases on the same postgres instance/cluster.

> 
> Failed to execute stage 'Setup validation': Cannot upgrade the Engine
> database schema due to wrong ownership of some database entities. Please
> execute: /usr/share/ovirt-engine/setup/dbutils/changedbowner.sh -s xxx -p
> xxx -d engine -f postgres -t engine Using the password of the "postgres"
> user.
> 
> I can't test if the changeowner.sh changes ownership of this tables too,
> because of Bug 1371501. Or it doesn't and the engine-setup always fails on
> this check.

Please note that this bug is for 4.1, and the solution isn't to fix the script but to remove it (and the recommendation to use it).

Comment 4 Eli Mesika 2016-09-25 11:00:43 UTC
I really don't think that customer should have its own schema inside our engine database, that not sound correct when the customer can create it own database and add his own schema there

Comment 5 Doron Fediuck 2016-09-25 11:38:07 UTC
(In reply to Eli Mesika from comment #4)
> I really don't think that customer should have its own schema inside our
> engine database, that not sound correct when the customer can create it own
> database and add his own schema there

Data scheme is equivalent to the code. This is what we produce. verify and test
and we cannot support any changes to either one, unless it was added during
the standard development flow.

Comment 6 Yaniv Lavi 2016-09-27 08:02:55 UTC
This is a issue when trying to use EDB as remote DB.

Comment 7 Eli Mesika 2016-09-27 13:44:23 UTC
(In reply to Doron Fediuck from comment #5)
> (In reply to Eli Mesika from comment #4)
> > I really don't think that customer should have its own schema inside our
> > engine database, that not sound correct when the customer can create it own
> > database and add his own schema there
> 
> Data scheme is equivalent to the code. This is what we produce. verify and
> test
> and we cannot support any changes to either one, unless it was added during
> the standard development flow.

However , there can be a workaround for that changing :

file: /usr/share/ovirt-engine/setup/plugins/ovirt-engine-setup/ovirt-engine/db/schema.py

function: def _checkDatabaseOwnership(self):

sql:
...
where
    nsp.nspname not in ('information_schema', 'pg_catalog')

to 
where
    nsp.nspname in ('public', 'aaa_jdbc')

This will enable installation of other schema to our database without checking those schema for the 'engine' owner

Comment 8 Yedidyah Bar David 2016-09-27 14:24:58 UTC
(In reply to Yaniv Dary from comment #6)
> This is a issue when trying to use EDB as remote DB.

Very well - I think there is engineering agreement, that as-is, current bug is not going to be solved. If the only use case is EDB, then please:

1. Change summary accordingly (e.g. "ovirt xyz is failing when using remote EDB")
2. Attach setup (and perhaps other relevant) logs.
3. I don't know EDB. Does it have a free (FOSS, or at least gratis/developer) version we can try with?

Thanks.

Comment 9 Lucie Leistnerova 2016-09-30 07:41:09 UTC
EnterpriseDB has schema 'sys' with special features

free trial version
http://www.enterprisedb.com/products-services-training/products/postgres-plus-advanced-server/downloads

Comment 10 Red Hat Bugzilla Rules Engine 2016-10-13 07:51:57 UTC
Bug tickets must have version flags set prior to targeting them to a release. Please ask maintainer to set the correct version flags and only then set the target milestone.