-
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: we should set Running flag to true when started container #1604
bugfix: we should set Running flag to true when started container #1604
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1604 +/- ##
==========================================
- Coverage 41.64% 41.48% -0.16%
==========================================
Files 268 271 +3
Lines 17408 17568 +160
==========================================
+ Hits 7249 7288 +39
- Misses 9263 9381 +118
- Partials 896 899 +3
|
daemon/mgr/container_state.go
Outdated
@@ -90,6 +90,7 @@ func (c *Container) SetStatusRunning(pid int64) { | |||
c.State.StartedAt = time.Now().UTC().Format(utils.TimeLayout) | |||
c.State.Pid = pid | |||
c.State.ExitCode = 0 | |||
c.State.Running = true |
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.
Do we need to set c.State.Running
to flase when container stop?
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.
Good point, i will optimize soon
Signed-off-by: Michael Wan <zirenwan@gmail.com>
@@ -133,4 +137,33 @@ func (c *Container) SetStatusUnpaused() { | |||
c.Lock() | |||
defer c.Unlock() | |||
c.State.Status = types.StatusRunning | |||
c.setStatusFlags(types.StatusRunning) |
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.
I just wonder why use a function instead of a single line like c.State.Running=true
?
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.
we have 4 flags : Dead, Paused, Restarting and Running , the flags are exclusive,so when set one flag, we should unset others. WDYT? @Ace-Tang
LGTM |
Signed-off-by: Michael Wan zirenwan@gmail.com
Ⅰ. Describe what this PR did
SetStatus
set Running flag to true when started a containerⅡ. Does this pull request fix one issue?
fixes #1602
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews