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

Ignore mount errors except ErrContainerUnknown when cleaningup container #11604

Merged
merged 1 commit into from
Sep 22, 2021

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Sep 16, 2021

Fixes: #11207

[NO TESTS NEEDED] Since I don't know how to get into this situation.

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

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 16, 2021

[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

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-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 16, 2021
@rhatdan
Copy link
Member Author

rhatdan commented Sep 16, 2021

@nalind @mheon PTAL

@@ -112,12 +112,14 @@ func (r *Runtime) removeStorageContainer(idOrName string, force bool) error {
return errors.Wrapf(define.ErrCtrStateInvalid, "container %q is mounted and cannot be removed without using force", idOrName)
}
} else if _, err := r.store.Unmount(ctr.ID, true); err != nil {
if errors.Cause(err) == storage.ErrContainerUnknown {
if errors.Is(err, storage.ErrContainerUnknown) {
Copy link
Member

Choose a reason for hiding this comment

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

No need for two ifs, throw the other one in here and or them together so we still get a good Infof.

Unless you think that DeleteContainer will still work if we get a ErrLayerUnknown but not an ErrContainerUnknown?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, reading back to the old conversation in the linked issue, that does appear to be the assumption...

Maybe we should just logrus.Errorf() any errors that come out of Unmount and unconditionally proceed to the DeleteContainer()?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok how about now, we always try to delete, if we can not determine if the container is mounted or if we fail to unmount the container.

Copy link
Member

Choose a reason for hiding this comment

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

Works for me

@rhatdan rhatdan force-pushed the deleteContainer branch 2 times, most recently from 9923cb8 to f040928 Compare September 21, 2021 18:20
@rhatdan
Copy link
Member Author

rhatdan commented Sep 22, 2021

@containers/podman-maintainers PTAL
@vrothberg @giuseppe @flouthoc @mheon @baude PTAL

@flouthoc
Copy link
Collaborator

LGTM

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

The title suggest that we're ignoring ErrLayerUnknown but the code doesn't do that. It'll ignore all errors (but ErrContainerUnknown).

@@ -106,18 +106,18 @@ func (r *Runtime) removeStorageContainer(idOrName string, force bool) error {
logrus.Infof("Storage for container %s already removed", ctr.ID)
return nil
}
return errors.Wrapf(err, "error looking up container %q mounts", idOrName)
logrus.Errorf("error checking if container %q is mounted, attempting to delete: %v", idOrName, err)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
logrus.Errorf("error checking if container %q is mounted, attempting to delete: %v", idOrName, err)
logrus.Errorf("Error checking if container %q is mounted, attempting to delete: %v", idOrName, err)

Copy link
Member Author

Choose a reason for hiding this comment

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

Since we have lots of different cases for logrus.Errorf, I would rather just get this merged and then work on a separate PR to fix all of the logrus.Errorf calls. We need to decide if they should all be UpperCase or lower case.

Copy link
Member

Choose a reason for hiding this comment

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

The convention for logs is always upper case (errors lower case), so I think the decision has been made on that already.

@rhatdan
Copy link
Member Author

rhatdan commented Sep 22, 2021

The original error case was to ignore ErrLayerUnknown.

@vrothberg
Copy link
Member

The original error case was to ignore ErrLayerUnknown.

I don't understand. Do we want to ignore only this error or all?

@mheon
Copy link
Member

mheon commented Sep 22, 2021

@vrothberg It was my suggestion - the code seems brittle enough that it seemed worth attempting the removal, regardless of error message.

@vrothberg
Copy link
Member

@vrothberg It was my suggestion - the code seems brittle enough that it seemed worth attempting the removal, regardless of error message.

Ah, thanks for clarifying. Can we update the commit message to reflect that? It really looked unintentional to me.

Fixes: containers#11207

[NO TESTS NEEDED] Since I don't know how to get into this situation.

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

LGTM
two tests failing that I've restarted, both appeared to be network flakes.

@rhatdan rhatdan added the lgtm Indicates that a PR is ready to be merged. label Sep 22, 2021
@rhatdan rhatdan changed the title Ignore ErrLayerUnknown error when attempting to cleanup container Ignore mount errors except ErrContainerUnknown when cleaningup container Sep 22, 2021
@openshift-merge-robot openshift-merge-robot merged commit 626df0a into containers:main Sep 22, 2021
@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 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 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.

podman rm --storage fails
6 participants