summaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-01-19 20:40:37 +0100
committerGitHub <noreply@github.com>2019-01-19 20:40:37 +0100
commit579fc0f7eb3928a076b0a5d1d6ec444205a0a930 (patch)
tree739a21529954fb0009e5fa2a785d753389e344b4 /libpod/container.go
parent0d4bfb013108f836dbc6369d38b01b6e92d6141d (diff)
parenteadaa5fb420e3e8e6b0e277ac88cc528f9950ee4 (diff)
downloadpodman-579fc0f7eb3928a076b0a5d1d6ec444205a0a930.tar.gz
podman-579fc0f7eb3928a076b0a5d1d6ec444205a0a930.tar.bz2
podman-579fc0f7eb3928a076b0a5d1d6ec444205a0a930.zip
Merge pull request #2183 from baude/remoteinspect
podman-remote inspect
Diffstat (limited to 'libpod/container.go')
-rw-r--r--libpod/container.go21
1 files changed, 18 insertions, 3 deletions
diff --git a/libpod/container.go b/libpod/container.go
index b5f6a29ba..b0589be3b 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -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
+}