Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Jan 13, 2016

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