Bug 790303

Summary: oVirt-Engine: Upgrade from first release doesn't work
Product: [Retired] oVirt Reporter: Ofer Schreiber <oschreib>
Component: ovirt-engine-coreAssignee: Eli Mesika <emesika>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: acathrow, iheim, ykaul, yzaslavs
Target Milestone: ---   
Target Release: 3.1   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-09 07:56:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ofer Schreiber 2012-02-14 07:18:48 UTC
Description of problem:
Upgrade from the first release of oVirt engine fails.

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

How reproducible:
Run upgrade.sh (under dbscripts) after upgrading the first release to the latest git tip.

Steps to Reproduce:
1. Install 3.0.0_0001-1.6
2. Upgrade to rpms from nightly/lastest git tip
3. Run /usr/share/ovirt-engine/dbscripts/upgrade.sh -s 127.0.0.1 -d engine -u postgres
  
Additional info:
This happens since the upgrade script tries to run only new dbscripts based on the number of the last dbscript applied.
Since we cherry-picked few patches into engine_3.0 branch (build branch), the last two dbscripts in the first release are:
03_01_0130_update_network_name.sql
03_01_0250_add_default_origin_type.sql

so the upgrade script will run only scripts that are > 03_01_0250, but in the master branch, there are multiple scripts between 0130 and 0250 that didn't run in the first release.

Error log:
pgrade log:
=================
2012-02-13 21:21:59:EBUG::engine-upgrade::435::root:: DB Update started
2012-02-13 21:21:59:EBUG::common_utils::220::root:: Executing command --> '/usr/share/ovirt-engine/dbscripts/upgrade.sh -s 127.0.0.1 -d engine -u postgres'
2012-02-13 21:22:06:EBUG::common_utils::246::root:: output = upgrade script detected a change in a View or Stored Procedure...
Running upgrade script upgrade/03_01_0260_add_job_table.sql 
Running upgrade script upgrade/03_01_0270_add_job_subject_entity_table.sql 
Running upgrade script upgrade/03_01_0280_add_step_table.sql 
Running upgrade script upgrade/03_01_0290_add_plugged_config_options.sql 
Running upgrade script upgrade/03_01_0300_vds_static_unique_fields.sql 
Running upgrade script upgrade/03_01_0310_add_config_values_allow_dup_macs.sql 
Running upgrade script upgrade/03_01_0320_rename_audit_log_keys_from_merge_to_remove.sql 
Running upgrade script upgrade/03_01_0330_add_step_id_column_to_async_task.sql 
Running upgrade script upgrade/03_01_0400_add_config_values_setupnetworks.sql 
Creating views...

2012-02-13 21:22:06:EBUG::common_utils::247::root:: stderr = psql:create_views.sql:382: ERROR:  column vm_dynamic.hash does not exist
LINE 26: ...m_static.min_allocated_mem as min_allocated_mem,  vm_dynamic...
                                                              ^

2012-02-13 21:22:06:EBUG::common_utils::248::root:: retcode = 3
2012-02-13 21:22:06::ERROR::engine-upgrade::637::root:: Traceback (most recent call last):
  File "/usr/bin/engine-upgrade", line 628, in main
    runFunc([restartPostgresql, db.update], MSG_INFO_DB_UPDATE)
  File "/usr/bin/engine-upgrade", line 485, in runFunc
    func()
  File "/usr/bin/engine-upgrade", line 440, in update
    output, rc = utils.execCmd(cmd, None, True, MSG_ERROR_UPDATE_DB)
  File "/usr/share/ovirt-engine/scripts/common_utils.py", line 251, in execCmd
    raise Exception(msg)
Exception: Error: Database update failed

Comment 1 Eli Mesika 2012-04-18 21:57:41 UTC
http://gerrit.ovirt.org/#change,3689 to 3695

Comment 2 Itamar Heim 2012-08-09 07:56:45 UTC
closing ON_QA bugs as oVirt 3.1 was released:
http://www.ovirt.org/get-ovirt/