-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 info #14762
Podman machine info #14762
Conversation
[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 |
Fixes: #14113 |
cmd/podman/machine/info.go
Outdated
} | ||
|
||
host.NumberOfMachines = len(listResponse) | ||
host.RemoteSocket = fmt.Sprintf("/run/user/%d/podman/podman.sock", os.Getuid()) |
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 the only field I'm not sure is entirely correct, please correct me if I'm wrong here.
c7cf4bc
to
f6ced0d
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.
Is there any info to indicate whether the machine is starting? Or would that not be pertinent here, only in machine list?
cmd/podman/machine/info.go
Outdated
} | ||
|
||
host.NumberOfMachines = len(listResponse) | ||
host.RemoteSocket = fmt.Sprintf("/run/user/%d/podman/podman.sock", os.Getuid()) |
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.
if running rootful do we need to check for /run/podman/podman.sock
?
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.
or actually given #14706 this is not an issue. That URL is right for rootless (I think)
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 should be based on the valure of XDG_RUNTIME_DIR, shouldn't it?
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.
Wouldn't that just be the same as eventSockDIr? Or is remote socket something different? @baude, thoughts?
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.
It is defined right here for podman info ->
podman/pkg/domain/infra/abi/system.go
Line 46 in 6c4c050
uri := url.URL{ |
8031ea5
to
9709bc6
Compare
That command is really helpful. Few notes:
}
|
would it be enough to list the machines by name and then use the statuses to determine which is "current"? |
Why are we including a list of machines? That seems like a |
I would like to have the because for example I would prefer to know the |
@mheon thanks for the reminder on machine ls; indeed, I did not want to list each machine in machine info; that is what |
Number of machines/number of running, maybe? Knowing at least 1 is up is a clue to go to |
@mheon, @baude , @benoitf I'd agree that we shouldn't list machines in machine info, and I'd also prefer if we don't add any information on the machine, as that's covered by @mheon, Only one machine can be up at a time, so maybe a field like machineRunning that's a bool? |
I'm ok to remove all the content that is related to the current machine (like sockets, etc) (and then add it in the inspect command) About the default machine, can we change through cli the default machine name or is it always 'podman-machine-default' ? but I think user wants to know the current status of the machine: running, starting or stopped (Running is not enough) because if you do I would also be interested to know if machine has failed to start (it's not running but there was a failure) so something like "CurrentMachine": "podman-machine-default",
"State|Status": "Starting|Running|Stopped|Failed|N/A...", |
Sure, I think default machine is the same thing as current machine. I think I would be okay with adding something like default machine state too, if the others are as well. 😄 |
i assume current machine to mean -- the machine that is running and has nothing to do with default. And using that definition, if a machine is running, the state must be |
Since we only have one machine running at a time, I would expect it to be current machine, if no machine is running then it should be default. |
Updated! |
I tried again the command when I launch podman machine info without a machine I can see
But the RemoteSocket path does not exists $ ls -la /var/folders/tg/_5rxbhmj4xncz4szvpgswrmc0000gn/T/podman-run--1/podman/podman.sock
ls: /var/folders/tg/_5rxbhmj4xncz4szvpgswrmc0000gn/T/podman-run--1/podman/podman.sock: No such file or directory on my side the socket is at If I only create a machine but I don't start it
but socket path still doesn't exists and even if I do run the machine the path is still incorrect ? so
as further improvement, I would like to see, if possible, (like in another enhancement) that a machine is being created/initialized if I do I would expect to have when doing
|
Hmm, okay I think then it isn't XDG_RUNTIME_DIR, let me take another look and fix it
I'm not sure if we have a creating status already, this might need to be taken a look at in another PR. Might also be a chicken-and-egg problem. as we don't know that we're creating a VM until the VM exists.. but there might be a place in the code execution were we could sneak that in, I'll give it another look in a different PR |
Okay, socket should be correct, but I'm not sure if we should put the sock in machine info, since now we're going into machine inspect territory, by calling inspect. WDYT @baude |
|
||
``` | ||
$ podman machine info | ||
$ podman machine info --format json |
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.
might be nice to have a simple go template example too.
i think whether the socket exists or not is outside the scope of this PR. I would recommend that we merge this PR and have @benoitf create an issue about the sockets. One thing regarding the sockets, we intentionally do not create them unless a machine is running but for machine events, it probably does make sense. |
Added go template example, and removed RemoteSocket field since I think we should avoid calling machine inspect in machine info. |
LGTM |
Two nits otherwise LGTM |
Add podman machine info command, which displays infor about the machine host as well as version info. Signed-off-by: Ashley Cui <[email protected]>
Tests are green, @containers/podman-maintainers PTAL and merge |
/lgtm |
Add podman machine info command, which displays info about the machine
host as well as version info.
Signed-off-by: Ashley Cui [email protected]
Does this PR introduce a user-facing change?