Bug 1669176

Summary: [Regression][V2V][UI] Refreshing hosts will give network and datastore missing on infra map
Product: Red Hat CloudForms Management Engine Reporter: Yadnyawalk Tale <ytale>
Component: ProvidersAssignee: Boriso <bodnopoz>
Status: CLOSED CURRENTRELEASE QA Contact: Yadnyawalk Tale <ytale>
Severity: medium Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: high    
Version: 5.10.0CC: agrare, dmetzger, fdupont, jfrey, jhardy, jkeselma, kkulkarn, mperina, obarenbo, sshveta, vconzola
Target Milestone: GAKeywords: Regression, TestOnly, ZStream
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: v2v
Fixed In Version: 5.11.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1674673 (view as bug list) Environment:
Last Closed: 2019-12-13 15:16:31 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: 1668816, 1674673    
Attachments:
Description Flags
issue.png none

Description Yadnyawalk Tale 2019-01-24 14:24:44 UTC
Created attachment 1523148 [details]
issue.png

Description of problem:
Refreshing hosts will give network and datastore missing on infra map


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


How reproducible:
100%

Steps to Reproduce:
1. Add vmware and RHV
2. Create map and check datastore and network there
3. Refresh RHV hosts
4. Check map again


Actual results:
Getting network and datastore missing on infra map


Expected results:
Should give network and datastore on infra map


Additional info:

Comment 7 Michael Ro 2019-01-25 12:58:32 UTC
Inspecting the Lan model, it seems that refreshing hosts has the effect of re-adding Lan objects with a new CF id and switch_id.  Please compare the two db records below

https://gist.github.com/michaelkro/0bf18a75875168597ca25cd7156426d4#file-after_refresh-L244-L259
https://gist.github.com/michaelkro/0bf18a75875168597ca25cd7156426d4#file-after_refresh-L404-L419

for reference, this is the db state before performing the refresh

https://gist.github.com/michaelkro/e9a2a351e804fabeaa8e551d420ca27a

I guess the first question we need answered is whether or not this is intended behavior.

Comment 9 Michael Ro 2019-01-25 13:35:26 UTC
Similarly, it seems that after host refresh, Storages are assigned new CF ids.

I created a mapping, refreshed the hosts, and then created a second identical mapping.  Please see

https://gist.github.com/michaelkro/ef188eb4a3e41be5fe4226d0a9dec802

to view the resulting Storages transformation_mapping_items.  Note that the destination ID has incremented by one in the "after refresh" records.

Comment 10 Adam Grare 2019-01-25 14:34:25 UTC
I can reproduce this in the spec/models/manageiq/providers/redhat/infra_manager/refresh/refresher_graph_target_host_spec.rb specs the tests just weren't checking the IDs were the same.

Comment 11 Fabien Dupont 2019-01-25 15:01:05 UTC
@Adam, we see the ids are modified for RHV _and_ VMware. BTW, in my test, only VMware ids changed, not RHV.

Comment 12 Yadnyawalk Tale 2019-01-25 15:14:57 UTC
To be frank, when I reproduced this issue, even though I wrote 'refresh RHV host', I don't remember correctly which host I refreshed, I did - select all and refresh. So in case this steps are misleading, apologies! Trust your results. :)

Comment 13 Adam Grare 2019-01-25 15:18:37 UTC
Fabien, I tried to repro this on VMware and this is what I got:

>> ems = ManageIQ::Providers::Vmware::InfraManager.first
>> EmsRefresh.refresh(ems) # First full refresh
>> host = ems.hosts.first
>> host_switch_ids = host.switches.map(&:id)
>> host_lan_ids = host.lans.map(&:id)
>> host_storage_ids = host.storages.map(&:id)
>> EmsRefresh.refresh(host) # Targeted host refresh
>> host.switches.map(&:id)
=> [2, 3, 5, 6]
>> host_switch_ids
=> [2, 3, 5, 6]
>> host.lans.map(&:id)
=> [2, 1, 4, 3, 6]
>> host_lan_ids
=> [2, 1, 4, 3, 6]
>> host.storages.map(&:id)
=> [2]
>> host_storage_ids
=> [2]

So I don't see this issue with VMware.

Comment 17 Jerry Keselman 2019-01-29 15:50:11 UTC
Thanks @fdupont, I will take a look.

Comment 18 Jerry Keselman 2019-01-31 21:57:40 UTC
FYI https://github.com/ManageIQ/manageiq-providers-ovirt/pull/336 seems to fix this issue.  Validating our assumption currently.

Comment 19 Jerry Keselman 2019-01-31 22:16:17 UTC
Unfortunately my initial assumption is incorrect.  Reassigning to Boris although I will continue to look at it..

Comment 21 CFME Bot 2019-02-13 01:48:56 UTC
New commit detected on ManageIQ/manageiq-providers-ovirt/master:

https://github.com/ManageIQ/manageiq-providers-ovirt/commit/1a0117d3c17042fc02952a7e15d56401b50ed8dd
commit 1a0117d3c17042fc02952a7e15d56401b50ed8dd
Author:     Jerry Keselman <jkeselma>
AuthorDate: Thu Jan 31 16:36:56 2019 -0500
Commit:     Jerry Keselman <jkeselma>
CommitDate: Thu Jan 31 16:36:56 2019 -0500

    Fix RHEV Targetted Refresh Disconnected Networks

    Code removed by PR https://github.com/ManageIQ/manageiq-providers-ovirt/pull/316
    caused the problem with disconnected networks indicated in
    https://bugzilla.redhat.com/show_bug.cgi?id=1669176

 app/models/manageiq/providers/redhat/inventory/collector/target_collection.rb | 3 +
 1 file changed, 3 insertions(+)

Comment 22 Yadnyawalk Tale 2019-05-16 08:48:16 UTC
Verified on: 5.11.0.3.20190507174347_a77bd90