Bug 1644083

Summary: Document a known issue around the miq_workers table when upgrading from Red Hat CloudForms 4.2 to 4.6
Product: Red Hat CloudForms Management Engine Reporter: Nikhil Gupta <ngupta>
Component: DocumentationAssignee: Chris Budzilowicz <cbudzilo>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Severity: high Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: high    
Version: 5.9.4CC: abellott, adahms, cbudzilo, gtanzill, jocarter, jrafanie, kdixon, mfeifer, ngupta, obarenbo, yrudman
Target Milestone: GA   
Target Release: 5.9.6   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1644862 (view as bug list) Environment:
Last Closed: 2019-01-09 17:03:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: Documentation Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1622587, 1644862    

Description Nikhil Gupta 2018-10-30 00:57:19 UTC
Description of problem:
After applying the procedure for migrating from 4.2 to 4.6, when I start evmserverd service, I have this error :

~~~
Oct 23 16:54:06 xyzwr1 sh: rake aborted!
Oct 23 16:54:06 xyzwr1 sh: ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass:'ManageIQ::Providers::AnsibleTower::ConfigurationManager::RefreshWorker'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite MiqWorker.inheritance_column to use another column for that information.
~~~


Version-Release number of selected component (if applicable):
cfme-5.7.4.2-1.el7cf.x86_64 to cfme-5.9.4.7-1.el7cf.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Install cfme-4.2 appliance
2. Upgrade it to cfme-4.6
3. Start evm service

Actual results:
Getting following error:

~~~
Oct 23 16:54:06 xyzwr1 sh: rake aborted!
Oct 23 16:54:06 xyzwr1 sh: ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass:'ManageIQ::Providers::AnsibleTower::ConfigurationManager::RefreshWorker'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite MiqWorker.inheritance_column to use another column for that information.
~~~

Expected results:
Service should be up without any errors

Additional info:
After updating schema type to ManageIQ::Providers::AnsibleTower::AutomationManager::RefreshWorker, evm service is up and running:

~~~
MiqWorker.where(:type => "ManageIQ::Providers::AnsibleTower::ConfigurationManager::RefreshWorker").update_all(:type => "ManageIQ::Providers::AnsibleTower::AutomationManager::RefreshWorker")
~~~

Comment 3 Joe Rafaniello 2018-10-30 16:04:16 UTC
It looks like the worker name was renamed starting in fine but a migration wasn't written... cfme 5.8 / cf 4.5 here:

https://github.com/ManageIQ/manageiq/commit/2f0ef1a90758f2b5c37e93a0ed2f586a916dad64

Anyone upgrading from 5.7/4.2 that had used an ansible tower provider will probably hit this error.

To fix this, the database needs to be updated in the miq_workers table to either remove rows with the old name:

MiqWorker.where(:type => "ManageIQ::Providers::AnsibleTower::ConfigurationManager::RefreshWorker").destroy_all

Or rename it to the new name:

MiqWorker.where(:type => "ManageIQ::Providers::AnsibleTower::ConfigurationManager::RefreshWorker").update_all(:type => "ManageIQ::Providers::AnsibleTower::AutomationManager::RefreshWorker")

Comment 7 Marianne Feifer 2018-10-31 15:18:20 UTC
Please add this to migration guide based on the solution article referenced above.

Comment 9 Joe Rafaniello 2019-01-07 16:56:00 UTC
Note, a second worker class was removed without removing rows in miq_workers table and would have the same problem.

See bug 166195, where worker class ManageIQ::Providers::StorageManager::CinderManager::EventCatcher was removed.

Comment 10 Joe Rafaniello 2019-01-07 16:56:43 UTC
Wrong bug.  The correct bug for comment 9 is bug 1661957