diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-10-28 16:10:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-28 16:10:33 -0400 |
commit | 464aa36b0cc5cf2066380184eb1bb014107a1ca9 (patch) | |
tree | f3619b3dee9fed8f558b79e7f8ac49bbfc1158f5 /libpod/pod_status.go | |
parent | e04e567b96cafae30863c7782f7bc10c55bfb681 (diff) | |
parent | cddfe3983be63ee5193a19fb6669600f059a839f (diff) | |
download | podman-464aa36b0cc5cf2066380184eb1bb014107a1ca9.tar.gz podman-464aa36b0cc5cf2066380184eb1bb014107a1ca9.tar.bz2 podman-464aa36b0cc5cf2066380184eb1bb014107a1ca9.zip |
Merge pull request #8081 from mheon/pod_degraded
Add a Degraded state to pods
Diffstat (limited to 'libpod/pod_status.go')
-rw-r--r-- | libpod/pod_status.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libpod/pod_status.go b/libpod/pod_status.go index f4ccf308a..668d45ec7 100644 --- a/libpod/pod_status.go +++ b/libpod/pod_status.go @@ -10,10 +10,10 @@ func (p *Pod) GetPodStatus() (string, error) { if err != nil { return define.PodStateErrored, err } - return CreatePodStatusResults(ctrStatuses) + return createPodStatusResults(ctrStatuses) } -func CreatePodStatusResults(ctrStatuses map[string]define.ContainerStatus) (string, error) { +func createPodStatusResults(ctrStatuses map[string]define.ContainerStatus) (string, error) { ctrNum := len(ctrStatuses) if ctrNum == 0 { return define.PodStateCreated, nil @@ -43,8 +43,10 @@ func CreatePodStatusResults(ctrStatuses map[string]define.ContainerStatus) (stri } switch { - case statuses[define.PodStateRunning] > 0: + case statuses[define.PodStateRunning] == ctrNum: return define.PodStateRunning, nil + case statuses[define.PodStateRunning] > 0: + return define.PodStateDegraded, nil case statuses[define.PodStatePaused] == ctrNum: return define.PodStatePaused, nil case statuses[define.PodStateStopped] == ctrNum: |