Bug 1436132 - Some container resources not cleaned up after removal from Openshift - research
Summary: Some container resources not cleaned up after removal from Openshift - research
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: 5.8.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.9.0
Assignee: Bronagh Sorota
QA Contact: Einat Pacifici
URL:
Whiteboard: container
Depends On:
Blocks: 1469653 1472384
TreeView+ depends on / blocked
 
Reported: 2017-03-27 09:14 UTC by Mooli Tayer
Modified: 2018-06-05 11:36 UTC (History)
7 users (show)

Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1469653 1472384 (view as bug list)
Environment:
Last Closed: 2018-03-06 14:56:52 UTC
Category: ---
Cloudforms Team: Container Management
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Mooli Tayer 2017-03-27 09:14:57 UTC
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

Comment 2 zakiva 2017-05-17 16:24:10 UTC
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.

Comment 3 Federico Simoncelli 2017-05-17 16:54:55 UTC
This may be relevant: https://github.com/ManageIQ/manageiq/pull/14359

Comment 4 Mooli Tayer 2017-05-17 17:15:55 UTC
I believe we do change the children (at least in some cases) for example see ContainerDefinition.disconnect_inv.

Comment 5 zakiva 2017-05-17 18:36:45 UTC
(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).

Comment 6 Federico Simoncelli 2017-05-18 09:08:02 UTC
(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?

Comment 7 zakiva 2017-05-21 13:13:54 UTC
> 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.

Comment 9 Satoe Imaishi 2017-07-11 16:09:00 UTC
PR: https://github.com/ManageIQ/manageiq/pull/15182

Comment 11 Einat Pacifici 2017-11-30 12:59:03 UTC
Verified. Under full regression tests of Refresh functionality.


Note You need to log in before you can comment on or make changes to this bug.