Skip to content

Commit

Permalink
Merge pull request #1056 from HusterWan/zr/sync-stopped-container-status
Browse files Browse the repository at this point in the history
bugfix: sync abnormal container status when start pouchd
  • Loading branch information
allencloud authored Apr 16, 2018
2 parents 65b9dc2 + e1cd2da commit 1f2b6ee
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions daemon/mgr/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,19 @@ func (mgr *ContainerManager) Restore(ctx context.Context) error {
logrus.Errorf("failed to recover container: %s, %v", containerMeta.ID, err)
}

if err := mgr.Client.RecoverContainer(ctx, containerMeta.ID, io); err == nil {
return nil
err = mgr.Client.RecoverContainer(ctx, containerMeta.ID, io)
if err != nil && strings.Contains(err.Error(), "not found") {
logrus.Infof("container %s not found, executes mark stopped and release resources", containerMeta.ID)
if err := mgr.markStoppedAndRelease(&Container{meta: containerMeta}, nil); err != nil {
logrus.Errorf("failed to mark container: %s stop status, err: %v", containerMeta.ID, err)
}
} else if err != nil {
logrus.Errorf("failed to recover container: %s, %v", containerMeta.ID, err)
// release io
io.Close()
mgr.IOs.Remove(containerMeta.ID)
}

logrus.Errorf("failed to recover container: %s, %v", containerMeta.ID, err)
// release io
io.Close()
mgr.IOs.Remove(containerMeta.ID)

return nil
}
return mgr.Store.ForEach(fn)
Expand Down

0 comments on commit 1f2b6ee

Please sign in to comment.