Bug 1238443 - Migration: Db:migrate failure when going version 5.2.4 -> 5.4 while uninstalling rubyrep
Summary: Migration: Db:migrate failure when going version 5.2.4 -> 5.4 while uninstall...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Appliance
Version: 5.4.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.5.0
Assignee: Keenan Brock
QA Contact: Jan Krocil
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-07-01 21:34 UTC by Jared Deubel
Modified: 2019-09-12 08:36 UTC (History)
9 users (show)

Fixed In Version: 5.5.0.1
Doc Type: Bug Fix
Doc Text:
Migrating to the previous version of CloudForms Management Engine would fail with a DB:migrate failure error while un-installing rubyrep. This would happen as the replication workers had the VMDB password stored encrypted with the old key. This bug was fixed by ensuring that legacy keys were loaded before un-installing rubyrep, so the task could complete. Migrating to the new version of CloudForms Management Engine now succeeds as expected.
Clone Of:
Environment:
Last Closed: 2015-12-08 13:21:11 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:2551 0 normal SHIPPED_LIVE Moderate: CFME 5.5.0 bug fixes and enhancement update 2015-12-08 17:58:09 UTC

Description Jared Deubel 2015-07-01 21:34:01 UTC
Description of problem:
	

bundle exec rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
While following the guide: https://access.redhat.com/articles/1452003, and error was encountered when running the rake db:migrate task

As a work around, the migration script generated was edited and the following lines were commented out:

say_with_time("Preparing rubyrep") do
        #AwesomeSpawn.run!("bin/rake evm:dbsync:prepare_replication_without_sync")
      end

      say_with_time("Uninstalling rubyrep for renamed tables") do
        #AwesomeSpawn.run!("bin/rake evm:dbsync:uninstall #{RENAMED_TABLES.values.join(" ")}")
      end

The error stack trace was as follows

** Invoke evm:db:environmentlegacykey (first_time)
** Invoke environment 
** Execute evm:db:environmentlegacykey
** Execute db:migrate
==  FixReplicationOnUpgradeFromVersionFour: migrating =========================
-- Updating configurations for replication
   -> 0.5749s
-- drop_trigger(:drift_states, :rr10_states)
   -> 0.0212s
-- drop_trigger(:miq_cim_derived_metrics, :rr10_miq_cim_derived_stats)
   -> 0.0029s
-- drop_trigger(:miq_request_tasks, :rr10_miq_provisions)
   -> 0.0294s
-- drop_trigger(:miq_storage_metrics, :rr10_miq_cim_stats)
   -> 0.0027s
-- drop_trigger(:storages_vms_and_templates, :rr10_storages_vms)
   -> 0.0055s
-- Updating rr10_pending_changes for renamed tables
   -> 2.1883s
-- Updating rr10_sync_state for renamed tables
   -> 0.0056s
-- Updating rr10_sync_state for removed tables
   -> 0.0011s
   -> 0 rows
-- Preparing rubyrep
   -> 13.3254s
-- Uninstalling rubyrep for renamed tables
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

bin/rake evm:dbsync:uninstall drift_states miq_cim_derived_metrics miq_request_tasks miq_storage_metrics storages_vms_and_templates exit code: 1/opt/rh/cfme-gemset/gems/awesome_spawn-1.3.0/lib/awesome_spawn.rb:102:in `run!'
/var/www/miq/vmdb/db/migrate/20131216214850_fix_replication_on_upgrade_from_version_four.rb:167:in `block in up'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/migration.rb:464:in `block in say_with_time'
/opt/rh/ruby200/root/usr/share/ruby/benchmark.rb:281:in `measure'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/migration.rb:464:in `say_with_time'
/var/www/miq/vmdb/db/migrate/20131216214850_fix_replication_on_upgrade_from_version_four.rb:166:in `up'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/migration.rb:436:in `block (2 levels) in migrate'
/opt/rh/ruby200/root/usr/share/ruby/benchmark.rb:281:in `measure'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/migration.rb:436:in `block in migrate'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/migration.rb:415:in `migrate'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/migration.rb:554:in `migrate'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/migration.rb:746:in `block (2 levels) in migrate'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/migration.rb:803:in `block in ddl_transaction'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/transactions.rb:208:in `transaction'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/migration.rb:803:in `ddl_transaction'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/migration.rb:745:in `block in migrate'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/migration.rb:726:in `each'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/migration.rb:726:in `migrate'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/migration.rb:596:in `up'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/migration.rb:577:in `migrate'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/activerecord/lib/active_record/railties/databases.rake:193:in `block (2 levels) in <top (required)>'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/opt/rh/ruby200/root/usr/share/ruby/monitor.rb:211:in `mon_synchronize'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/opt/rh/cfme-gemset/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/opt/rh/cfme-gemset/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/opt/rh/cfme-gemset/bin/rake:23:in `load'
/opt/rh/cfme-gemset/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate

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

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Nick Carboni 2015-07-06 20:59:21 UTC
What version was the appliance that was running the upgrade?

Comment 3 Jared Deubel 2015-07-09 16:28:02 UTC
They upgraded from 5.3 to 5.4. Let me know if you need the minor version.

Comment 15 Nick Carboni 2015-07-20 21:20:16 UTC
https://github.com/ManageIQ/manageiq/pull/3539/

Comment 16 Keenan Brock 2015-07-20 21:29:17 UTC
dajo. could you test this along with https://bugzilla.redhat.com/show_bug.cgi?id=1237245

The goal is to be able to migrate from an early 5.2 -> 5.4.x

It looks like replication may be the Achilles heel on this one. But I believe that has been solved by the code in this fix.

Comment 17 CFME Bot 2015-07-21 14:04:30 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/562bfe3407cf8e064ddd43f6d7cc6df721735045

commit 562bfe3407cf8e064ddd43f6d7cc6df721735045
Author:     Keenan Brock <kbrock>
AuthorDate: Mon Jul 20 15:54:19 2015 -0400
Commit:     Keenan Brock <kbrock>
CommitDate: Mon Jul 20 17:19:05 2015 -0400

    Fix 5.2 -> 5.4 db:migration with replication
    
    When migrating from 5.2 to 5.4, the replication workers have
    the password stored with an old key. This causes the migration to
    fail.
    
    This loads legacy keys so those tasks can complete
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1238443

 .../20131216214850_fix_replication_on_upgrade_from_version_four.rb    | 4 ++--
 ...0131216214850_fix_replication_on_upgrade_from_version_four_spec.rb | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comment 21 errata-xmlrpc 2015-12-08 13:21:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2015:2551


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