InventoryManager change?

Michael Neale michael.neale at gmail.com
Tue Oct 19 00:22:47 UTC 2010


Hi all.
On suggestion of heiko - I am posting here about a possible patch to
InventoryManager - but not sure if it is a good idea.

Adrian Brock and I have been using RHQ - lots of deployments/undeployments
etc..:


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?

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, Resource
parent) throws PluginContainerException {
        // If the Resource is already in inventory, make sure its version is
up-to-date, then simply return the
        // existing Resource.
        Resource existingResource = findMatchingChildResource(resource,
parent);
        if (existingResource != null) {
            updateResourceVersion(existingResource, resource.getVersion());

+          // proposed fix - make sure merged resources go back to committed
+          existingResource.setInventoryStatus(InventoryStatus.COMMITTED);

            return existingResource;
        }

        // Auto-generate id and auto-commit if embedded within JBossAS.
        if (!this.configuration.isInsideAgent()) {
            resource.setId(this.temporaryKeyIndex.decrementAndGet());
            resource.setInventoryStatus(InventoryStatus.COMMITTED);

This matches what used to be done in the old
ResourceFactoryManagerBean.createInventoryResource()
until that code was orphaned.

Does this make sense at all?

-- 
Michael D Neale
home: www.michaelneale.net
blog: michaelneale.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://fedorahosted.org/pipermail/rhq-devel/attachments/20101019/bfc55489/attachment.html 


More information about the rhq-devel mailing list