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
This commit is contained in:
baude 2018-04-09 08:55:39 -05:00 committed by Atomic Bot
parent 22c00ceebb
commit 77a1665c05
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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