Bug 1335462

Summary: Not all vSphere 5.5 datastores shown in the Web UI; disappearing datastores
Product: Red Hat CloudForms Management Engine Reporter: Jan Krocil <jkrocil>
Component: ProvidersAssignee: James Wong <jwong>
Status: CLOSED ERRATA QA Contact: Jan Krocil <jkrocil>
Severity: high Docs Contact:
Priority: high    
Version: 5.6.0CC: agrare, cpelland, gblomqui, jfrey, jhardy, jkrocil, obarenbo, simaishi
Target Milestone: GA   
Target Release: 5.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: provider:vmware:ui:datastore
Fixed In Version: 5.6.0.8 Doc Type: Bug Fix
Doc Text:
Cause: The original storage_inv_by_vm_inv will pull in storage(s) that the targeted VM is using. The refresh hash will show that host is only related to that VM's storage(s). Consequence: The save inventory logic will then remove the host's relationships with other storages that the subject vm doesn't use. Fix: It will pull in all the storages that the vm's host has access to in the refresh hash and so save inventory logic won't disconnect them. Result: Problem solved.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-29 15:59:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Comment 2 Greg Blomquist 2016-05-12 13:51:02 UTC
Adam, try to see if this is a WebUI problem or not.  Not sure what kind of filtering the UI is doing to select the number of datastores to store.

Comment 3 Adam Grare 2016-05-12 13:59:56 UTC
Hi Jan, where in the UI are you looking?  If I go to Infrastructure/Datastores I see 15 on both appliances which matches the count in the database.

Comment 4 Adam Grare 2016-05-12 15:28:52 UTC
OK so it doesn't look like just a UI issue, if you go to Infrastructure/Datastores you can see all of the storages, but if you go to the Provider/Datastores you will see less than the full number.  This is due to some datastores not being linked back to the ExtManagementSystem.

The first issue where you have 15 but only show 14, it looks like you have 1 datastore which is not connected to any hosts.

(Storage.all - ExtManagementSystem.first.storages).collect { |s| s.name }
=> ["do-not-use-datastore"]
HostStorage.all.collect { |hs| hs.storage_id }.uniq.count
=> 14

I'll need to dig into how we associate datastores with the EMS but I'm guessing its through the host which is why that one doesn't show up.  Do you know if this is a regression from 5.4?

The second issue looks like when a full inventory refresh runs all 14 storages are linked to the EMS, but when targeted refresh runs some of those links are cleared.  The datastores are still in the database and the link to the host is still there, but the link to the EMS is removed.

Comment 5 Adam Grare 2016-05-12 18:19:49 UTC
Your second issue is caused during VM targeted refresh, the problem is only the datastores that the VM is on are returned in inventory which causes save_inventory_multi to delete the link between the host and all other datastores on that host.

We can change targeted refresh to return all datastores on the host when doing a targeted vm refresh so those links aren't cleared.

Comment 6 James Wong 2016-05-12 19:26:27 UTC
Ok, I have it reproduced on my local setup using dev-vc60.cloudforms.lab.eng.rdu2.redhat.com

Comment 7 James Wong 2016-05-13 03:58:54 UTC
PR created https://github.com/ManageIQ/manageiq/pull/8675

Comment 9 James Wong 2016-05-13 17:58:42 UTC
This shouldn't be a blocker. The workaround is to perform a provider level refresh.

Comment 10 CFME Bot 2016-05-18 14:50:47 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/3c3db40ccd94a18bf9f95e153a6a88e9c9a6c1db

commit 3c3db40ccd94a18bf9f95e153a6a88e9c9a6c1db
Author:     James Wong <jwong>
AuthorDate: Thu May 12 18:05:39 2016 -0400
Commit:     James Wong <jwong>
CommitDate: Tue May 17 10:22:21 2016 -0400

    Fixing VM target refresh loses host's storages
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1335462
    The original storage_inv_by_vm_inv will pull in storage(s) that the
    targeted VM is using. The refresh hash will show that host is only
    related to that VM's storage(s). The save inventory logic will then
    remove the other host-storage relationships. This is the fix.

 .../vmware/infra_manager/refresh_parser/filter.rb  | 17 +----------
 .../vmware/infra_manager/refresher_spec.rb         | 35 ++++++++++++++++++++++
 2 files changed, 36 insertions(+), 16 deletions(-)

Comment 12 Jan Krocil 2016-05-27 22:59:41 UTC
Verified fixed in 5.6.0.8-rc1 - 5.6.0.8-rc1.20160524155303_f2a5a50.

I wasn't able to reproduce the weird behavior anymore.

Comment 14 errata-xmlrpc 2016-06-29 15:59:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1348