-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Add support for setting storage size on ZFS containers #21946
Conversation
Nice! This was in my list of improvements for ZFS. |
experimental is green; https://jenkins.dockerproject.org/job/Docker-PRs-experimental/17500/console
|
This would be easier to implement after merging #21139. |
we should have global quota(at the daemon level) and local quota(what this PR implements). |
@calavera @thaJeztah Hello. I haven't seen any movement on the pull request. Do you have any questions or comments? |
Design LGTM. I moved it to code-review so others can give feedback. |
name := d.zfsPath(id) | ||
quota, err := parseStorageOpt(storageOpt) |
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.
Should err
be checked here?
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.
Perhaps return early on error (also below), because there's now a lot of nested if's (but that's just a suggestion)
Looks ok to me, but I don't use zfs... apart from @thaJeztah's comment. |
ping @chosenken could you address my comment? Also don't forget to update the relevant documentation and man-pages, but let me know if you need hints for which ones need an update |
For reference: I also made a pull request for quotas for zfs in the past: #12520 I introduced a global flag for that, which can be run per container not global for the daemon. Maybe you can copy&paste the tests I made. |
b639e3c
to
c43ed33
Compare
@thaJeztah I've updated that section to return on error, thanks for the review! As for documentation, I think the details added in this commit b16decf#diff-505c72218d90da970c16fdbf0b4f613c should cover it. I'm using the same option from #19367. I'm also going to add tests for this, so I will update when I get them added. |
Now supports setting a containers storage size when using zfs as the storage engine. By passing in `--storage-opt size=<size>`, the created container's storage size will be limited to the given size. Note that the way zfs works, the given specified storage size will be given in addition to the base container size. Example: The node image reports a size of `671M` from `df -h` when started. Setting `--storage-opt size=2G` will result in a drive the size of `671M` + `2G`, `2.7G` in total. Available space will be `2.0G`. The storage size is achieved by setting the zfs option `quota` to the given size on the zfs volume. Signed-off-by: Ken Herner <[email protected]>
Signed-off-by: Ken Herner <[email protected]>
Signed-off-by: Ken Herner <[email protected]>
c43ed33
to
04b4e3e
Compare
LGTM. It looks like there is a flaky test:
|
LGTM |
Hello, does this work only with containers? Because if I follow the docs from here: https://docs.docker.com/engine/userguide/storagedriver/zfs-driver/#configure-docker-with-the-zfs-storage-driver I just get this error #33847 |
cherry-pick from: moby#21946 we need this pr to solve the conflicts when cherry-picking overlay2. Signed-off-by: Ken Herner <[email protected]> Signed-off-by: Lei Jitang <[email protected]> (cherry picked from commit 04b4e3e)
- What I did
Added support for for the
--storage-opt
CLI flag to ZFS. Users can specify a container's block device size by passing size (--storage-opt size=2G
). Built off of pull request #19367- How I did it
When creating or cloning a ZFS volume, check storage options for the key
size
. If it is provided, set the ZFS propertyquota
to the given value on the new ZFS filesystem. If size is not specified, do not setquota
.- How to verify it
Have docker engine setup with ZFS as the storage driver. Pull an image and run it with the
--storage-opts size=<size>
flag. Rundf -h
to view attached volumes sizes. TheAvail
space on the root device should be the size specified.Note: Due to the way docker utilizes ZFS, the newly created ZFS volume will be from a read-only snapshot of the docker image. Therefore setting the
quota
on the new volume will make the available space the size of the quota as it is applied to the new volume and not parent volumes.- A picture of a cute animal
This is my first pull request to Docker, and I welcome all comments and suggestions!
Signed-off-by: Ken Herner [email protected]