Matthew Booth
2010-Oct-04 12:18 UTC
[Libguestfs] [REVIEW ONLY] Ensure atomic creation of a cached appliance
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. Note that this version of the patch doesn't cleanup the temporary directory of a guestfs process which didn't win an appliance creation race. --- regressions/test-launch-race.pl | 53 +++++++++++++++++++++++++++++++++++++++ src/appliance.c | 49 ++++++++++++++++++++++++++--------- 2 files changed, 89 insertions(+), 13 deletions(-) create mode 100755 regressions/test-launch-race.pl -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Ensure-atomic-creation-of-a-cached-appliance.patch Type: text/x-patch Size: 4817 bytes Desc: not available URL: <http://listman.redhat.com/archives/libguestfs/attachments/20101004/59d6e0a0/attachment.bin>
Reasonably Related Threads
- [FEBOOTSTRAP] Ensure atomic creation of a cached appliance
- [PATCH v2] Improve fixed appliance documentation
- Re: [PATCH] appliance: reorder the steps to search for appliance
- [PATCH v3] Improve fixed appliance documentation
- Re: [PATCH v1 1/2] appliance: search all types of appliances for each path separately