Skip to content
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

Don't log errors on removing volumes inuse, if container --volumes-from #13232

Merged
merged 1 commit into from
Feb 23, 2022

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Feb 14, 2022

When removing a container created with a --volumes-from a container
created with a built in volume, we complain if the original container
still exists. Since this is an expected state, we should not complain
about it.

Fixes: #12808

Signed-off-by: Daniel J Walsh [email protected]

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 14, 2022
@edsantiago
Copy link
Member

Test LGTM, and I confirmed that it fails without the code changes:

   #/vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
   #|     FAIL: No error should be thrown about volume in use
   #| expected: 'yoRYeDUZT89kqFPhcMcU0BREQUxx2zsb1kcidFBWEnNeuRD5Lw'
   #|   actual: 'yoRYeDUZT89kqFPhcMcU0BREQUxx2zsb1kcidFBWEnNeuRD5Lw'
   #|         > 'time="2022-02-14T13:49:45-07:00" level=error msg="Cleanup volume (&{5d6491d66ef5c6858fb900de2938a23c98848211d103e520c7df43bb248a8a29 /vol [rprivate rw nodev exec nosuid rbind]}): volume 5d6491d66ef5c6858fb900de2938a23c98848211d103e520c7df43bb248a8a29 is being used by the following container(s): a11f21965cf1490d12ea69b28b7d7e88226c6643b3a76bb8078c2436532bf903: volume is being used"'
   #\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@@ -768,6 +768,13 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force, remo
continue
}
if err := runtime.removeVolume(ctx, volume, false, timeout); err != nil && errors.Cause(err) != define.ErrNoSuchVolume {
if errors.Cause(err) == define.ErrVolumeBeingUsed {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually safe? We don't know if the volume is from --volumes-from or not

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean by safe. We were not returning an error before but throwing out a large error message on the screen. The risk here theoretically is that a Volume might be left around and not removed.

When removing a container created with a --volumes-from a container
created with a built in volume, we complain if the original container
still exists.  Since this is an expected state, we should not complain
about it.

Fixes: containers#12808

Signed-off-by: Daniel J Walsh <[email protected]>
@rhatdan
Copy link
Member Author

rhatdan commented Feb 22, 2022

@containers/podman-maintainers PTAL

I think this is ready for merge.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 23, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 23, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, rhatdan

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 8b24324 into containers:main Feb 23, 2022
@rhatdan rhatdan deleted the volumes branch December 1, 2022 22:02
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected error "Cleanup volume: volume is being used by the following container"
6 participants