JBoss Community Archive (Read Only)

RHQ 4.9

Server-to-Agent Sync


Most of the Agent-initiated sync code is new post-RHQ 1.0.1.


Every time the PC sends an inventory report to the Server (InventoryManager.handleReport()), the Server (DiscoveryBossBean.mergeInventoryReport) merges the report into its inventory and then returns a summary of its entire inventory for that Agent. The summary is a tree of ResourceSyncInfo objects, which are stripped-down representations of Resources that contain only the id, uuid, mtime, and inventoryStatus fields.

The PC then compares the Server inventory summary to its local inventory and classifies each Resource represented in the summary into one of four categories (InventoryManager.processSyncInfo()):

1) synced (PC id == server id) - nothing to do here
2) just reported (PC id == 0) - needs to be synced
3) modified (server mtime newer)
4) unknown (not in PC inventory) - this will commonly occur when inventory.dat was deleted

For 2), the PC flips the id, mtime, and status on its local Resource to match the Server (InventoryManager.processSyncInfo(): if (resource.getId() == 0) block). No additional requests to the Server are required to do this, since the id, mtime, and status are all contained in the ResourceSyncInfo object.
For 3), the PC (InventoryManager.mergeModifiedResources()) asks the Server (DiscoveryServerServiceImpl.getResources()) for the full Resources and then updates the corresponding local Resources (see
For 4), the PC (see InventoryManager.mergeUnknownResources()) asks the Server (DiscoveryServerServiceImpl.getResources()) for the full Resources as well as their descendants and then adds the Resources to the local inventory

NOTE: For 3) and 4), the Server converts the Hibernate-proxy Resources to POJO Resources, so it can send them over the wire without populating all parent fields and not get LazyInstantiationExceptions.

Finally, the PC purges any Resources in local inventory that were not represented in the inventory summary from the Server and whose id != 0 (InventoryManager.purgeObsoleteResources()).


Statuses and Schedules

Imports, Ignores, and Unignores

When a user imports, ignores, or unignores Resources via the autodiscovery portlet, the GUI layer (ProcessQueueAction for the AI portlet or AutoDiscoveryQueueUIBean for the AI details page) calls DiscoveryBossBean.updateInventoryStatus(), which in turn remotely calls InventoryManager.synchronizeInventory(), once for modified platforms, then again for modified servers (that are not children of the modified platforms). This tells the PC it needs to sync the inventory statuses (with the server) on the specified platforms/servers and their ancestors. Newly imported/committed resources will have their measurement schedules and alert templates synced. A service scan is then kicked off on the synced platform/server. NOTE: InventoryManager.synchronizeInventory() is an async call.

Manual Adds

When a user manually adds a Resource, the Server remotely calls InventoryManager.manuallyAddResource(), which does the adds the specified Resource to PC inventory, makes a remote call to tell the Server to add the Resource to its inventory, and finally InventoryManager.synchronizeInventory() is called which sends requests to the Server for the current status and schedules for the newly added Resource in order to sync up the corresponding local Resource.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 07:59:28 UTC, last content change 2013-09-18 19:41:27 UTC.