Bug 1511445

Summary: Template added to CFME even though sealing fails in RHV
Product: Red Hat CloudForms Management Engine Reporter: Jan Zmeskal <jzmeskal>
Component: ProvidersAssignee: Moti Asayag <masayag>
Status: CLOSED CURRENTRELEASE QA Contact: Radim Hrazdil <rhrazdil>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.9.0CC: bodnopoz, gblomqui, istein, jfrey, jhardy, jzmeskal, mperina, obarenbo, simaishi
Target Milestone: GAKeywords: TestOnly
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1532648 (view as bug list) Environment:
Last Closed: 2018-06-21 20:51:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: RHEVM Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1530622, 1532648    
Attachments:
Description Flags
Second attempt - logs from CFME & RHV none

Description Jan Zmeskal 2017-11-09 11:45:48 UTC
Description of problem:
When you create a template from VM in RHV and sealing fails, the template is not created in RHV. However, such template appears in CFME. 

Version-Release number of selected component (if applicable):
CFME 5.9.0.4
RHV 4.1.7.4

Steps to Reproduce:
1. Add RHV provider to CFME and make sure relationships are refreshed
2. In RHV, try to create template from VM in such manner that it fails during sealing
3. Chech that the template is indeed not present in RHV
4. In CFME, go to Compute->Infrastructure->Virtual Machines->Templates->All Templates
5. New template is there

Actual results:
see step 5

Expected results:
I suppose such template should not appear in CFME since its creation was not successfully finished.

Comment 2 Moti Asayag 2017-11-26 15:00:15 UTC
Hi Jan,

Could you attach the engine.log to the bug ?
The engine.log should contain the certain event which triggered the removal of the created template from RHV. That event is probably isn't monitored on manageiq side.

Therefore we should rely on that event to perform a target refresh for that target template and as an outcome it should be removed if not exists on RHV side.

Comment 3 Jan Zmeskal 2017-11-27 13:12:27 UTC
Created attachment 1359454 [details]
Second attempt - logs from CFME & RHV

I tried this again on RHV RHV 4.1.7.6 and CFME 5.9.0.9. This time creation of template failed even before sealing, but the result was the same nonetheless. I tried to make a template out of VM "jzmeskal_test2". The template was named "flawed_template2". It was not created on RHV, but was created on CFME side. See the attached logs.

Comment 4 Jan Zmeskal 2017-12-12 07:53:03 UTC
How to reproduce failed template creation:
1. Go to RHV and create a new VM with these properties:
- Template: Blank
- No network interface
2. Right-click the new VM and choose Make Template
3. In the New Template dialog click on checkbox Seal Template
4. Click OK
5. Template creating fails, but it is present in CFME

Comment 6 CFME Bot 2018-01-08 23:17:23 UTC
New commit detected on ManageIQ/manageiq-content/master:
https://github.com/ManageIQ/manageiq-content/commit/8565b550910bd20c551c1cdee6021664453cc14c

commit 8565b550910bd20c551c1cdee6021664453cc14c
Author:     Boris Odnopozov <bodnopoz>
AuthorDate: Sun Dec 24 16:39:14 2017 +0200
Commit:     Boris Odnopozov <bodnopoz>
CommitDate: Sun Dec 24 16:41:43 2017 +0200

    Refresh template if sealing failed
    
    Refresh the template if we catch an event from the provider on sealing
    failure.
    
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1511445

 .../RHEVM.class/user_add_vm_template_seal_failure.yaml       | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 content/automate/ManageIQ/System/Event/EmsEvent/RHEVM.class/user_add_vm_template_seal_failure.yaml