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:
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.
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.
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.
@Adam, we see the ids are modified for RHV _and_ VMware. BTW, in my test, only VMware ids changed, not RHV.
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. :)
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.
Thanks @fdupont, I will take a look.
FYI https://github.com/ManageIQ/manageiq-providers-ovirt/pull/336 seems to fix this issue. Validating our assumption currently.
Unfortunately my initial assumption is incorrect. Reassigning to Boris although I will continue to look at it..
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(+)
Verified on: 5.11.0.3.20190507174347_a77bd90