Bug 812925
Summary: | Server should filter out deleted resources when sending resource tree to agent during inventory sync | ||||||
---|---|---|---|---|---|---|---|
Product: | [Other] RHQ Project | Reporter: | John Sanda <jsanda> | ||||
Component: | Core Server | Assignee: | Nobody <nobody> | ||||
Status: | ON_QA --- | QA Contact: | |||||
Severity: | urgent | Docs Contact: | |||||
Priority: | high | ||||||
Version: | 4.5, JON 3.1.1 | CC: | hrupp, loleary | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | |||||||
: | 813080 (view as bug list) | Environment: | |||||
Last Closed: | 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: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 782579, 813080, 813083 | ||||||
Attachments: |
|
Description
John Sanda
2012-04-16 15:14:17 UTC
This needs further review: -what are the concrete user facing results of this issue -what are the risks around changing the current behaviour, how complex is the fix? After further investigation, this issue is more severe than I initially thought. It manifests itself in InventoryManager.initialize when the plugin container initializes. The method InventoryManager.mergeUnknownResources is where the call to the server is made to fetch the resource tree (where the DELETED resource(s) are also fetched). That method gets called during initialization from the call to activateAndUpgradeResources around line 232-ish. The initialization of the discovery and availability jobs does not occur until after the call to activateAndUpgradeResources. The net effect is that this bug prevents InventoryManager from fully initializing which in turn prevents availability and discovery scans from running. The fix is pretty straightforward. ResourceManagerBean.getResourceTree should be updated to filter out resources with an inventory status of DELETED. The only caller of this method is the PC/InventoryManager via DiscoveryServerServiceImpl.getResources; so, the scope of the change is narrow. getResourceTree is not part of the remote APIs. The overall risk is low in my opinion since the issue can easily be reproduced and is easily testable. This needs to sets of eyes on it before doing a fix. I'm just paranoid about things which impact InventoryManager :-) I wonder how a DELETED resource ended up in the list of resources processed by mergeUnknownResources(). The synchInventory() method (which is the only caller of mergeUnknownResources()) sorts out the resources into several buckets prior to calling handlers of these "resource buckets" (one of which is the mergeUnknownResources() method). The method that sorts out the resources is called processSyncInfo() and it puts any resource with the status DELETED into a different bucket than the one handled using mergeUnknownResources(). I have updated the code to filter out DELETED resources in the resource tree sent to the agent. master commit hash: 997263c268dac476fbdf6b6e76cb0988b69a9748 Lukas, the problem is that in mergeUnknownResources we have, Set<Resource> unknownResources = Configuration.getServerServices().getDiscoveryServerService().getResources(unknownResourceIds, true); getResources delegates to ResourceManagerBean.getResourceTree which does not filter out DELETED resources. After that server call returns InventoryManager iterates over each resource calling merge which effectively adds it to the local inventory. Created attachment 577818 [details]
CLI script to uninventory deleted resources
|