Bug 639405

Summary: Interrupted cached appliance creation leaves libguestfs unusable
Product: [Community] Virtualization Tools Reporter: Matthew Booth <mbooth>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedCC: mbooth, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-15 09:55:37 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:

Description Matthew Booth 2010-10-01 16:36:39 UTC
Description of problem:
* A user interrupts guestfs_launch() with Ctrl-C while
  febootstrap-supermin-helper is in the process of creating a new cached appliance
* The cache now contains a corrupt appliance
* The user runs guestfs_launch() again some time later.
* libguestfs doesn't detect the corrupt appliance and fails to launch.

The only way to recover from this situation is for the user to manually delete the cache directory.

Suggested pseudo code:

check for /tmp/<checksum>
if it exists, use it

create /tmp/<checksum>.XXXXXX
create appliance in temp directory
rename /tmp/<checksum>.XXXXXX to /tmp/<checksum>

if rename failed, check for existence of /tmp/<checksum> (again)
if it exists, use it
exit with an error about rename

This would have the added advantage of fixing a race condition where 2 instances of libguestfs are simultaneously creating a new appliance cache for the same user.

Version-Release number of selected component (if applicable):
1.5.20

Comment 1 Richard W.M. Jones 2010-10-28 19:42:40 UTC
Your fix has been included in libguestfs 1.5.25:
http://git.annexia.org/?p=libguestfs.git;a=shortlog;h=1.5.25
and in febootstrap 2.10:
http://git.annexia.org/?p=febootstrap.git;a=shortlog;h=2.10

Can you confirm that these completely fix the problem as
described above?

Comment 2 Richard W.M. Jones 2011-07-14 19:17:25 UTC
Ping?

Comment 3 Matthew Booth 2011-07-15 08:53:08 UTC
Yes, it fixed the above problem.

Comment 4 Richard W.M. Jones 2011-07-15 09:55:37 UTC
Thanks!  Closing as per comment 3.