Add --volume-mode flag for container/pod creation#27866
Add --volume-mode flag for container/pod creation#27866ygalblum wants to merge 1 commit intocontainers:mainfrom
Conversation
Add a new --volume-mode flag that controls behavior when a named volume doesn't exist during container or pod creation. Supported modes: - create (default): auto-create missing named volumes - fail: return an error if the volume doesn't exist The flag is available on: podman create, podman run, podman pod create, and podman pod clone. See: containers#27862 Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
Luap99
left a comment
There was a problem hiding this comment.
Do we really want a new cli option for this? Would it not be bvetter to pass this on a per volume basis as volume option? --volume name:/dest:nocreate or something like this.
| } | ||
| // Volume does not exist - check if we should fail | ||
| if ctr.config.VolumeMode == define.VolumeModeFail { | ||
| return nil, fmt.Errorf("volume %s does not exist and --volume-mode is set to fail: %w", vol.Name, define.ErrNoSuchVolume) |
There was a problem hiding this comment.
error messages in the backend logic like here should not refer to the cli names, we might be called via rest API, etc.. where these names don't make sense
@mheon and I discussed this question and we also weren't sure if this should be global or volume specific. I don't mind changing it if you think that would be better. |
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
I don't care to strongly either way, |
|
Closing in favor of #27867 |
Add a new --volume-mode flag that controls behavior when a named volume doesn't exist during container or pod creation.
Supported modes:
The flag is available on: podman create, podman run, podman pod create, and podman pod clone.
See: #27862
Checklist
Ensure you have completed the following checklist for your pull request to be reviewed:
commits. (
git commit -s). (If needed, usegit commit -s --amend). The author email must matchthe sign-off email address. See CONTRIBUTING.md
for more information.
Fixes: #00000in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?