History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: RHQ-614
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Ian Springer
Reporter: Jay Shaughnessy
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
RHQ Project

Manually added resources lost from agent inventory during upgrade

Created: 20/Jun/08 10:18 AM   Updated: 04/Sep/08 10:27 AM
Component/s: FX - Inventory
Affects Version/s: 1.0.1
Fix Version/s: 1.1

Time Tracking:
Not Specified

Environment: Vista server, Linux agent
Issue Links:
Relation
 

Resolution Date: 10/Jul/08 09:49 AM
Date of First Response: 20/Jun/08 10:37 AM
Tester: Jeff Weiss
VCS Revision: 1,076


 Description  « Hide
Postgres server not auto-discovered on linux, which is typical due to the fact that it runs under a different account and/or with non-default login creds.

I manually added the postgres server with my 2.0.0.GA agent. It showed up fine in the server and I was able to execute operations etc.

After upgrade the Linux agent performs auto-discovery. Manually added resources, and, I suspect, any resources that could be auto-discovered, but are down, will not be in the new agent inventory. But, they will be in the inventory listed in the DB. In this scenario the resources known for an agent on the server need to be synched with the agent. This is equivalent to moving the old agent's inventory to the new agent. This should be able to be done by migrating the old inventory.dat to the new agent, prior to startup.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Ian Springer - 20/Jun/08 10:37 AM
Note, copying over the old inventory.dat is really only a workaround for this. The real fix is to sync Resources that exist on the Server but not the Agent down to the Agent. Note, there is a TODO from Greg for this functionality in InventoryManager.mergeStatuses() . Here's a snippet:

    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();
                ...

Jay Shaughnessy - 20/Jun/08 10:56 AM
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.

Heiko W. Rupp - 23/Jun/08 07:23 AM
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


Ian Springer - 10/Jul/08 09:49 AM
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.

Jeff Weiss - 04/Sep/08 10:27 AM
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.