fix(quota): apply XFS/EXT4 project quota via host mount namespace - #357
fix(quota): apply XFS/EXT4 project quota via host mount namespace#357fourhu wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes XFS/EXT4 project quota application failures caused by running quota tools in a pod mount namespace by generating scripts that nsenter into the host mount namespace and consistently use host-visible paths, while keeping a container-visible path for lockfiles.
Changes:
- Update quota script generation to run filesystem/quota tools via a
host_exec()wrapper that enters the host mount namespace whenHostPathPrefixis set. - Split host paths vs container-visible paths (
PARENT_PATH/VOLUME_PATHvsCONTAINER_PARENT_PATH) so quota tools operate on host mounts whileflockstill uses a container-accessible lockfile path. - Update HelperPod behavior to mount the host root at
/hostand add unit tests covering nsenter usage and host-path semantics.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cmd/provisioner-localpv/app/quota_scripts.go | Adds host-namespace execution wrapper and separates host vs container-visible paths for quota ops and locking. |
| cmd/provisioner-localpv/app/quota_scripts_test.go | Adds/updates tests to assert nsenter usage, host-path assignments, and correct lockfile path behavior. |
| cmd/provisioner-localpv/app/local_volume_manager.go | Updates comments/usage to reflect host-path + nsenter quota execution model in node-deployment mode. |
| cmd/provisioner-localpv/app/helper_hostpath.go | Switches helper pod quota scripts to host-path mode, and mounts host root at /host to support nsenter + lockfiles. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@fourhu we can't work with Merge commits from the update branch. This is because all of the commits need to carry the DCO signature. You'd want to rebase your PR (also an option on the drop-down in the update-branch GitHub button), instead. If you could, please remove the Merge commits and rebase your PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #357 +/- ##
========================================
Coverage 54.00% 54.00%
========================================
Files 1 1
Lines 474 474
========================================
Hits 256 256
Misses 209 209
Partials 9 9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Tick the box to add this pull request to the merge queue (same as
|
b9344e8 to
8a9fd0e
Compare
|
@niladrih thanks for the heads-up, my bad. I hit the default Update branch button and that pulled in the merge commits. Rebased onto develop and dropped those. Both commits should have the DCO sign-off now. Thanks for walking me through it. |
|
@fourhu There's a merge conflict on the cmd/provisioner-localpv/app/quota_scripts.go file. If you try to rebase again to the top of develop, you'll hit it. Could you resolve the conflict please? |
Run quota tools through nsenter into the host mount namespace and pass host paths so project quota is applied to the real host filesystem mount. Helper pods now mount the host root at /host for nsenter and flock. Fixes openebs#343 Signed-off-by: fourhu <fourhu@foxmail.com>
Init pods only mkdir under /data and do not need the host root. Quota and cleanup helpers now mount host /proc at /host/proc for nsenter, and flock on the existing /data bind-mount of parentDir. Signed-off-by: fourhu <fourhu@foxmail.com>
Rebase onto develop kept host_exec/nsenter and the pipe-safe chproj -D from openebs#361 instead of the old recursive -R. Signed-off-by: fourhu <fourhu@foxmail.com>
8a9fd0e to
78dc46f
Compare
Summary
xfs_quota,setquota, etc.) viansenterinto the host mount namespace and pass host paths (not/host/...or/data/...bind-mount paths)./procat/host/procso nsenter can reach the host mount namespace; flock uses the existing/databind-mount ofparentDir. Init pods are unchanged (/dataonly). DaemonSet mode already mounts the host root at/host.Background
XFS/EXT4 project quota is resolved against the calling process mount table. Running
xfs_quotainside the pod mount namespace against bind-mounted paths often fails or does not apply limits to the real host mount. Entering the host mount namespace with host-visible paths fixes this for both HelperPod and NodeDeployment modes.Test plan
go test ./cmd/provisioner-localpv/app/) covering nsenter, host paths, container flock path, and no-prefix passthroughtests/hostpath_quota_test.go) on a cluster with project-quota mounts and hostxfsprogs/quota-toolsinstalledxfs_quota reporton the node shows the project limitNotes
xfsprogs/quota-toolsinstalled (already documented for XFS quota).Fixes #343