-
Notifications
You must be signed in to change notification settings - Fork 814
RUN: only use an overlay for --mount=type=bind,rw on overlay #6126
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
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nalind The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
6084d5f
to
b81b006
Compare
Ephemeral COPR build failed. @containers/packit-build please check. |
86b6879
to
f0e6488
Compare
04b80e1
to
e62f77c
Compare
dad02e0
to
5dd5313
Compare
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.
I only gave this a quick skim and I don't know the code really, but FWIW looks sane to me.
@@ -118,6 +120,87 @@ func convertToOverlay(m specs.Mount, store storage.Store, mountLabel, tmpDir str | |||
return mountThisInstead, overlayDir, nil | |||
} | |||
|
|||
func makeTempCopy(m specs.Mount, tmpDir string, uid, gid int) (specs.Mount, string, error) { |
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.
This function seems like it could use a doc comment.
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.
Added one.
Expand our task that runs the integration tests inside of a container from running buildah-using-vfs-inside-podman-using-vfs and buildah-using-overlay-inside-podman-using-overlay to also test vfs over overlay, and overlay over vfs. Signed-off-by: Nalin Dahyabhai <[email protected]>
Only use an overlay for --mounts of type=bind,rw, where changes should be discarded, if the storage driver is overlay. Otherwise, make a temporary copy and use a bind mount to the copy. Signed-off-by: Nalin Dahyabhai <[email protected]>
If we're forcing a mount using overlay, but we fail, and our chosen upper directory is on overlay, try using fuse-overlayfs. Signed-off-by: Nalin Dahyabhai <[email protected]>
Force the mount of the overlay in runSetupVolumeMounts() so that we can take advantage of logic that tries to use fuse-overlayfs if we happen to be on top of overlay, which would otherwise fail. Signed-off-by: Nalin Dahyabhai <[email protected]>
Force the mount of the overlay in volumeCacheSaveOverlay(), and clean it up in volumeCacheRestoreOverlay(), so that we can take advantage of logic that tries to use fuse-overlayfs if we happen to be on top of overlay, which would otherwise fail. Signed-off-by: Nalin Dahyabhai <[email protected]>
Drop the conditional ,z that we were trying to add when testing the -v flag with the "O" option, the combination of which is not allowed by github.com/containers/common/pkg/parse.ValidateVolumeOpts(). Signed-off-by: Nalin Dahyabhai <[email protected]>
When grepping the mounts list for the root mount, also accept the entry if "rw" is the only flag. Signed-off-by: Nalin Dahyabhai <[email protected]>
If we're on overlayfs, we can't use the directory name that we'd like to use as part of the test and expect things to succeed, even if we try to work around it using fuse-overlayfs. Signed-off-by: Nalin Dahyabhai <[email protected]>
If we're on overlayfs, we can't use the directory name that we'd like to use as part of the test and expect things to succeed, even if we try to work around it using fuse-overlayfs. Signed-off-by: Nalin Dahyabhai <[email protected]>
When setting up a chroot using overlay, if the intended upper directory is already on an overlayfs, mount a tmpfs onto it so that we can finish setting up the chroot that's an overlayfs that we'll actually test in, and copy the base image into the storage that it'll use. Signed-off-by: Nalin Dahyabhai <[email protected]>
if test -x /usr/bin/fuse-overlayfs ; then | ||
local storage_opts="overlay.mount_program=/usr/bin/fuse-overlayfs" | ||
else | ||
skip trying to use overlay on top of overlay, but fuse-overlayfs is not present |
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.
Possibly minor: Everywhere else I looked the reason is passed as a single argument to skip
by quoting it. I'm unsure if passing multiple arguments like this also works, but for consistency it would be nice to quote it. But this is such a minor thing, please don't re-push only to fix this.
matrix: | ||
- env: | ||
STORAGE_DRIVER: 'vfs' | ||
- env: | ||
STORAGE_DRIVER: 'overlay' | ||
matrix: | ||
- env: | ||
NESTED_STORAGE_DRIVER: 'vfs' | ||
- env: | ||
NESTED_STORAGE_DRIVER: 'overlay' |
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.
I believe cirrus will happily accept this invalid YAML, but I believe hack/get_ci_vm.sh
will puke on it because it uses python-yaml to parse the file. If this functionality is important, I believe something like the following would work:
matrix: | |
- env: | |
STORAGE_DRIVER: 'vfs' | |
- env: | |
STORAGE_DRIVER: 'overlay' | |
matrix: | |
- env: | |
NESTED_STORAGE_DRIVER: 'vfs' | |
- env: | |
NESTED_STORAGE_DRIVER: 'overlay' | |
matrix: | |
- env: | |
STORAGE_DRIVER: 'vfs' | |
NESTED_STORAGE_DRIVER: 'vfs' | |
- env: | |
STORAGE_DRIVER: 'overlay' | |
NESTED_STORAGE_DRIVER: 'vfs' | |
- env: | |
STORAGE_DRIVER: 'vfs' | |
NESTED_STORAGE_DRIVER: 'overlay' | |
- env: | |
STORAGE_DRIVER: 'overlay' | |
NESTED_STORAGE_DRIVER: 'overlay' |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Only use an overlay for --mounts of type=bind,rw, where changes should be discarded, if the storage driver is overlay. Otherwise, make a temporary copy.
How to verify it
Updated CI to test {vfs|overlay} over {vfs|overlay}, which would have caught this.
Which issue(s) this PR fixes:
Should fix #5988.
Special notes for your reviewer:
Basically what #5988 (comment) suggested.
Does this PR introduce a user-facing change?