-
Notifications
You must be signed in to change notification settings - Fork 2
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
Rewrite volume storage, refactor some of the old code #16
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Wrote a doc for which directories exist for volumes and how they are supposed to be managed. It will be used for storage implementation (#7)
The plugin now determines the active mounts for a volume (not overlay) using the activemounts/ subdirectory corresponding to the volume. It resolves the race condition problem with parallel mounts/unmounts on the same volume. Gets us closer to fixing #15! However, not there yet, as we are still using go's `map`, which is thread-unsafe.
- Removed the `volumes` field of `Driver`, instead introduced the metadata.json per-volume internal file, which currently stores the base directory path and the volatility. - Rewrote the methods that used the in-memory volume storage to use the filesystem instead. - Renamed dotBaseDir to `dotRootDir` and turned it into a field of `Driver`. Fixes #7. As far as I can see, fixes #15! The code is starting to get bulky, probably, restructuring is needed...
A large refactoring! Created several files and restructured the code between them, renamed a couple of entities, wrote documentation for some non-trivial functions/methods. Also fixed a few minor bugs: - A file descriptor leak in `lockedFile.Open` if an error occurs in `syscall.Flock` - An error returned on every unmount, even when no actual error occurred
When creating a `DockerOnTop` object, go through the existing volumes with some sort of a health check: if an overlay is mounted for the volume, do nothing with it, otherwise ensure the active mounts and the workdir/ directory are clean - this protects from a case when the machine is rebooted without giving the docker daemon enough time to properly clean up.
kolayne
commented
Jun 4, 2023
When starting, the plugin now checks for each volume whether its state is clean, dirty but overlay-unmounted, or overlay-mounted. Info logs describe all the detected volumes, a detailed warning log message is issued if there's at least one overlay-mounted volume to explain which consequences it might have.
kolayne
force-pushed
the
preserve-volumes-list
branch
2 times, most recently
from
June 4, 2023 19:26
2a10633
to
4c9d685
Compare
kolayne
commented
Jun 5, 2023
kolayne
force-pushed
the
preserve-volumes-list
branch
4 times, most recently
from
June 5, 2023 08:40
adf7120
to
a408086
Compare
Fixed some docs/comments, variables names, log messages, code style issues
kolayne
commented
Jun 5, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The following features are introduced by this PR:
NewDockerOnTop
) all the volumes and their metadata is accessed in a thread-safe manner, synchronized via filesystem access (there's a new requirement: the/var/lib/docker-on-top/
is located on a filesystem that supports theflock
system call) (fixes Thread-safety! #15)