Add rootful status to machine inspect

Podman machine inspect now shows if the machine is rootful

Signed-off-by: Ashley Cui <acui@redhat.com>
This commit is contained in:
Ashley Cui
2023-08-17 01:39:56 -04:00
parent 4ff21cf1ac
commit da81bc13a1
6 changed files with 18 additions and 12 deletions

View File

@ -24,7 +24,7 @@ Rootless only.
Print results with a Go template. Print results with a Go template.
| **Placeholder** | **Description** | | **Placeholder** | **Description** |
| ------------------- | ----------------------------------------------------- | | ------------------- | --------------------------------------------------------------------- |
| .ConfigPath ... | Machine configuration file location | | .ConfigPath ... | Machine configuration file location |
| .ConnectionInfo ... | Machine connection information | | .ConnectionInfo ... | Machine connection information |
| .Created | Machine creation time (string, ISO3601) | | .Created | Machine creation time (string, ISO3601) |
@ -32,6 +32,7 @@ Print results with a Go template.
| .LastUp | Time when machine was last booted | | .LastUp | Time when machine was last booted |
| .Name | Name of the machine | | .Name | Name of the machine |
| .Resources ... | Resources used by the machine | | .Resources ... | Resources used by the machine |
| .Rootful | Whether the machine prefers rootful or rootless container execution |
| .SSHConfig ... | SSH configuration info for communitating with machine | | .SSHConfig ... | SSH configuration info for communitating with machine |
| .State ... | Machine state | | .State ... | Machine state |
| .UserModeNetworking | Whether this machine uses user-mode networking | | .UserModeNetworking | Whether this machine uses user-mode networking |

View File

@ -317,6 +317,7 @@ func (m *MacMachine) Inspect() (*machine.InspectInfo, error) {
}, },
SSHConfig: m.SSHConfig, SSHConfig: m.SSHConfig,
State: vmState, State: vmState,
Rootful: m.Rootful,
} }
return &ii, nil return &ii, nil
} }

View File

@ -151,6 +151,7 @@ type InspectInfo struct {
SSHConfig SSHConfig SSHConfig SSHConfig
State Status State Status
UserModeNetworking bool UserModeNetworking bool
Rootful bool
} }
func (rc RemoteConnectionType) MakeSSHURL(host, path, port, userName string) url.URL { func (rc RemoteConnectionType) MakeSSHURL(host, path, port, userName string) url.URL {

View File

@ -303,6 +303,7 @@ func (m *HyperVMachine) Inspect() (*machine.InspectInfo, error) {
}, },
SSHConfig: m.SSHConfig, SSHConfig: m.SSHConfig,
State: vm.State().String(), State: vm.State().String(),
Rootful: m.Rootful,
}, nil }, nil
} }

View File

@ -1596,6 +1596,7 @@ func (v *MachineVM) Inspect() (*machine.InspectInfo, error) {
SSHConfig: v.SSHConfig, SSHConfig: v.SSHConfig,
State: state, State: state,
UserModeNetworking: true, // always true UserModeNetworking: true, // always true
Rootful: v.Rootful,
}, nil }, nil
} }

View File

@ -1745,6 +1745,7 @@ func (v *MachineVM) Inspect() (*machine.InspectInfo, error) {
SSHConfig: v.SSHConfig, SSHConfig: v.SSHConfig,
State: state, State: state,
UserModeNetworking: v.UserModeNetworking, UserModeNetworking: v.UserModeNetworking,
Rootful: v.Rootful,
}, nil }, nil
} }