Bug 1306602

Summary: Uninventory of resource leaves orphaned content data in the database
Product: [JBoss] JBoss Operations Network Reporter: bkramer <bkramer>
Component: ContentAssignee: Ruben Vargas Palma <rvargasp>
Status: CLOSED ERRATA QA Contact: Filip Brychta <fbrychta>
Severity: high Docs Contact:
Priority: high    
Version: JON 3.3.5CC: bkramer, fbrychta, loleary, rvargasp, spinder
Target Milestone: ER01Keywords: Triaged
Target Release: JON 3.3.6   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 15:32:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1306605    
Bug Blocks: 1381720    
Attachments:
Description Flags
Archive file that contains first_deployment.zip, second_deployment.zip, third_deployment.zip and undeployed_war.zip archives
none
Screenshot - removed_war.png none

Description bkramer 2016-02-11 12:17:05 UTC
Created attachment 1123135 [details]
Archive file that contains first_deployment.zip, second_deployment.zip, third_deployment.zip and undeployed_war.zip archives

Description of problem:
Undeployment of the resource leaves all previously deployed package versions in the database. In a long run, this will fill up the database.

We should remove all content data from the database once relevant resource is undeployed. 


Version-Release number of selected component (if applicable):
JBoss ON 3.3.5

How reproducible:
Always

Steps to Reproduce:

1. Deployed memoryleak.war file with package version 1.0 to the EAP server (JBoss ON UI -> Inventory -> Servers -> EAP -> Inventory -> Create Child -> Deployment) see attached screen shots - first_deployment.zip;
2. Deployed memoryleak.war file with package version 2.0 to the EAP server (JBoss ON UI -> Inventory -> Servers -> EAP -> Inventory -> Create Child -> Deployment) see attached screen shots - second_deployment.zip;
3. Deployed memoryleak.war file with package version 3.0 to the EAP server (JBoss ON UI -> Inventory -> Servers -> EAP -> Inventory -> Create Child -> Deployment) see attached screen shots - third_deployment.zip;

****** rhq_resource contains one "memoryleak.war" record, rhq_package_version - 4 records and rhq_package_bits - 3.

4. Undeployed memoryleak.war resource (JBoss ON UI -> Inventory -> Servers -> EAP -> Inventory -> select "memoryleak.war" resource -> press "Uninventory" button) - as a result rhq_resource table did not contain "memoryleak.war" but rhq_package_version and rhq_package_bits still contained previously deployed content - see undeployed_war.zip



Actual results:
Selected resource was properly deleted (rhq_resource does not contain deleted resource) but rhq_package_version and rhq_package_bits tables still contained all previously deployed content data (undeployed_war.zip)

Expected results:
When resource is undeployed - all its history should be deleted from the database including content data.


Additional info:

Comment 1 Larry O'Leary 2016-02-11 14:02:49 UTC
> 4. Undeployed memoryleak.war resource (JBoss ON UI -> Inventory -> Servers -> EAP -> Inventory -> select "memoryleak.war" resource -> press "Uninventory" button) - as a result rhq_resource table did not contain "memoryleak.war" but rhq_package_version and rhq_package_bits still contained previously deployed content - see undeployed_war.zip

I think "undeploy" can make this confusing. For clarity, the procedure done in step 4. DOES NOT "undeploy" the WAR. It only removes the resource from inventory. If the WAR is still deployed to the EAP server, it will get rediscovered.

To confirm that this is an actual bug, please remove the WAR from the EAP server -- without using JBoss ON -- before step 4.

Comment 2 bkramer 2016-02-11 14:33:05 UTC
(In reply to Larry O'Leary from comment #1)
> > 4. Undeployed memoryleak.war resource (JBoss ON UI -> Inventory -> Servers -> EAP -> Inventory -> select "memoryleak.war" resource -> press "Uninventory" button) - as a result rhq_resource table did not contain "memoryleak.war" but rhq_package_version and rhq_package_bits still contained previously deployed content - see undeployed_war.zip
> 
> I think "undeploy" can make this confusing. For clarity, the procedure done
> in step 4. DOES NOT "undeploy" the WAR. It only removes the resource from
> inventory. If the WAR is still deployed to the EAP server, it will get
> rediscovered.
> 
> To confirm that this is an actual bug, please remove the WAR from the EAP
> server -- without using JBoss ON -- before step 4.

Larry, my mistake - I did remove war file from EAP first (using EAP Management Console), and then uninventoried it from JBoss ON UI. I just forgot to mention that. 

So, this is what I did:

***********************
1. Deployed memoryleak.war file with package version 1.0 to the EAP server (JBoss ON UI -> Inventory -> Servers -> EAP -> Inventory -> Create Child -> Deployment) see attached screen shots - first_deployment.zip;

2. Deployed memoryleak.war file with package version 2.0 to the EAP server (JBoss ON UI -> Inventory -> Servers -> EAP -> Inventory -> Create Child -> Deployment) see attached screen shots - second_deployment.zip;

3. Deployed memoryleak.war file with package version 3.0 to the EAP server (JBoss ON UI -> Inventory -> Servers -> EAP -> Inventory -> Create Child -> Deployment) see attached screen shots - third_deployment.zip;

4. Navigated to EAP management console -> Deployments ->  selected "memoryleak.war" deployment -> click "Remove" button -see attached removed_war.png;

5. Undeployed memoryleak.war resource (JBoss ON UI -> Inventory -> Servers -> EAP -> Inventory -> select "memoryleak.war" resource -> press "Uninventory" button) - as a result rhq_resource table did not contain "memoryleak.war" but rhq_package_version and rhq_package_bits still contained previously deployed content - see undeployed_war.zip
***********************

Comment 3 bkramer 2016-02-11 14:33:55 UTC
Created attachment 1123165 [details]
Screenshot - removed_war.png

Comment 6 Ruben Vargas Palma 2016-06-23 13:41:44 UTC
commit d94e18d1be7b23ed001a3e106bd5051e68f3685f
Merge: bfbc8f3 2f8a95a
Author: Michael Burman <yak>
Date:   Tue Jun 21 15:22:24 2016 +0300

    Merge pull request #247 from rubenvp8510/Bug/1306602
    
    Bug 1306602 - Uninventory of resource leaves orphaned content data in…


commit 2f8a95aceef6ae316be0a574e94616b6daf77587                                                                                                                                                                                              
Author: Ruben Vargas <rvargasp>                                                                                                                                                                                                   
Date:   Thu Apr 28 23:14:57 2016 -0500                                                                                                                                                                                                       
                                                                                                                                                                                                                                             
    Bug 1306602 - Uninventory of resource leaves orphaned content data in the database

Comment 8 Simeon Pinder 2016-07-07 08:22:39 UTC
Moving to ON_QA as available to test with the following build:
https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=502442

Note: 	jon-server-patch-3.3.0.GA.zip maps to JON 3.3.6(jon-server-3.3.0.GA-update-06.zip)

Comment 10 errata-xmlrpc 2016-07-27 15:32:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-1519.html