We suspect that some resource types aren't being remove from ManageIQ inventory after removal from openshift[1] those might be types not listed in [2] although some should be removed through relations(i.e when their parent is removed). We need to check which are the ones that are not being removed and we should probably have a test for each type after that. [1] https://github.com/ManageIQ/manageiq/pull/14388#issuecomment-288576213 [2] https://github.com/ManageIQ/manageiq/blob/fbd5ebff98f75843644eb75684e6f6abdb8c276a/app/models/ems_refresh/save_inventory_container.rb#L5
I made some tests to check whether we remove the objects according to an updated inventory we get from Openshift. We have two options for removing objects: 1. Actually delete the object, i.e. remove it from the DB. We use this option for most of the Container resources. For these resources, after the object removed from openshift we remove it on our side including its children as expected. 2. Disconnect the object, i.e. mark the object as deleted, and remove its relations. However, the object will still remain in the DB. We use this option for several Container resources: Container, ContainerDefinition, ContainerGroup, ContianerProject, and ContainerImage. For these resources, after the object removed from openshift we mark it as deleted and do not change its children. I believe that it makes sense to keep also the children in the DB as they consist data on the object that may be relevant, e.g. in reports, etc. I would like to hear any thoughts on that.
This may be relevant: https://github.com/ManageIQ/manageiq/pull/14359
I believe we do change the children (at least in some cases) for example see ContainerDefinition.disconnect_inv.
(In reply to Mooli Tayer from comment #4) > I believe we do change the children (at least in some cases) for example see > ContainerDefinition.disconnect_inv. Yes, as I mentioned ContainerDefinition is one of the entities that we mark as deleted. So to be more clear: we do not change the children unless they are in the list of entities above (hopefully I didn't miss anything). For example, if a Pod is deleted on Openshift, we will mark both the Pod and its associated Containers and ContainerDefinitions as deleted. However, other children of the deleted pod will not be changed (e.g. its labels).
(In reply to Federico Simoncelli from comment #3) > This may be relevant: https://github.com/ManageIQ/manageiq/pull/14359 Sorry scratch that I assumed that it was on OpenShift provider removal. As mentioned from Einat, could bug 1451832 be an instance of this BZ?
> As mentioned from Einat, could bug 1451832 be an instance of this BZ? Yes, it seems related. I reproduced this issue and will send a fix soon.
PR: https://github.com/ManageIQ/manageiq/pull/15182
Verified. Under full regression tests of Refresh functionality.