InventoryManager change?

John Mazzitelli mazz at redhat.com
Tue Oct 19 12:51:31 UTC 2010


> If you deploy UserDS-ds.xml then delete it (undeploy it).
> Then try to redeploy it, the inventory status stays at "DELETED" rather
> than going back to "COMMITTED".

> Running a full, manual, detailed discovery on the platform will fix the
> problem. So that might have to be our be our workaround until we can get a fix?

Yeah, that does sound like a workaround. You can do that in one of 
several ways:

1) use the "inventory" agent prompt command
2) from the GUI (or CLI) invoke the "manual discovery" operation on the 
platform resource
3) resource the plugin container or the agent itself

> I think Ive tracked the problem down to the InventoryManager, it is
> basically missing setting the inventory status when it already has
 > the resource, but it is not in the state COMMITTED.
>
>    public Resource mergeResourceFromDiscovery(Resource resource,
...
> +          // proposed fix - make sure merged resources go back to committed
> +          existingResource.setInventoryStatus(InventoryStatus.COMMITTED);
...
> Does this make sense at all?

This seems to make sense. However, I question blindly setting the status 
to COMMITTED. I'm thinking it might also be possible that the existing 
resource could be appropriately be in the NEW state - and in that case, 
setting it to COMMITTED here might be wrong.

That's just a theory - I can't say for sure if, at this point in the 
code, the resource could be in any other state other than COMMITTED. We 
may need to put some kind of conditional around this, say something like:

if (existingResource.getInventoryStatus() == InventoryStatus.DELETED) {
    existingResource.setInventoryStatus(InventoryStatus.COMMITTED)
}

I'm assuming you stepped through this in a debugger - what state was the 
existingResource in at that point in this mergeResourceFromDiscovery method?


More information about the rhq-devel mailing list