-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add update-connection to machine start and init
#27405
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
Add update-connection to machine start and init
#27405
Conversation
There was a problem hiding this 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.
There was a problem hiding this 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.
cmd/podman/machine/init.go
Outdated
| // Set DefaultProvider | ||
| return checkAndSetDefConnection(cmd, initOpts.Name, initOpts.Rootful, setDefaultSystemConn) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
c0e2585 to
c80e009
Compare
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
b010c0e to
2786cab
Compare
|
Changes LGTM |
2786cab to
dd3a6c9
Compare
cmd/podman/machine/init.go
Outdated
| if err := start(cmd, args); err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect and must be reverted, no need to touch this at all.
Right now you only return on error not always. This means that a --now still prints the
To start your machine run:\n\n\tpodman machine start%s\n\n
message below which is obviously not what we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it
| if !conn.Default { | ||
| // Prompt for system connection update | ||
| if updateSystemConn == nil { | ||
| response, err := promptUpdateSystemConn() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I was trying to tell you is that this part should still be in cmd/. Only the EditConnectionConfig() can be here. But I guess it doesn't matter to much either way so if you want to leave this as is fine with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know what you were saying but I hit a problem, for which I cannot remember now, and was forced to combine them.
bbfc065 to
9b27541
Compare
|
/lgtm |
|
Removing lgtm, wsl is not passing |
fcf427b to
45743b5
Compare
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. Fixes: https://issues.redhat.com/browse/RUN-3632 Signed-off-by: Brent Baude <[email protected]>
Bumping the timeout for aarch64 machine tests as I am getting a consistent timeout where the tests are not completing in the given time. Signed-off-by: Brent Baude <[email protected]>
45743b5 to
623cb5f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: baude, Luap99 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 |
|
/lgtm |
This allows users to set the associated machine's system connection to the system default when running
podman machine init --noworpodman 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 tofalse, the user will not be prompted and the system connection will not be altered. If the value is set totrue, the system connection will be made the default and the user will not be prompted.Does this PR introduce a user-facing change?