Bug 958765 - engine: running the db scripts manually with user posgres will change the table permission and upgrade will fail since user engine cannot change tables
Summary: engine: running the db scripts manually with user posgres will change the tab...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.2.0
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
: 3.2.0
Assignee: Eli Mesika
QA Contact: Dafna Ron
URL:
Whiteboard: infra
Depends On:
Blocks: 948448
TreeView+ depends on / blocked
 
Reported: 2013-05-02 11:12 UTC by Dafna Ron
Modified: 2016-02-10 19:40 UTC (History)
9 users (show)

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


Attachments (Terms of Use)
upgrade logs (18.13 KB, application/x-gzip)
2013-05-02 11:12 UTC, Dafna Ron
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 14438 0 None None None Never

Description Dafna Ron 2013-05-02 11:12:26 UTC
Created attachment 742627 [details]
upgrade logs

Description of problem:

I ran #./taskcleaner.sh -s localhost -p 5432 -d engine -u postgres -A -R on my setup. 
when I tried to upgrade I got this error: 

2013-05-02 12:32:36::DEBUG::common_utils::492::root:: stderr = psql:./taskcleaner_sp.sql:19: ERROR:  must be owner of function getasynctaskszombies

looking at the log, we execute the taskcleaner script with user engine: 

/usr/share/ovirt-engine/scripts/taskcleaner/taskcleaner.sh -u engine -s localhost -p 5432 -d engine -z

I ran the script manually again using user engine: 

./taskcleaner.sh -s localhost -p 5432 -d engine -u engine -A -R

and upgraded again

this time the upgrade succeeded. 

just to add that Eli and I ran a test on 3.1.4 for BZ949682 and also failed the upgrade on permission issues so we should consider backporting of the fix. 

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

sf14 -> sf15

How reproducible:

100%

Steps to Reproduce:
1. cd /usr/share/ovirt-engine/scripts/taskcleaner
2. run the following: ./taskcleaner.sh -s localhost -p 5432 -d engine -u postgres -A -R
3. try to upgrade rhevm
  
Actual results:

we fail to upgrade since running the taskcleaner script with user postgres will cause the table permissions to change and when upgrade will run user engine will not be able to run on the table 

Expected results:

if running the script with other users aside from engine we should not allow running it with any other user to avoide issues during upgrade. 

Additional info: full logs


2013-05-02 12:32:36::DEBUG::common_utils::453::root:: Executing command --> '/usr/share/ovirt-engine/scripts/taskcleaner/taskcleaner.sh -u engine -s localhost -p 5432 -d engine -z' in working directory '/'
2013-05-02 12:32:36::DEBUG::common_utils::491::root:: output = (No rows)

2013-05-02 12:32:36::DEBUG::common_utils::492::root:: stderr = psql:./taskcleaner_sp.sql:19: ERROR:  must be owner of function getasynctaskszombies
psql:./taskcleaner_sp.sql:28: ERROR:  must be owner of function deleteasynctaskzombiesbytaskid
psql:./taskcleaner_sp.sql:37: ERROR:  must be owner of function deleteasynctaskzombiesbycommandid
psql:./taskcleaner_sp.sql:44: ERROR:  must be owner of function deleteasynctaskbycommandid
psql:./taskcleaner_sp.sql:51: ERROR:  must be owner of function deleteasynctaskszombies
psql:./taskcleaner_sp.sql:58: ERROR:  must be owner of function deletejobstepsbytaskid
psql:./taskcleaner_sp.sql:68: ERROR:  must be owner of function deleteentitysnapshotbyzombietaskid
psql:./taskcleaner_sp.sql:78: ERROR:  must be owner of function deleteentitysnapshotbytaskid
psql:./taskcleaner_sp.sql:85: ERROR:  must be owner of function deleteentitysnapshotzombies
psql:./taskcleaner_sp.sql:92: ERROR:  must be owner of function deletejobstepsbyzombiecommandid
psql:./taskcleaner_sp.sql:99: ERROR:  must be owner of function deletejobstepsbycommandid
psql:./taskcleaner_sp.sql:106: ERROR:  must be owner of function deletejobstepszombies
psql:./taskcleaner_sp.sql:113: ERROR:  must be owner of function deletealljobs
psql:./taskcleaner_sp.sql:120: ERROR:  must be owner of function deleteallentitysnapshot

Comment 2 Barak 2013-05-03 15:46:32 UTC
Eli,

Since the DB utilities are mostly used by GSS in production environments, in order to prevent future upgrade issues I think we need to force the right user for production environment by default, and enable an override for development environment.

It goes for all the utilities.

Comment 5 Eli Mesika 2013-05-06 10:43:51 UTC
fixed in commit: cc61e7f

Comment 6 Dafna Ron 2013-05-20 14:19:32 UTC
verified on sf17 - no user was specifically added and we ran with user engine: 

2013-May-20, 17:17 System user root run unlock_entity script on disk 1435f7f9-6b33-4710-afa8-c6aea4563792 with db user engine

Comment 7 Itamar Heim 2013-06-11 09:03:49 UTC
3.2 has been released

Comment 8 Itamar Heim 2013-06-11 09:03:56 UTC
3.2 has been released

Comment 9 Itamar Heim 2013-06-11 09:04:03 UTC
3.2 has been released

Comment 10 Itamar Heim 2013-06-11 09:04:24 UTC
3.2 has been released

Comment 11 Itamar Heim 2013-06-11 09:33:23 UTC
3.2 has been released


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