diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-03-02 16:34:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-02 16:34:40 +0100 |
commit | 86ed329ad1720b3481f7901266ac9081e31b5464 (patch) | |
tree | 10a2c473dd7756f73f5723533f09c0968f9e8e3d /libpod | |
parent | 275e9b855dd0a384a283174912c08f3f097101b5 (diff) | |
parent | bbda410526852f608999f6a03c6a5c9096d96ead (diff) | |
download | podman-86ed329ad1720b3481f7901266ac9081e31b5464.tar.gz podman-86ed329ad1720b3481f7901266ac9081e31b5464.tar.bz2 podman-86ed329ad1720b3481f7901266ac9081e31b5464.zip |
Merge pull request #5320 from sujil02/podtest
Add test to validate prune pod apiv2 binding.
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/pod.go | 1 | ||||
-rw-r--r-- | libpod/pod_api.go | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/libpod/pod.go b/libpod/pod.go index 1b4c06c9d..4cdeb1033 100644 --- a/libpod/pod.go +++ b/libpod/pod.go @@ -88,6 +88,7 @@ type PodInspect struct { type PodInspectState struct { CgroupPath string `json:"cgroupPath"` InfraContainerID string `json:"infraContainerID"` + Status string `json:"status"` } // PodContainerInfo keeps information on a container in a pod diff --git a/libpod/pod_api.go b/libpod/pod_api.go index cb04f7411..200732652 100644 --- a/libpod/pod_api.go +++ b/libpod/pod_api.go @@ -407,7 +407,10 @@ func (p *Pod) Status() (map[string]define.ContainerStatus, error) { if err != nil { return nil, err } + return containerStatusFromContainers(allCtrs) +} +func containerStatusFromContainers(allCtrs []*Container) (map[string]define.ContainerStatus, error) { // We need to lock all the containers for _, ctr := range allCtrs { ctr.lock.Lock() @@ -443,6 +446,14 @@ func (p *Pod) Inspect() (*PodInspect, error) { if err != nil { return &PodInspect{}, err } + ctrStatuses, err := containerStatusFromContainers(containers) + if err != nil { + return nil, err + } + status, err := CreatePodStatusResults(ctrStatuses) + if err != nil { + return nil, err + } for _, c := range containers { containerStatus := "unknown" // Ignoring possible errors here because we don't want this to be @@ -468,6 +479,7 @@ func (p *Pod) Inspect() (*PodInspect, error) { State: &PodInspectState{ CgroupPath: p.state.CgroupPath, InfraContainerID: infraContainerID, + Status: status, }, Containers: podContainers, } |