Skip to content

Commit

Permalink
bugfix: sync abnormal container status when start pouchd
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Wan <[email protected]>
  • Loading branch information
HusterWan committed Apr 4, 2018
1 parent 95b9d9c commit d132861
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 @@ -170,15 +170,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 d132861

Please sign in to comment.