Skip to content

Conversation

@baude
Copy link
Member

@baude baude commented Oct 29, 2025

This allows users to set the associated machine's system connection to the system default when running podman machine init --now or podman machine start. It also changes the default bbehavior of these commands in that the user will be prompted and asked if they would like to switch the system connection. It also introduces a command line switch called --update-connection. If the switch is unset, then the user will be prmpted. If the command value is explicitly set to false, the user will not be prompted and the system connection will not be altered. If the value is set to true, the system connection will be made the default and the user will not be prompted.

Does this PR introduce a user-facing change?

Users are now prompted when a machine starts to change the default system connection

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 29, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: baude

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 Oct 29, 2025
@baude baude marked this pull request as draft October 29, 2025 20:18
@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 Oct 29, 2025
Copy link
Member

@Honny1 Honny1 left a comment

Choose a reason for hiding this comment

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

LGTM, I like the new feature.

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.

There are big TOCTOU races here, I think this logic must be moved into the shim Start() call where we hold the startLock to prevent simultaneous starts from overwriting each other.

Because technically what can happen is you start machine 1, then you prompt (can take forever), then the machine 1 gets stopped, machine 2 is started prompts again, answered yes., then go back to the prompt of machine 1 and answer yes there as well.

Sure easy to say user problem and not our thing but I think it costs us nothing doing this under the start lock. Maybe it makes more sense to prompt before we actually start the machine and then we only have to rewrite the connection under the start lock.

Comment on lines 300 to 301
// Set DefaultProvider
return checkAndSetDefConnection(cmd, initOpts.Name, initOpts.Rootful, setDefaultSystemConn)
Copy link
Member

Choose a reason for hiding this comment

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

aren't you calling this twice on init then? start already called it and now you call it again?

Copy link
Member Author

Choose a reason for hiding this comment

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

you are right! how the hell did that get by me.

@baude baude force-pushed the setdefaultconnection branch 2 times, most recently from c0e2585 to c80e009 Compare October 30, 2025 19:39
@baude baude marked this pull request as ready for review October 30, 2025 20:04
@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 Oct 30, 2025
@packit-as-a-service
Copy link

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@baude baude force-pushed the setdefaultconnection branch from c80e009 to b010c0e Compare October 31, 2025 12:37
This allows users to set the associated machine's system connection to the system default when running `podman machine init --now` or `podman machine start`.  It also changes the default bbehavior of these commands in that the user will be prompted and asked if they would like to switch the system connection.  It also introduces a command line switch called `--update-connection`.  If the switch is unset, then the user will be prmpted.  If the command value is explicitly set to `false`, the user will not be prompted and the system connection will not be altered.  If the value is set to `true`, the system connection will be made the default and the user will not be prompted.

Signed-off-by: Brent Baude <[email protected]>
@baude baude force-pushed the setdefaultconnection branch from b010c0e to 2786cab Compare October 31, 2025 19:33
@TomSweeneyRedHat
Copy link
Member

Changes LGTM
A test is failing so far, looks to be a flake.

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. machine release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants