Skip to content

Boxes: Use temporary lock file to prevent early unregister#244

Merged
legal90 merged 4 commits intoParallels:masterfrom
legal90:fix-243
Jan 13, 2016
Merged

Boxes: Use temporary lock file to prevent early unregister#244
legal90 merged 4 commits intoParallels:masterfrom
legal90:fix-243

Conversation

@legal90
Copy link
Collaborator

@legal90 legal90 commented Jan 12, 2016

Fixes GH-243

In parallel run of multi-machine environment the same box image could be cloning
simultaneously by more then one envs. But the box should be unregister exactly by the last env.

To prevent a race condition here, we add a temporary lease file with a counter.
It is incremented for incoming envs (new clones) and decremented right after the cloning.
The last env removes the lock file and unregisters the box.

cc: @racktear @Gray-Wind @Kasen

Following the RFC 4122, there should not be any brackets in UUID string
…race

In parallel run of multi-machine environment the same box image could be cloning
simultaneously by more then one envs. So, the box should be unregister by the latest env.

To prevent a race condition here, we add a temporary lease file with a counter.
It is incremented for incoming envs (new clones) and decremented after the cloning.
The last env removes the lock file and unregisters the box.

Fixes ParallelsGH-243
It guarantees that counter is written on the disk and IO buffer is flushed.
legal90 added a commit that referenced this pull request Jan 13, 2016
Boxes: Use temporary lock file to prevent early unregister
@legal90 legal90 merged commit 1136333 into Parallels:master Jan 13, 2016
@legal90 legal90 deleted the fix-243 branch January 13, 2016 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant