Bug 879936

Summary: [rhevm-upgrade] [TEXT] rhevm-upgrade fails after rollback on existing user role 'engine' (need to drop it during upgrade)
Product: Red Hat Enterprise Virtualization Manager Reporter: Haim <hateya>
Component: ovirt-engine-setupAssignee: Moran Goldboim <mgoldboi>
Status: CLOSED DUPLICATE QA Contact: Haim <hateya>
Severity: high Docs Contact:
Priority: urgent    
Version: 3.1.0CC: bazulay, dyasny, iheim, knesenko, Rhev-m-bugs, yeylon, ykaul
Target Milestone: ---   
Target Release: 3.1.2   
Hardware: x86_64   
OS: Linux   
Whiteboard: integration
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-11 16:57:36 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:

Description Haim 2012-11-25 16:01:15 UTC
Description of problem:

rhevm-upgrade fails consistently after failed upgrade attempt followed by manual rollback on the following:


2012-11-25 17:02:53::DEBUG::common_utils::341::root:: stderr = 
2012-11-25 17:02:53::DEBUG::common_utils::342::root:: retcode = 0
2012-11-25 17:02:53::DEBUG::common_utils::473::root:: Found IP Address: 10.35.64.13
2012-11-25 17:02:53::DEBUG::common_utils::302::root:: Executing command --> '/usr/bin/psql -U postgres -c ALTER DATABASE rhevm RENAME TO engine;'
2012-11-25 17:02:53::DEBUG::common_utils::340::root:: output = ALTER DATABASE

2012-11-25 17:02:53::DEBUG::common_utils::341::root:: stderr = 
2012-11-25 17:02:53::DEBUG::common_utils::342::root:: retcode = 0
2012-11-25 17:02:53::DEBUG::common_utils::302::root:: Executing command --> '/usr/bin/psql -U postgres -c ALTER ROLE rhevm RENAME TO engine;'
2012-11-25 17:02:53::DEBUG::common_utils::340::root:: output = 
2012-11-25 17:02:53::DEBUG::common_utils::341::root:: stderr = ERROR:  role "engine" already exists

2012-11-25 17:02:53::DEBUG::common_utils::342::root:: retcode = 1
2012-11-25 17:02:53::ERROR::rhevm-upgrade::1323::root:: Traceback (most recent call last):
  File "/usr/bin/rhevm-upgrade", line 1316, in <module>
    main(options)
  File "/usr/bin/rhevm-upgrade", line 1224, in main
    MSG_INFO_PRE_30_UPGRADE)
  File "/usr/bin/rhevm-upgrade", line 661, in runFunc
    func[0](*func[1:])
  File "/usr/share/ovirt-engine/scripts/upgrade_utils30.py", line 98, in modifyDb
    utils.execCmd(cmdList=cmd, failOnError=True, msg="Error: couldn't rename DB ROLE 'rhevm' to '%s'" % basedefs.DB_USER, envDict=env)
  File "/usr/share/ovirt-engine/scripts/common_utils.py", line 345, in execCmd
    raise Exception(msg)
Exception: Error: couldn't rename DB ROLE 'rhevm' to 'engine'

repro steps:

1) start rhevm upgrade from 3.0 to 3.1
2) upgrade fails
3) follow the below:

MSG_ERROR_UPGRADE_30 = "\n **Error: Upgrade failed **\n\
In order to restore the previous installation, perform the following steps: \n\
1. Make sure that there are no EAP6 packages on the system:\n\
\trpm -qa | grep ep6\.el6\n\
If there are such packages, remove them:\n\
\tyum remove `rpm -qa | grep ep6\.el6`\n\
2. Make sure that rhevm or its dependencies are not installed:\n\
\trpm -qa | grep rhevm \n\
If they are still installed, remove them:\n\
\tyum remove `rpm -qa | grep rhevm`\n\
3. Disable EAP6 channel, otherwise you will experience dependency resolution problems.\n\
4. Install rhevm-3.0 from the RHEL channel. For example, use the following command:\n\
\tyum install %s\n\
5. Rename DB if it is present:\n\
\tpsql -U postgres --list\n\
If 'rhevm' DB exists, rename it:\n\
\tpsql -U postgres -c \"ALTER DATABASE rhevm RENAME TO rhevm_old;\"\n\
6. Run rhevm-setup using the answer file located at " + basedefs30.ANSWER_FILE + ":\n\
\trhevm-setup --answer-file=" + basedefs30.ANSWER_FILE + "\n\
7. Remove the DB created by the setup:\n\
\tservice jbossas stop\n\
\tdropdb -U postgres rhevm\n\
8. Restore the production DB using the backup file by running the following commands: \n\
\tpsql -U postgres -f %s \n\
\tpsql -U postgres -c \"ALTER DATABASE engine RENAME TO rhevm;\"\n\
9. Restore security certificates and configs using the following command: \n\
\ttar jxvfP " + basedefs30.OLD_VERSION_FILES + " \n\
10. Start jboss service using the following command: \n\
\tservice jbossas start\n"

- run rhevm-upgrade again.

Comment 2 Yaniv Kaul 2012-11-26 10:30:18 UTC
*** Bug 880114 has been marked as a duplicate of this bug. ***

Comment 3 Moran Goldboim 2012-11-26 10:31:41 UTC
flow need to be added to rollback KB

Comment 4 Moran Goldboim 2012-11-26 21:13:47 UTC
*** Bug 880120 has been marked as a duplicate of this bug. ***

Comment 5 Moran Goldboim 2012-12-11 16:57:36 UTC

*** This bug has been marked as a duplicate of bug 879920 ***