Bug 1022262 - rhevm-upgrade fails to upgrade database when moving to 3.2.3 after previous restore due to object ownership
Summary: rhevm-upgrade fails to upgrade database when moving to 3.2.3 after previous r...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-setup
Version: 3.2.0
Hardware: x86_64
OS: Linux
high
high
Target Milestone: ---
: 3.2.6
Assignee: Eli Mesika
QA Contact: Pavel Stehlik
URL:
Whiteboard: integration
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-22 20:56 UTC by wdaniel
Modified: 2018-12-03 20:25 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-12-16 09:20:15 UTC
oVirt Team: ---
Target Upstream Version:


Attachments (Terms of Use)
dbutils.tar.gz (6.61 KB, application/x-gzip)
2013-10-29 20:44 UTC, Alon Bar-Lev
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 538873 0 None None None Never

Description wdaniel 2013-10-22 20:56:33 UTC
Description of problem:

Customer was trying to perform standard upgrade to his RHEV environment (minor version number, NOT 3.1 to 3.2). Upgrade failed due to datbase related issue. From the sosreport it appears that some RPMs are on 3.2.3, while others are at 3.2.0 or 3.2.1.

How reproducible:
Unknown


Actual results:
Database change fails, upgrade script rollsback and exits with error

Expected results:
Cleqan upgrade to 3.2.3

Additional info:

From upgrade log:

2013-10-21 15:28:29::DEBUG::rhevm-upgrade::454::root:: DB Update started
2013-10-21 15:28:29::DEBUG::common_utils::453::root:: Executing command --> '/usr/share/ovirt-engine/dbscripts/
upgrade.sh -l /var/log/ovirt-engine/engine-db-upgrade-2013_10_21_15_28_29.log -s localhost -p 5432 -u engine -d
 engine_2013_10_21_15_25_27' in working directory '/usr/share/ovirt-engine/dbscripts'
2013-10-21 15:28:30::DEBUG::common_utils::491::root:: output = /usr/share/ovirt-engine/dbscripts /usr/share/ovi
rt-engine/dbscripts
upgrade script detected a change in Config, View or Stored Procedure...

2013-10-21 15:28:30::DEBUG::common_utils::492::root:: stderr = psql:common_sp.sql:20: ERROR:  must be owner of 
function fn_db_add_column

2013-10-21 15:28:30::DEBUG::common_utils::493::root:: retcode = 3
2013-10-21 15:28:30::ERROR::rhevm-upgrade::1455::root:: Traceback (most recent call last):
  File "/usr/bin/rhevm-upgrade", line 1442, in main
    runFunc([db.update], MSG_INFO_DB_UPDATE)
  File "/usr/bin/rhevm-upgrade", line 757, in runFunc
    func()
  File "/usr/bin/rhevm-upgrade", line 473, in update
    output, rc = utils.execCmd(cmdList=cmd, failOnError=True, msg=MSG_ERROR_UPDATE_DB)
  File "/usr/share/ovirt-engine/scripts/common_utils.py", line 496, in execCmd
    raise Exception(msg)
Exception: Error: Database update failed

2013-10-21 15:28:30::ERROR::rhevm-upgrade::1456::root:: Rolling back update
2013-10-21 15:28:30::DEBUG::rhevm-upgrade::404::root:: DB Restore started

$ grep rhevm installed-rpms 
rhevm-3.2.3-0.42.el6ev.noarch                               Mon 21 Oct 2013 03:33:40 PM CDT
rhevm-backend-3.2.3-0.42.el6ev.noarch                       Mon 21 Oct 2013 03:33:29 PM CDT
rhevm-cli-3.2.0.9-1.el6ev.noarch                            Tue 10 Sep 2013 11:14:02 AM CDT
rhevm-config-3.2.3-0.42.el6ev.noarch                        Mon 21 Oct 2013 03:33:28 PM CDT
rhevm-dbscripts-3.2.3-0.42.el6ev.noarch                     Mon 21 Oct 2013 03:33:40 PM CDT
rhevm-doc-3.2.1-2.el6eng.noarch                             Tue 10 Sep 2013 11:13:48 AM CDT
rhevm-dwh-3.2.1-2.el6ev.noarch                              Wed 11 Sep 2013 09:59:36 AM CDT
rhevm-genericapi-3.2.3-0.42.el6ev.noarch                    Mon 21 Oct 2013 03:33:40 PM CDT
rhevm-image-uploader-3.2.2-2.el6ev.noarch                   Tue 10 Sep 2013 11:13:16 AM CDT
rhevm-iso-uploader-3.2.2-3.el6ev.noarch                     Tue 10 Sep 2013 11:13:16 AM CDT
rhevm-log-collector-3.2.2-4.el6ev.noarch                    Tue 10 Sep 2013 11:13:16 AM CDT
rhevm-notification-service-3.2.3-0.42.el6ev.noarch          Mon 21 Oct 2013 03:33:40 PM CDT
rhevm-reports-3.2.1-6.el6ev.noarch                          Wed 11 Sep 2013 10:00:10 AM CDT
rhevm-restapi-3.2.3-0.42.el6ev.noarch                       Mon 21 Oct 2013 03:33:29 PM CDT
rhevm-sdk-3.2.1.1-1.el6ev.noarch                            Tue 10 Sep 2013 11:12:54 AM CDT
rhevm-setup-3.2.3-0.43.el6ev.noarch                         Fri 18 Oct 2013 08:16:45 AM CDT
rhevm-spice-client-x64-cab-3.2-13.el6ev.noarch              Tue 10 Sep 2013 11:15:29 AM CDT
rhevm-spice-client-x86-cab-3.2-13.el6ev.noarch              Tue 10 Sep 2013 11:15:29 AM CDT
rhevm-tools-common-3.2.3-0.42.el6ev.noarch                  Mon 21 Oct 2013 03:33:28 PM CDT
rhevm-userportal-3.2.3-0.42.el6ev.noarch                    Mon 21 Oct 2013 03:33:40 PM CDT
rhevm-webadmin-portal-3.2.3-0.42.el6ev.noarch               Mon 21 Oct 2013 03:33:55 PM CDT

Comment 1 Alon Bar-Lev 2013-10-23 06:24:58 UTC
ERROR:  must be owner of function fn_db_add_column

for some reason you have objects in database that are not owned by the engine user. had this environment restored from backup or database manually updated?

Comment 2 Itamar Heim 2013-10-23 10:30:39 UTC
flagging for tracking until analyzed.
also setting needinfo for comment 1

Comment 3 wdaniel 2013-10-23 19:12:49 UTC
(In reply to Alon Bar-Lev from comment #1)
> ERROR:  must be owner of function fn_db_add_column
> 
> for some reason you have objects in database that are not owned by the
> engine user. had this environment restored from backup or database manually
> updated?

From the customer:

	
This box was restored from a another box that had a failed raid controller. I installed a fresh RH 6.4 on a newer server and then installed the latest rhevm 3.2 software then I followed the backup/restore onto a different machine article. It was never upgraded from a rhevm 3.1 server. Every time that I moved from 3.0 to 3.1 to 3.2 , I installed a fresh OS & rhevmX.X then "exported" the VM's then imported them into the new environment.

Comment 4 Alon Bar-Lev 2013-10-23 19:20:09 UTC
OK, this is known issue, the procedure mistakenly used the postgres user instead of the engine user.

We are working on a script[1] that will enable to change the owner of all object to engine user.

[1] http://gerrit.ovirt.org/#/c/18682/

Comment 5 Itamar Heim 2013-10-23 23:16:36 UTC
i assume we don't need customer to wait for the z-stream of this, rather just run the script when its ready and continue with their upgrade.

Comment 6 Alon Bar-Lev 2013-10-23 23:25:56 UTC
(In reply to Itamar Heim from comment #5)
> i assume we don't need customer to wait for the z-stream of this, rather
> just run the script when its ready and continue with their upgrade.

right. eli can pack up something workable.

it is not z-stream it is part of 3.3 as toolbox for these cases.

Comment 7 wdaniel 2013-10-25 16:42:27 UTC
(In reply to Itamar Heim from comment #5)
> i assume we don't need customer to wait for the z-stream of this, rather
> just run the script when its ready and continue with their upgrade.

Itamar, Alon,

I'm happy to pass this on to my customer as a resolution, thank you for pointing this out. Will this bug be updated when that script has been given the OK to be run by the customer, or is this something that they are currently able to use?

Thanks,
Wallace

Comment 8 Alon Bar-Lev 2013-10-25 16:45:40 UTC
Hi Eli,

Can you please provide workable script for 3.2?

Thanks.

Comment 9 wdaniel 2013-10-29 20:34:28 UTC
Alon, Eli,

Thank you for your help with this so far. The customer now has a second case open with us that also seems to be linked to this, and we're hoping to get a time frame on when we could get a copy of this script. 

Thanks,
Wallace

Comment 10 Alon Bar-Lev 2013-10-29 20:44:04 UTC
Created attachment 817189 [details]
dbutils.tar.gz

Backup database.

Extract attachment into temp directory.

Execute:

# PGPASSWORD=<postgres user password> ./changedbowner.sh -d engine -f postgres -t engine

Provided the database name is engine and the user name is engine, you can check this at /etc/ovirt-engine/.pgpass

Eli,

Please ACK.

Comment 11 Eli Mesika 2013-10-30 08:57:43 UTC
(In reply to Alon Bar-Lev from comment #10)
> Created attachment 817189 [details]
> dbutils.tar.gz
> 
> Backup database.
> 
> Extract attachment into temp directory.
> 
> Execute:
> 
> # PGPASSWORD=<postgres user password> ./changedbowner.sh -d engine -f
> postgres -t engine
> 
> Provided the database name is engine and the user name is engine, you can
> check this at /etc/ovirt-engine/.pgpass
> 
> Eli,
> 
> Please ACK.

ACK

Comment 12 Eli Mesika 2013-11-21 11:27:18 UTC
As far as I am concerned , this issue was resolved by sending the changedbowner.sh to the customer (see comment 10)

Comment 13 Lee Yarwood 2013-11-25 13:40:37 UTC
(In reply to Eli Mesika from comment #12)
> As far as I am concerned , this issue was resolved by sending the
> changedbowner.sh to the customer (see comment 10)

Is there no way to automate this during a 3.2.z upgrade?

Comment 14 Eyal Edri 2013-12-16 08:39:28 UTC
since this seems to solved, can you close it as "CLOSED CURRENT RELEASE?" (according to comment 12)


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