|
|
|
Another angle is that of automated updates of the agents. In this scenario the inventory should be maintained as well. Certainly an advantage of synching an agent from the server is that it releases us from worrying about changes to agent-side representations.
I just tried the copy over of the data dir and it worked well.
Note that I did $ cd $AGENT $ mkdir data $ cd data $ cp -r .././../old-rhq-agent/data/* . This also copied some commandspool.data and JBossAS/ directory Fixed - r1076.
Every time an inventory report is sent to the Server, the Server now returns a summary of its inventory for that Agent. The PC then compares that report to its local inventory and classifies each Resource in the report into one of four categories: 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. For 3), the PC asks the Server for the full Resources and then updates the corresponding local Resources For 4), the PC asks the Server for the full Resources as well as their descendants and then adds the Resources to the local inventory Finally, the PC purges any Resources in local inventory that were not represented in the inventory summary from the Server and whose id != 0. Verified on build rev1304, was able to manually add a resource, then restart the agent clean (wiping out the inv dat file) and it resynced the manual resources and they stayed green in the server's inv.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
private void mergeStatuses(Map<Integer, InventoryStatus> statuses) {
for (Integer id : statuses.keySet()) {
InventoryStatus statusFromServer = statuses.get(id);
ResourceContainer container = getResourceContainer(id);
if (container == null) {
// TODO GH: Insert new resource and start it up
} else {
Resource localResource = container.getResource();
...