Add vfs quota support#35231
Conversation
8a32b5e to
5b2a9d2
Compare
|
what motivates you to use vfs? |
|
@AkihiroSuda "It just works" (mostly). My containers run from 2 minutes to 2 months. The median runtime of my containers is 4-5 minutes. Setting up VFS, with the improvements that come from #34670 has an unoptimized mean time of ~45s for copying ubuntu:latest. We can optimize that down to <10s. If I can optimize these times, it prevents any potential hiccups from occurring at runtime, versus startup time. Never having to worry about overlayfs, or such, there's some appeal there. |
|
@dmcgowan We discussed this change earlier. |
There was a problem hiding this comment.
nit: can you remove this blank line?
|
/cc @kolyshkin as well |
5b2a9d2 to
d348809
Compare
|
Rebased. |
b37e83e to
e85698e
Compare
|
This should be ready to go in. |
There was a problem hiding this comment.
Perhaps it makes sense to rename "zfsTest" to drivername + "Test" as it's no longer zfs-specific. Or just "quotaTest"...
There was a problem hiding this comment.
- Looks like you're missing a line here? Something like
+ err = writeRandomFile(path.Join(mountPath.Path(), "file"), quota*2)- Since you have already exhausted half the quota by doing a write above, you might either go with a smaller value than
quota*2, or remove the file written above.
There was a problem hiding this comment.
Perhaps you want to print pathError.Err here, not err, as this is what you use in comparisons?
There was a problem hiding this comment.
I think this can be done in a simple manner, without an extra bool field. The idea is to add isQuotaSupported() method. In quota_linux.go, it is just return driver.quotaCtl != nil, in quota_unsupported.go, return false straight away. To my mind, it will be cleaner/simpler.
e85698e to
1dc0690
Compare
|
Updated based on review. |
There was a problem hiding this comment.
Panic seems a little harsh here. Can we just return a not supported error?
There was a problem hiding this comment.
This should never be called. If this is called, it means something has gone wrong, or the code was changed in an unexpected way.
1dc0690 to
2cbdc8c
Compare
|
ping @cpuguy83 |
There was a problem hiding this comment.
this comment isn't right, we have written a file of half quota at this point?
2cbdc8c to
ca5e654
Compare
There was a problem hiding this comment.
Can we make sure this error implements one of api/errdefs?
There was a problem hiding this comment.
Which one do you think it should be?
ca5e654 to
1fa28b0
Compare
1fa28b0 to
5eb1c11
Compare
This patch adds the capability for the VFS graphdriver to use XFS project quotas. It reuses the existing quota management code that was created by overlay2 on XFS. It doesn't rely on a filesystem whitelist, but instead the quota-capability detection code. Signed-off-by: Sargun Dhillon <[email protected]>
5eb1c11 to
7a1618c
Compare
|
@cpuguy83 Anything else? |
- What I did
Added project quota support to the VFS graphdriver, and tests to ensure they work.
It relies on #35177, which adds the quota detection mechanism, and a form error to determine whether to short-circuit quota-related code (or not).
It addresses this issue: #34702
- How I did it
I reused the project quota code that came from overlay2. On initialization time, the VFS driver (on Linux) detects if quota is supported. If quota is supported, then it enables the MaxSize option, so new containers can be created with an assigned project quota.
- How to verify it
There are tests as part of the changeset. If you run the tests when your
TMPDIRenvironment variable points to an XFS mount mounted withprjquotaoption, the quota check will run automatically, otherwise, it'll be skipped.- Description for the changelog
Add project quota support to VFS graphdriver