Bug 960063 - check DB objects before upgrade (owner engine)
Summary: check DB objects before upgrade (owner engine)
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 3.3.0
Assignee: Eli Mesika
QA Contact: Jiri Belka
URL:
Whiteboard: infra
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-06 14:11 UTC by Pavel Stehlik
Modified: 2016-02-10 19:24 UTC (History)
9 users (show)

Fixed In Version: is10
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1022691 0 high CLOSED check database object ownership to engine before upgrade 2021-02-22 00:41:40 UTC
oVirt gerrit 17931 0 None None None Never

Internal Links: 1022691

Description Pavel Stehlik 2013-05-06 14:11:44 UTC
Description of problem:
 Check & stop upgrade in case there are objects in DB not owned by engine user. 
 This routine should prevent from failing upgrade in later stage. This could currently happened in case user perform materialized views (& other changes) by different user (eg: postgres).


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


How reproducible:


Steps to Reproduce:
1. login as user postgres
2. replace view - eg:  creatematerializedviewas('vm_device_view',10);
3.
  
Actual results:
upgrade will fail & rollback will run

Expected results:
put permissions check at very start of upgrade script among other checks

Additional info:

Comment 1 Eli Mesika 2013-05-07 08:07:53 UTC
We must first create our objects in our own schema for that and not in 'public'

Comment 2 Eli Mesika 2013-05-07 21:10:16 UTC
this is what had been concluded with Barak

until BZ 951923 will be implemented in 3.3 we will have a temporary utility for this that will check only Materialized Views definitions for proper ownership by user 'engine'

Comment 4 Eli Mesika 2013-07-08 11:59:51 UTC
Proposed solution :

1) Setup will validate objects owner and exit with a message listing all objects that are not owned by engine

2) The MV SPs that creates database objects will use PG current_user to verify that the user creating the MVs is engine

Comment 5 Alon Bar-Lev 2013-07-08 12:14:18 UTC
(In reply to Eli Mesika from comment #4)
> Proposed solution :
> 
> 1) Setup will validate objects owner and exit with a message listing all
> objects that are not owned by engine

In other words: if object were created with user other than the engine user, these must be manually fixed before installation can proceed.

Please ACK.

Comment 6 Eli Mesika 2013-07-29 09:12:13 UTC
(In reply to Alon Bar-Lev from comment #5)
> (In reply to Eli Mesika from comment #4)
> > Proposed solution :
> > 
> > 1) Setup will validate objects owner and exit with a message listing all
> > objects that are not owned by engine
> 
> In other words: if object were created with user other than the engine user,
> these must be manually fixed before installation can proceed.
> 
> Please ACK.

ACK

Comment 7 Eli Mesika 2013-08-11 14:03:08 UTC
(In reply to Eli Mesika from comment #4)
> Proposed solution :
> 
> 1) Setup will validate objects owner and exit with a message listing all
> objects that are not owned by engine
> 
> 2) The MV SPs that creates database objects will use PG current_user to
> verify that the user creating the MVs is engine

Patch addresses issue 2)
1) should be done by the installer

Comment 8 Eli Mesika 2013-08-12 13:01:39 UTC
fixed in commit : af7e115

Comment 9 Jiri Belka 2013-10-31 15:06:16 UTC
Please provide verification steps. Thank you.

Comment 10 Eli Mesika 2013-10-31 15:34:35 UTC
(In reply to Jiri Belka from comment #9)
> Please provide verification steps. Thank you.

1) create an empty database from root account run
 su - postgres -c "psql -d template1 -c \"create database engine_960063  owner engine;\""

2) from dbscripts dir run
   ./create_schema.sh -u engine -d engine_960063

3) run
   psql -U postgres -c "select * from  CreateMaterializedView('v_vds', 'vds', 30, false, 60);" engine_960063 

you should get:

ERROR:  Materialized view v_vds should be created with user 'engine'.

Comment 11 Jiri Belka 2013-10-31 16:12:00 UTC
ok, is20.1

Comment 12 Itamar Heim 2014-01-21 22:26:34 UTC
Closing - RHEV 3.3 Released

Comment 13 Itamar Heim 2014-01-21 22:29:59 UTC
Closing - RHEV 3.3 Released


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