summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-04-09 08:55:39 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-04-11 18:35:37 +0000
commit77a1665c05517194c4d5b27b7e03326d4c0923c9 (patch)
tree14b2632da81eecb88fa053f941cae5719c95c1cf
parent22c00ceebbc0d028af94bffdf5a289ff54e1830f (diff)
downloadpodman-77a1665c05517194c4d5b27b7e03326d4c0923c9.tar.gz
podman-77a1665c05517194c4d5b27b7e03326d4c0923c9.tar.bz2
podman-77a1665c05517194c4d5b27b7e03326d4c0923c9.zip
Containers transitioning to stop should not break stats
When a container is transitioning from running to stopped and stats is runnings, we should not break stats if we are unable to get stats for that container. Resolves: #598 Signed-off-by: baude <bbaude@redhat.com> Closes: #599 Approved by: mheon
-rw-r--r--cmd/podman/stats.go2
-rw-r--r--libpod/stats.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/cmd/podman/stats.go b/cmd/podman/stats.go
index 3c2dfb5cf..6a8681028 100644
--- a/cmd/podman/stats.go
+++ b/cmd/podman/stats.go
@@ -140,7 +140,7 @@ func statsCmd(c *cli.Context) error {
containerStats[id] = initialStats
}
stats, err := ctr.GetContainerStats(containerStats[id])
- if err != nil {
+ if err != nil && errors.Cause(err) != libpod.ErrNoSuchCtr {
return err
}
// replace the previous measurement with the current one
diff --git a/libpod/stats.go b/libpod/stats.go
index f4694923c..33e57572c 100644
--- a/libpod/stats.go
+++ b/libpod/stats.go
@@ -37,7 +37,7 @@ func (c *Container) GetContainerStats(previousStats *ContainerStats) (*Container
c.lock.Lock()
defer c.lock.Unlock()
if err := c.syncContainer(); err != nil {
- return stats, errors.Wrapf(err, "error updating container %s state", c.ID())
+ return stats, err
}
if c.state.State != ContainerStateRunning {
return stats, nil