[Libguestfs] [PATCH 4/4] Ensure atomic creation of a cached appliance

Matthew Booth mbooth at redhat.com
Thu Oct 28 14:19:14 UTC 2010


Cached appliances are discovered by their predictable path. Previously we were
creating a cached appliance directly in this predictable path. This had at least
2 undesirable effects:

* Interrupting appliance creation would leave a corrupt appliance
* 2 processes could simultaneously attempt to create the same appliance, causing
  corruption.

This patch causes the cached appliance to be created in a temporary directory,
and then renamed to the predictable path. As rename is an atomic operation, this
makes the whole creation atomic.

This patch also changes the predictable path to have a prefix of 'guestfs.'.
This will make it simpler for system administrators to clean up old cached
appliances.

This patch resolves RHBZ#639405
---
 po/POTFILES.in                  |    1 +
 regressions/test-launch-race.pl |   60 ++++++++++++++++++++++
 src/appliance.c                 |  105 ++++++++++++++++++++++++++++++++++-----
 3 files changed, 153 insertions(+), 13 deletions(-)
 create mode 100755 regressions/test-launch-race.pl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Ensure-atomic-creation-of-a-cached-appliance.patch
Type: text/x-patch
Size: 6975 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20101028/6647d8aa/attachment.bin>


More information about the Libguestfs mailing list