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

Podman machine resets all providers #22941

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

ashley-cui
Copy link
Member

Podman machine reset now removes and resets machines from all providers availabe on the platform.

On windows, if the user is does not have admin privs, machine will only reset WSL, but will emit a warning that it is unable to remove hyperV machines without elevated privs.

Does this PR introduce a user-facing change?

The `podman machine reset` command now removes machines from all providers. 

Copy link
Contributor

openshift-ci bot commented Jun 7, 2024

[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

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 Jun 7, 2024
@ashley-cui
Copy link
Member Author

Unclear how to test, I don't think we have a way of creating machines with different providers in CI? Going to put no tests needed for now, if anyone disagrees and has an idea for tests, let me know.

@ashley-cui ashley-cui added the No New Tests Allow PR to proceed without adding regression tests label Jun 7, 2024
@ashley-cui ashley-cui marked this pull request as draft June 11, 2024 13:23
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 11, 2024
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

@ashley-cui ashley-cui force-pushed the machreset branch 3 times, most recently from 06f0456 to a91e0dd Compare June 14, 2024 16:53
Copy link

Cockpit tests failed for commit a91e0dd. @martinpitt, @jelly, @mvollmer please check.

@ashley-cui ashley-cui force-pushed the machreset branch 3 times, most recently from c3d3a0b to ba80167 Compare June 17, 2024 17:56
@ashley-cui ashley-cui marked this pull request as ready for review June 17, 2024 20:09
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 17, 2024
@ashley-cui
Copy link
Member Author

Ready for review, @containers/podman-maintainers PTAL

cmd/podman/machine/reset.go Show resolved Hide resolved
Comment on lines 50 to 52
if !wsl.HasAdminRights() {
logrus.Warn("managing hyperv machines require admin authority.")
} else {
Copy link
Member

Choose a reason for hiding this comment

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

This will spit out a wring by default for basically every WSL user, I would assume most don't care about hyperV so showing this by default on evey reset seems wrong to me.

Copy link
Member

Choose a reason for hiding this comment

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

I like the message, though. Drop to a Debug?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm concerned that people would expect reset to hard reset, including removing HyperV machines. This is actually tricky, because doing a reset the way this is implemented right now means that when reset is run without admin rights, HyperV machine configs and files will be deleted but will not be unregistered from the hypervisor, since the machine conf dirs are deleted anyway. I also considered making podman machine reset an admin-only command to get around this problem but that would exclude WSL users who don't have admin access.

I can drop it to a debug, but I guess there's other issues here to think about, since nothing is perfect right now due to HyperV's perm limitations.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated to only warn if not -f, since I think this is important information due to dangling hyperV machines.

pkg/machine/shim/host.go Outdated Show resolved Hide resolved
@ashley-cui
Copy link
Member Author

Hmm, needs #23118 to merge, then I'll rebase.

@ashley-cui
Copy link
Member Author

@Luap99 PTAL again :)

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.

code wise LGTM, although I like to test this on my mac with applehv/libkrun as there is not CI test for this (I don't see a easy way to add one so that is fine). Will try to test this tomorrow morning.

Podman machine reset now removes and resets machines from all providers availabe on the platform.

On windows, if the user is does not have admin privs, machine will only reset WSL, but will emit a warning that it is unable to remove hyperV machines without elevated privs.

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

Luap99 commented Jun 28, 2024

Tested on my mac and it deleted the machines from both providers so LGTM.

@baude @mheon PTAL

@ashley-cui
Copy link
Member Author

Tests passed, ready to go. @containers/podman-maintainers PTAL

@baude
Copy link
Member

baude commented Jul 1, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 1, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 3a41bcc into containers:main Jul 1, 2024
88 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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. machine No New Tests Allow PR to proceed without adding regression tests release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants