Bug 1571291

Summary: [RHV] VM snapshot removal cause failure in RHV provider refresh
Product: Red Hat CloudForms Management Engine Reporter: Ilanit Stein <istein>
Component: ProvidersAssignee: Boriso <bodnopoz>
Status: CLOSED CURRENTRELEASE QA Contact: Angelina Vasileva <anikifor>
Severity: high Docs Contact:
Priority: high    
Version: 5.9.0CC: cpelland, gblomqui, jfrey, jhardy, jprause, mperina, obarenbo
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: rhev
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1581287 (view as bug list) Environment:
Last Closed: 2019-02-11 14:08:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: RHEVM Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1581287    
Attachments:
Description Flags
evm.log
none
automation.log
none
production.log none

Description Ilanit Stein 2018-04-24 13:08:26 UTC
Description of problem:
When removing a VM snapshot from RHV side, on CFME, RHV refresh fail
with Last message "Couldn't find Snapshot with 'id'=204" 
(In RHv provider summary page)

Version-Release number of selected component (if applicable):
CFME-5.9.2.1 (Graph refresh=ON)
Not on CFME-5.9.2.3 (Graph refresh=OFF)

RHV-4.2.2.5

How reproducible:
100%

Actual results:
RHV refresh fail on snapshot not found.

Expected results:
RHV refresh should not fail on snapshot found, CFME just need to get updated with the snapshot removal.

Additional info:
This is probably related to having the Graph refresh activated, since on CFME-5.9.2.3 this same flow, do not fail the provider refresh.

Comment 2 Ilanit Stein 2018-04-24 13:10:55 UTC
Created attachment 1426044 [details]
evm.log

Comment 3 Ilanit Stein 2018-04-24 13:11:18 UTC
Created attachment 1426045 [details]
automation.log

Comment 4 Ilanit Stein 2018-04-24 13:11:37 UTC
Created attachment 1426046 [details]
production.log

Comment 10 CFME Bot 2018-05-22 12:42:00 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/ff840c93f4731de6ad7a92b26dabc4c2e5918b27
commit ff840c93f4731de6ad7a92b26dabc4c2e5918b27
Author:     Ladislav Smola <lsmola>
AuthorDate: Tue May 22 02:51:16 2018 -0400
Commit:     Ladislav Smola <lsmola>
CommitDate: Tue May 22 02:51:16 2018 -0400

    Do not delete children snapshots as part of parent

    Do not delete children snapshots as part of parent. The default
    relation :children, added by acts_as_tree, has :dependent => :destroy.

    So deleting parent, will delete all it's children. This is not behavior
    we want in refresh. In old refresh, we were bypassing this by:
    https://github.com/ManageIQ/manageiq/blob/master/app/models/ems_refresh/save_inventory.rb#L366

    So first, we deleted the tree relations, then we did create/update/delete
    of the nodes, then we updated the tree connections again. All of that should
    not be needed, if we will just use :dependent => :nullify

    Partially fixes:
    https://bugzilla.redhat.com/show_bug.cgi?id=1571291

 app/models/snapshot.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 11 CFME Bot 2018-05-22 12:51:25 UTC
New commit detected on ManageIQ/manageiq-providers-ovirt/master:

https://github.com/ManageIQ/manageiq-providers-ovirt/commit/629c024021e34097ffe09cfb7182a0075725362d
commit 629c024021e34097ffe09cfb7182a0075725362d
Author:     Boris Odnopozov <bodnopoz>
AuthorDate: Thu May 17 04:58:26 2018 -0400
Commit:     Boris Odnopozov <bodnopoz>
CommitDate: Thu May 17 04:58:26 2018 -0400

    Fix refreshing targeted vm after snapshot removal

    Avoid refreshing the vm a second time if snapshot was removed.

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

 app/models/manageiq/providers/redhat/inventory/collector/target_collection.rb | 14 +-
 spec/models/manageiq/providers/redhat/infra_manager/refresh/refresher_graph_target_vm_spec.rb | 14 +-
 spec/vcr_cassettes/manageiq/providers/redhat/infra_manager/refresh/ovirt_sdk_refresh_graph_target_vm_deleted_snapshot.yml | 2452 +
 3 files changed, 2469 insertions(+), 11 deletions(-)

Comment 13 Jan Zmeskal 2018-09-17 12:31:42 UTC
Verified on:
CFME 5.10.0.15

Verification steps:
1. Have a CFME with RHV provider and some VM
2. Go to CFME UI and find your VM's detail page and go to Snapshots.
3. Create a new snapshot.
4. Go to the provider's summary page.
5. Now switch to RHV UI and locate you VM's snapshots and delete the one you just created.
6. Wait until RHV reports that the deletion is complete.
7. Go back to CFME UI and verify there are no error on Provider's summary page or on VM's detail page.
8. Verify there are no errors in evm.log.