mirror of
https://github.com/containers/podman.git
synced 2025-10-18 19:53:58 +08:00
podman-remote inspect
base enablement of the inspect command. Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
@ -116,7 +116,7 @@ func (ns LinuxNS) String() string {
|
||||
type Container struct {
|
||||
config *ContainerConfig
|
||||
|
||||
state *containerState
|
||||
state *ContainerState
|
||||
|
||||
// Batched indicates that a container has been locked as part of a
|
||||
// Batch() operation
|
||||
@ -136,10 +136,10 @@ type Container struct {
|
||||
requestedIP net.IP
|
||||
}
|
||||
|
||||
// containerState contains the current state of the container
|
||||
// ContainerState contains the current state of the container
|
||||
// It is stored on disk in a tmpfs and recreated on reboot
|
||||
// easyjson:json
|
||||
type containerState struct {
|
||||
type ContainerState struct {
|
||||
// The current state of the running container
|
||||
State ContainerStatus `json:"state"`
|
||||
// The path to the JSON OCI runtime spec for this container
|
||||
@ -1063,3 +1063,18 @@ func networkDisabled(c *Container) (bool, error) {
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// ContainerState returns containerstate struct
|
||||
func (c *Container) ContainerState() (*ContainerState, error) {
|
||||
if !c.batched {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
if err := c.syncContainer(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
returnConfig := new(ContainerState)
|
||||
deepcopier.Copy(c.state).To(returnConfig)
|
||||
return c.state, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user