Bug 1378984

Summary: [RFE] CFME 4.1 EMS Refresh should be targeted for folder create, as opposed to a full EMS Refresh
Product: Red Hat CloudForms Management Engine Reporter: myoder
Component: ProvidersAssignee: Adam Grare <agrare>
Status: CLOSED CURRENTRELEASE QA Contact: Nandini Chandra <nachandr>
Severity: high Docs Contact:
Priority: high    
Version: 5.6.0CC: dmetzger, jfrey, jhardy, nachandr, obarenbo
Target Milestone: GAKeywords: FutureFeature, RFE, TestOnly
Target Release: 5.9.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: 5.9.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1445311 1445318 (view as bug list) Environment:
Last Closed: 2018-03-06 14:37:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: VMware Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1445311, 1445318    

Description myoder 2016-09-23 19:33:53 UTC
Description of problem: During the creation of folders, there is a full refresh on the provider which is unnecessary and time consuming. Instead there should be a targeted refresh on the folders


Version-Release number of selected component (if applicable): CFME 5.5.5.4


How reproducible: Always


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 myoder 2016-09-23 19:49:39 UTC
Was wrong about the Version-Release, its 5.6.1.2

Comment 3 Adam Grare 2016-10-27 14:59:01 UTC
This is going to take a couple of steps:
1. Add EmsFolder as a new Refresh Target type
2. Update the filter_vc_data to handle filtering on a folder
3. Update the disconnect logic in EmsRefresh to handle the new target type
4. Pick out the minimal info about a new folder from a VMware Event (moref, name, parent) to create the new folder

I started looking at picking the minimal amount of information out of the folder created event so that we could use the new EmsRefresh#refresh_new_target method, but I wasn't able to get anything useful so this will need more investigation.

Comment 4 Adam Grare 2017-02-27 21:47:35 UTC
The event does not have enough information to do anything useful (the only thing there is the parent folder's MOR)

However the VimBroker does send notifications about changes in inventory (create/update/delete) that come from the WaitForUpdates thread.  These notifications do have enough info (e.g.: Type and MOR) to create a basic folder record then kick a targeted refresh of that record similar to how RHV handles new VMs [0]

Getting the filter for the targeted refresh will be tricky given that a folder target could potentially result in every inventory object being included or none of them depending on where that folder is located.

[0] https://github.com/agrare/manageiq/blob/4a3a19d77fe0abfbaa7a799d51f97ef3f5be14d3/app/models/ems_refresh/vc_updates.rb#L353-L368

Comment 7 Adam Grare 2017-04-24 17:50:43 UTC
All PRs have been merged, now when a new folder is created we will only do a targeted refresh of the folder and not a full refresh.

Comment 8 Adam Grare 2017-04-24 18:05:25 UTC
Steps to test: (note this is best done on a VC without a lot of activity)
1. Add a VMware provider and let the first refresh finish
2. Open the VM & Template view on the CFME UI (/ems_infra/1?display=ems_folders&vat=true)
3. Create a folder using the vSphere client
4. Check the evm.log for the refresh target
MIQ(ManageIQ::Providers::Vmware::InfraManager::Refresher#refresh) EMS: [dev-vc65], id: [1] Refreshing targets for EMS...
MIQ(ManageIQ::Providers::Vmware::InfraManager::Refresher#refresh) EMS: [dev-vc65], id: [1]   EmsFolder [] id [10]

Note you should see EmsFolder as the target not Vmware::InfraManager

5. Refresh the VMs & Templates view and you should see the new folder in the correct place you created it in the vSphere client

Comment 12 Nandini Chandra 2017-10-27 17:03:05 UTC
Verified in 5.9.0.2