Bug 604840

Summary: cannot create bundle after initially cancelling it
Product: [Other] RHQ Project Reporter: John Mazzitelli <mazz>
Component: ProvisioningAssignee: Jay Shaughnessy <jshaughn>
Status: CLOSED CURRENTRELEASE QA Contact: Sunil Kondkar <skondkar>
Severity: medium Docs Contact:
Priority: urgent    
Version: 3.0.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: 2.4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-12 16:50:26 UTC Type: ---
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:    
Bug Blocks: 577210    
Attachments:
Description Flags
create-bundle-error.txt none

Description John Mazzitelli 2010-06-16 20:10:32 UTC
Created attachment 424575 [details]
create-bundle-error.txt

Description of problem:

If you upload a bundle distribution file, and before finishing the Create Wizard, you cancel it, then try to upload the bundle distribution file again, you get an exception.

Steps to Reproduce:
1. Create a New bundle, upload a bundle distribution file, then step through the Create Wizard stopping at the final "Summary" step page.
2. At the final Summary step, click the cancel button (do NOT click finish; just cancel button)
3. Repeat step 1 with the same bundle distro file
4. At the final Summary step, click the "Finish" button (do NOT cancel)
  
Actual results:

You get an error in the message panel saying it failed to create the bundle. See the attached stack trace for the actual error.

Expected results:

It should have created the bundle properly.

Comment 1 John Mazzitelli 2010-06-18 13:45:58 UTC
I think this has to do with our "bundle delete" code. We need to make sure we clean up everything on a delete.

Comment 2 Jay Shaughnessy 2010-06-21 21:03:19 UTC
I have not been able to reproduce this, maybe something else is going on in order to get this to happen.

Comment 3 John Mazzitelli 2010-06-23 12:29:25 UTC
I just got this again. Before doing the replication steps described here, upload another bundle distribution file. Once you get a bundle distro file in the DB, then do the steps here. For example, I have two bundle distro files:

bundle-test v1.0
bundle-test v2.0

I uploaded the v1.0 successfully.  Then I went through the create wizard with v2.0 but canceled at the end. I then uploaded v2.0 again, but this time I did not cancel.

Comment 4 Jay Shaughnessy 2010-06-23 20:47:30 UTC
fix commit: e71e170a064a93f981f0e8d773a28bccb2897484

The problem here is that we did neither of the following:

1) when removing a BundleVersion remove the PackageVersions for its BundleFiles.

2) when creating a BundleVersion reuse a PackageVersion if it was already there.

So, PackageVersions for a Bundle were only removed if the Bundle itself was deleted.

To solve the problem we now do (1).  We now cascade remove (via Hibernate) the PV when the BundleFile is removed. 

This works because we always create a new PV for a BV's BundleFiles.  The PV is versioned after the BV. If in the future we decide to reuse a PV if it is physically the same file used by multiple BVs, or possibly refer to PVs outside of the Bundle's own repo, then this strategy will need to be updated.

Comment 5 Sunil Kondkar 2010-06-25 11:00:12 UTC
Verified on JON 2.4 GA_QA build#42

Uploaded 1st version of a bundle distribution file. Went through the create wizard with 2nd version and canceled at the summary page. I then uploaded v2.0 again and clicked 'Finish' button on summary page. The 2nd version is uploaded successfully.
No exception is observed.

Comment 6 Corey Welton 2010-08-12 16:50:26 UTC
Mass-closure of verified bugs against JON.