Open kgfathur opened 3 months ago
I am not a Golang developer 😄 but the command behavior seems related to this snippet:
Default machine for podman machine start
command:
https://github.com/containers/podman/blob/94a24974ab345324db1a1489c924af4b89d2d0e9/cmd/podman/machine/start.go#L45-L53
Default machine for podman machine stop
command:
https://github.com/containers/podman/blob/94a24974ab345324db1a1489c924af4b89d2d0e9/cmd/podman/machine/stop.go#L37-L45
Default machine for podman machine ssh
command:
https://github.com/containers/podman/blob/94a24974ab345324db1a1489c924af4b89d2d0e9/cmd/podman/machine/ssh.go#L63-L83
Default machine for podman machine inspect
command:
https://github.com/containers/podman/blob/94a24974ab345324db1a1489c924af4b89d2d0e9/cmd/podman/machine/inspect.go#L47-L57
Default machine for podman machine rm
command:
https://github.com/containers/podman/blob/94a24974ab345324db1a1489c924af4b89d2d0e9/cmd/podman/machine/rm.go#L49-L56
Default machine for podman machine set
command:
https://github.com/containers/podman/blob/94a24974ab345324db1a1489c924af4b89d2d0e9/cmd/podman/machine/set.go#L90-L94
All of defaultMachineName
variable from above code related to podman machine ...
command seems referring to the hard-coded defaultMachineName = machine.DefaultMachineName
in cmd/podman/machine/init.go
https://github.com/containers/podman/blob/94a24974ab345324db1a1489c924af4b89d2d0e9/cmd/podman/machine/init.go#L21-L37
And the DefaultMachineName
variable value is set to podman-machine-default
in pkg/machine/config.go
https://github.com/containers/podman/blob/94a24974ab345324db1a1489c924af4b89d2d0e9/pkg/machine/config.go#L23-L26
However, the podman machine info
seem have different (expected) behavior to get the value for defaultmachine
:
https://github.com/containers/podman/blob/94a24974ab345324db1a1489c924af4b89d2d0e9/cmd/podman/machine/info.go#L114-L150
I am not sure is this a kind of bug or expected behavior.
this seems like a bug to me
WDYT @Luap99 @ashley-cui
What part? My understanding is that name is hard coded for the cli parsing for machine commands.
The normal remote client uses connections so it uses whatever is set as default connection, this is completely unrelated to machines. Using the remote client does not need any machines at all.
So is the question is why does machine info uses connection to show the default? Then I don't know but machine ls does the same AFAIK.
sorry I definitely wasn't clear... I meant it seemed odd to me that machine info
was using system connections to determine the default when the other commands determined that differently
A friendly reminder that this issue had no activity for 30 days.
This one seems to have gotten lost, do we need to just fix podman machine info
to show the default connection?
This one seems to have gotten lost, do we need to just fix
podman machine info
to show the default connection?
Yes. I can fix it
Info does show the default connection? I don't think this is a bug, as info is designed to show the state of the system, and the default connection is much more relevant than just showing "podman-machine-info"
Shouldn't the defaultmachine
section always show podman-machine-default
since that's technically the default machine we would try and run if the user didn't specify a name?
If the default system connection is set to something that isn't associated with a podman machine then defaultmachine
just shows "" which a little confusing considering there technically is a default
I guess it's a naming issue then? IMO displaying podman-machine-default in podman machine info doesn't make sense because it doesn't give the user more info. The behavior of knowing what machine your connection is going to speak to is useful, and what machine is running is useful. Maybe it should be something like machineactiveconnection? or something like that?
A name change sounds like a good way to go about this. machineactiveconnection
works for me as well
Hi @kgfathur!
For the foreseeable future the current behavior will remain. I do want to clarify that defaultmachine
in the podman machine info
output is not meant to suggest you are able to set a "default" podman machine. The default podman machine will always be podman-machine-default
. defaultmachine
is intended to specify, if it exists, the current default system connection that is associated with a podman machine.
In order to make this clearer, I updated the podman machine info
manpages to outline this information. (https://github.com/containers/podman/pull/23841)
For the next major podman release, the idea is to change the name to something along the lines of activemachineconnection
to better describe its behavior.
I'm going to leave this issue open so we can track it for the next release. Thanks for filing your issue!
Feature request description
When running command
podman machine start/stop/ssh/inspect
without the machine name, it's always set the default machine to be executed topodman-machine-default
.I am not sure is this a same behavior on Linux/Mac also. On Linux, I am using native
podman
on the OS/Host, never try the podman with qemu/kvm backend on Linux. When initialize podman on windows (podman machine on top WSL), the default machine is "podman-machine-default".It's actually running without no issue.
However, when we create single/multiple podman machines with custom name. The
podman machine ...
command not works to execute podman machine related command on the customized podman machine's name. Even if we set thedefaultmachine
to other podman machine.Default machine is
podman-machine-default
as expected:Then we try to change the default podman machine/connection.
Change the default podman machine/connection:
However, even the
defaultmachine
parameter frompodman machine info
command output has been set to the expected value, the default machine started usingpodman machine start
command still refering to thepodman-machine-default
:Podman machine with custom name still need to be specified as parameter to
start
,stop
,ssh
the machine:Other
podman machine ...
command still executed topodman-machine-default
:Changing the default wsl seem not related to this behavior:
Suggest potential solution
The podman machine cotext when
podman machine start/stop/ssh/inspect
command executed without machine name will be set to machine based ondefaultmachine
value frompodman machine info
Have you considered any alternatives?
No response
Additional context
No response