Skip to content

podman system reset removed machines incorrectly#14066

Merged
openshift-merge-robot merged 1 commit intocontainers:mainfrom
ashley-cui:sysres
May 4, 2022
Merged

podman system reset removed machines incorrectly#14066
openshift-merge-robot merged 1 commit intocontainers:mainfrom
ashley-cui:sysres

Conversation

@ashley-cui
Copy link
Copy Markdown
Member

@ashley-cui ashley-cui commented Apr 29, 2022

podman system reset did not clean up machines fully, leaving some config
files, and breaking machines. Now it removes all machines files fully.

Signed-off-by: Ashley Cui acui@redhat.com

Does this PR introduce a user-facing change?

Podman system reset now properly deletes all podman machines and associated files. 

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 29, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ashley-cui

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 Apr 29, 2022
@ashley-cui ashley-cui force-pushed the sysres branch 2 times, most recently from 93ca1ca to 09c3c06 Compare May 2, 2022 15:07
@TomSweeneyRedHat
Copy link
Copy Markdown
Member

Could you change the title when you repush please? correctly -> incorrectly

@ashley-cui ashley-cui force-pushed the sysres branch 2 times, most recently from 1ab0158 to 7ee9d36 Compare May 2, 2022 18:18
@ashley-cui ashley-cui changed the title podman system reset removes machines correctly podman system reset removed machines incorrectly May 2, 2022
@ashley-cui ashley-cui force-pushed the sysres branch 3 times, most recently from 9897dbc to 588ac1f Compare May 2, 2022 19:25
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this function logrus.Error rather then returning it? Looks like it never returns an error?

Copy link
Copy Markdown
Member Author

@ashley-cui ashley-cui May 3, 2022

Choose a reason for hiding this comment

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

The function should not error just because one machine failed to be removed, but rather keep going to check and remove more machines. I can either logrus.err it or return a list of errors and also error, but I think logrus is cleaner in this case

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If the function never returns an error, then it should not have error in its core.

I think you should do

var prevError Error
...
if err != nil {
        if prevError != nil {
                logrus.Errorf(prevErr)
         }
        prevError = err
}
...
Return prevError

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So the calling function would also just logrus the returned error too?

I updated the function to return an error if it's unable to list machines to remove, so the function will return an error if it fails there, do you think it's still necessary to do what you said?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would logrus all errors except for the last error. So if only one error, then no logging. If two errors logus.Error First Error, return second.

podman system reset did not clean up machines fully, leaving some config
files, and breaking machines. Now it removes all machines files fully.

Signed-off-by: Ashley Cui <acui@redhat.com>
@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented May 4, 2022

LGTM
@containers/podman-maintainers PTAL

@jwhonce
Copy link
Copy Markdown
Member

jwhonce commented May 4, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 4, 2022
@openshift-merge-robot openshift-merge-robot merged commit ad93318 into containers:main May 4, 2022
@ashley-cui
Copy link
Copy Markdown
Member Author

/cherry-pick v4.1

@openshift-cherrypick-robot
Copy link
Copy Markdown
Collaborator

@ashley-cui: new pull request created: #14117

Details

In response to this:

/cherry-pick v4.1

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@edsantiago edsantiago added the kind/bug Categorizes issue or PR as related to a bug. label Jun 2, 2022
@ashley-cui ashley-cui deleted the sysres branch June 3, 2022 17:51
@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 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 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. kind/bug Categorizes issue or PR as related to a bug. 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.

9 participants