Remove a volume with --force if container is running - #11925
Conversation
Currently we are not passing the force flag down to the removal of the running container. If the container is running, and we set --force when removing the volume, the container should be stopped. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| cid=$output | ||
| run_podman 2 volume rm myvol | ||
| is "$output" "Error: volume myvol is being used by the following container(s): $cid: volume is being used" "should error since container is running" | ||
| run_podman volume rm myvol --force |
There was a problem hiding this comment.
Did you mean to add a check here, to make sure $cid is stopped?
There was a problem hiding this comment.
No I figured it was since the rm failed previously complaining about the running container. When this is done the $cid should no longer exists.
There was a problem hiding this comment.
Right. So wouldn't it be nice to confirm it? run_podman 1 container exists $cid ? But I can add it in one of my future grab-bag bats PRs
|
Is there a specific reason we want to make this change? Not really opposed, but it is sort of a breaking change |
|
Huh this seems to be documented to me. And I don't see this as a breaking change, as opposed to a fixed bug. The podman volume rm --help shows this. -f, --force Remove a volume by force, even if it is being used by a container The Man page says. How is this a breaking change as opposed to a bug? |
|
/lgtm |
Currently we are not passing the force flag down to the removal of
the running container. If the container is running, and we set
--force when removing the volume, the container should be stopped.
Signed-off-by: Daniel J Walsh dwalsh@redhat.com
What this PR does / why we need it:
How to verify it
Which issue(s) this PR fixes:
Special notes for your reviewer: