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: we should set Running flag to true when started container #1604

Merged
merged 1 commit into from
Jun 28, 2018

Conversation

HusterWan
Copy link
Contributor

Signed-off-by: Michael Wan [email protected]

Ⅰ. 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

@codecov-io
Copy link

codecov-io commented Jun 27, 2018

Codecov Report

Merging #1604 into master will decrease coverage by 0.15%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
daemon/mgr/container_state.go 87.23% <100%> (+4.13%) ⬆️
apis/opts/config/blkio.go 0% <0%> (-69.67%) ⬇️
apis/opts/config/runtime.go 58.33% <0%> (-8.34%) ⬇️
cli/container.go 0% <0%> (ø) ⬆️
config/opt/runtime.go 45.83% <0%> (ø)
cli/ulimit.go 0% <0%> (ø)
cli/blkio.go 69.66% <0%> (ø)
daemon/mgr/container.go 50.62% <0%> (+0.15%) ⬆️
ctrd/image.go 79.42% <0%> (+2.85%) ⬆️

@@ -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
Copy link
Contributor

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?

Copy link
Contributor Author

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

@@ -133,4 +137,33 @@ func (c *Container) SetStatusUnpaused() {
c.Lock()
defer c.Unlock()
c.State.Status = types.StatusRunning
c.setStatusFlags(types.StatusRunning)
Copy link
Contributor

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 ?

Copy link
Contributor Author

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

@Ace-Tang
Copy link
Contributor

LGTM

@Ace-Tang Ace-Tang merged commit de5e75f into AliyunContainerService:master Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] SetStatus should set Running to true when started container
3 participants