usage of InventoryStatus.DELETED

John Sanda jsanda at redhat.com
Mon Mar 14 15:30:02 UTC 2011


I have been investigating an issue in which a resource with an inventory 
status of DELETED was still accessible (in the CLI) with 
parentResource.getChildResources(). Then I Iearned that 
ResourceFactoryManagerBean.completeDeleteResourceRequest does not 
uninventory the deleted resource as I thought was the case. Instead, it 
just sets the inventory status of the resource to DELETED. It got me 
wondering what the purpose of DELETED is. I wondered why is it that we 
want to keep a deleted resource in inventory but take steps to make it 
appear as though it is no longer in inventory. The best I could come up 
with is that we do it for auditing purposes.

I was going to modify 
ResourceFactoryManagerBean.completeDeleteResourceRequest to uninventory 
the resource. One problem with that change that was pointed out to me is 
that the DeleteResourceHistory audit trail would be removed as part of 
the uninventory. Our audit trail would be gone because 
DeleteResourceHistory is linked to Resource.

I have noticed that a number of the audit trails, including 
DeleteResourceHistory, CreateResourceHistory, 
ResourceConfigurationUpdate, PluginConfigurationUpdate, 
BundleResourceDeploymentHistory and more, are linked to Resource. The 
problem with this is that when a resource is uninventoried we lose what 
could be valuable information in those audit trails. If a hard link was 
not maintained between the audit trails and Resource, the audit trails 
could outlive the corresponding Resource objects. And I wonder if 
InventoryStatus.DELETED would then even be needed.

I wanted to get some feedback on this for a couple reasons. First, it 
will help provide some better context for a bug I working on. Secondly, 
if these changes are feasible, we might be able to simplify some code 
where InventoryStatus.DELETED is currently used, and we will be able to 
provide more robust audit trails.

Thanks

-John


More information about the rhq-devel mailing list