Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: sync abnormal container status when start pouchd #1056

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions daemon/mgr/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,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