Matthew Booth
2010-Oct-05 09:24 UTC
[Libguestfs] [FEBOOTSTRAP] 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. --- regressions/test-launch-race.pl | 60 ++++++++++++++++++++++ src/appliance.c | 105 ++++++++++++++++++++++++++++++++++----- 2 files changed, 152 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: 6605 bytes Desc: not available URL: <http://listman.redhat.com/archives/libguestfs/attachments/20101005/e63a3536/attachment.bin>
Matthew Booth
2010-Oct-05 09:28 UTC
[Libguestfs] [FEBOOTSTRAP] Ensure atomic creation of a cached appliance
On 05/10/10 10:24, Matthew Booth wrote:> > 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.I meant to add: This patch resolves RHBZ#639405 I've added this locally. Matt -- Matthew Booth, RHCA, RHCSS Red Hat Engineering, Virtualisation Team GPG ID: D33C3490 GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
Possibly Parallel Threads
- [PATCH 0/12] Add support for writing to hive files
- [PATCH febootstrap 0/2] febootstrap-supermin-helper should visit directory entries in order and ignore backup files
- [PATCH 0/2] Use link-local addresses when communicating between appliance and host (RHBZ#588763)
- [PATCH REBASED] Remove main loop
- [PATCH 0/3] 3 small code fixes