-
Notifications
You must be signed in to change notification settings - Fork 950
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: should initialize ContainerIO for all container #2668
bugfix: should initialize ContainerIO for all container #2668
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2668 +/- ##
==========================================
+ Coverage 56.82% 69.63% +12.8%
==========================================
Files 281 281
Lines 18794 18795 +1
==========================================
+ Hits 10679 13087 +2408
+ Misses 6879 4250 -2629
- Partials 1236 1458 +222
|
// when container is stopped and then pouchd restarts, the restore logic should | ||
// initialize the existing container IO settings even though they are not alive. | ||
func (suite *PouchDaemonSuite) TestRestartStoppedContainerAfterDaemonRestart(c *check.C) { | ||
cfg := daemon.NewConfig() |
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.
Is start daemon with config file? or with command line as before?
And we need think about alios test.
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.
daemon/mgr/container.go
Outdated
id := c.Key() | ||
// recover the running or paused container. | ||
|
||
// NOTE: when pouch restarts, we need to initialize container IO |
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.
s/restarts/is restarting
@@ -280,6 +281,13 @@ func (mgr *ContainerManager) Restore(ctx context.Context) error { | |||
return err | |||
} | |||
|
|||
// recover the running or paused container. | |||
if !(c.IsRunning() || c.IsPaused()) { |
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.
running or paused containers don't to recover?
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.
no need to recover the created/stopped container
For now, when pouchd restarts, the restore function only re-connects to existing running/pause containers with initializing container IO. However, the stopped container also needs the container IO if the user want to restart the container. For the case, we need to initialize container IO for all existing container, not just for running/pause containers. Signed-off-by: Wei Fu <fuweid89@gmail.com>
LGTM |
Ⅰ. Describe what this PR did
For now, when pouchd restarts, the restore function only re-connects to
existing running/pause containers with initializing container IO.
However, the stopped container also needs the container IO if the user
want to restart the container. For the case, we need to initialize
container IO for all existing container, not just for running/pause
containers.
Signed-off-by: Wei Fu fuweid89@gmail.com
Ⅱ. Does this pull request fix one issue?
none
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
add one
Ⅳ. Describe how to verify it
CI
Ⅴ. Special notes for reviews