-
Notifications
You must be signed in to change notification settings - Fork 944
fix: should not start a paused container #2757
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
fix: should not start a paused container #2757
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2757 +/- ##
==========================================
- Coverage 69.42% 69.35% -0.08%
==========================================
Files 277 277
Lines 17412 17414 +2
==========================================
- Hits 12089 12077 -12
- Misses 4002 4015 +13
- Partials 1321 1322 +1
|
|
CI fails: |
|
Forget to modify test case |
also need to consider the API definition: |
|
Can we decide whether |
pouch should not start a paused container, or when create container
fail, pouch will do a clean to remove all container data in meta data.
```
func (mgr *ContainerManager) start(ctx context.Context, c *Container, options *types.ContainerStartOptions) error {
var err error
c.DetachKeys = options.DetachKeys
attachedVolumes := map[string]struct{}{}
defer func() {
if err == nil {
return
}
// release the container resources(network and containerio)
err = mgr.releaseContainerResources(c)
if err != nil {
logrus.Errorf("failed to release container(%s) resources: %v", c.ID, err)
}
// detach the volumes
for name := range attachedVolumes {
if _, err = mgr.VolumeMgr.Detach(ctx, name, map[string]string{volumetypes.OptionRef: c.ID}); err != nil {
logrus.Errorf("failed to detach volume(%s) when start container(%s) rollback: %v", name, c.ID, err)
}
}
}()
```
reproduce:
pouch pause $cid
pouch start $cid
then container was removed by pouchd
Signed-off-by: Ace-Tang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
pouch should not start a paused container, or when create container
fail, pouch will do a clean to remove all container data in meta data.
reproduce:
pouch pause $cid
pouch start $cid
then container was removed by pouchd
Signed-off-by: Ace-Tang [email protected]
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews