Bug 1732349

Summary: Unexpected error while accessing scvmm templates
Product: Red Hat CloudForms Management Engine Reporter: Ganesh Hubale <ghubale>
Component: ProvidersAssignee: Adam Grare <agrare>
Status: CLOSED CURRENTRELEASE QA Contact: John Dupuy <jdupuy>
Severity: high Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: high    
Version: 5.11.0CC: bmidwood, hkataria, izapolsk, jdupuy, jfrey, jhardy, lavenel, mpovolny, obarenbo, simaishi
Target Milestone: GAKeywords: Regression
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.0.17 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-13 15:01:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Unexpcted error on template details page none

Description Ganesh Hubale 2019-07-23 08:26:02 UTC
Created attachment 1592826 [details]
Unexpcted error on template details page

Description of problem:


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

How reproducible:
100%

Steps to Reproduce:
1. Add scvmm provider and go to details page
2. Click on 'Templates' from 'Relationships' table 
3. Click on any template(like centos-tmpl, fedora-small-tmpl etc)

Actual results:
Unexpected error encountered

Expected results:


Additional info:
- Working as expected on 5.10z

Comment 5 Dávid Halász 2019-07-24 07:32:02 UTC
I was able to reproduce this to the model, possibly a provider issue as it is happening for SCVMM only. The VmOrTemplate#find is behaving inconsistently.
When calling with a VMware template:

VmOrTemplate.find(196) -> returns `ManageIQ::Providers::Vmware::InfraManager::Template`

When calling with a SCVMM template:
VmOrTemplate.find(246) -> returns `MiqTemplate`

Looking into this a little bit more, the `type` field for the given template record is set to `MiqTemplate` instead of `ManageIQ::Providers::Microsoft::InfraManager::Template`.
This causes the `ManageIQ::Providers::Microsoft::InfraManager::Template` class return no templates at all.

Comment 7 CFME Bot 2019-07-24 18:03:11 UTC
New commit detected on ManageIQ/manageiq-providers-scvmm/master:

https://github.com/ManageIQ/manageiq-providers-scvmm/commit/fb097ec4a0388e86e2c726e6359d3ccad5d2191d
commit fb097ec4a0388e86e2c726e6359d3ccad5d2191d
Author:     Adam Grare <agrare>
AuthorDate: Wed Jul 24 12:01:51 2019 -0400
Commit:     Adam Grare <agrare>
CommitDate: Wed Jul 24 12:01:51 2019 -0400

    Fix the SCVMM template type, was just MiqTemplate

    The auto-model-class feature of the persister builder wasn't picking up
    the class correctly because it was looking for
    ManageIQ::Providers::Microsoft::InfraManager::MiqTemplate instead of
    ...InfraManager::Template.

    This caused the templates that got created to have the base model type
    of MiqTemplate.

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1732349

 app/models/manageiq/providers/microsoft/inventory/persister/infra_manager.rb | 2 +-
 spec/models/manageiq/providers/microsoft/infra_manager/refresher_spec.rb | 12 +
 2 files changed, 13 insertions(+), 1 deletion(-)

Comment 8 CFME Bot 2019-07-25 21:42:51 UTC
New commit detected on ManageIQ/manageiq-providers-scvmm/ivanchuk:

https://github.com/ManageIQ/manageiq-providers-scvmm/commit/cd02fe23c4fdb9030e4585f08a82f581809e9ebb
commit cd02fe23c4fdb9030e4585f08a82f581809e9ebb
Author:     Gregg Tanzillo <gtanzill>
AuthorDate: Wed Jul 24 13:59:23 2019 -0400
Commit:     Gregg Tanzillo <gtanzill>
CommitDate: Wed Jul 24 13:59:23 2019 -0400

    Merge pull request #127 from agrare/bz_1732349_fix_scvmm_template_type

    Fix the SCVMM template type, was just MiqTemplate

    (cherry picked from commit 3050c8a269a34540ef91aec2518752e0e963d02b)

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1732349

 app/models/manageiq/providers/microsoft/inventory/persister/infra_manager.rb | 2 +-
 spec/models/manageiq/providers/microsoft/infra_manager/refresher_spec.rb | 12 +
 2 files changed, 13 insertions(+), 1 deletion(-)

Comment 9 John Dupuy 2019-07-26 15:38:05 UTC
*** Bug 1726426 has been marked as a duplicate of this bug. ***

Comment 10 Ievgen Zapolskyi 2019-07-29 16:55:11 UTC
scvmm templates aren't available in provisioning dialog and in Compute->Infrastructure->Virtual Machines->Templates as well.

Comment 11 John Dupuy 2019-07-31 18:04:47 UTC
Verified in SCVMM 5.11.0.17: 

Templates are showing up in all expected locations and I can view their details pages without hitting the unexpected error.