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: return pid with 0 rather than -1 #2269

Merged
merged 1 commit into from
Sep 26, 2018

Conversation

starnop
Copy link
Contributor

@starnop starnop commented Sep 21, 2018

Signed-off-by: Starnop starnop@163.com

Ⅰ. Describe what this PR did

Kubernetes will check the value of pid when the container stopped and the pid is 0 when container stopped, so when we build network namespace, we should make a judgment according to whether Pid equals to 0 rather than -1 in CRI Manager.

Ⅱ. Does this pull request fix one issue?

fixes #2255

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

Has been updated.

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

Signed-off-by: Starnop <starnop@163.com>
@codecov
Copy link

codecov bot commented Sep 21, 2018

Codecov Report

Merging #2269 into master will decrease coverage by 0.1%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2269      +/-   ##
==========================================
- Coverage   66.76%   66.66%   -0.11%     
==========================================
  Files         208      208              
  Lines       16932    16938       +6     
==========================================
- Hits        11305    11292      -13     
- Misses       4261     4277      +16     
- Partials     1366     1369       +3
Flag Coverage Δ
#criv1alpha1test 32.5% <0%> (-0.06%) ⬇️
#criv1alpha2test 35.95% <0%> (-0.03%) ⬇️
#integrationtest 39.49% <0%> (-0.05%) ⬇️
#nodee2etest 33.25% <0%> (-0.16%) ⬇️
#unittest 23.76% <100%> (ø) ⬆️
Impacted Files Coverage Δ
daemon/mgr/container_state.go 87.23% <ø> (ø) ⬆️
cri/v1alpha2/cri_utils.go 90.33% <100%> (-0.3%) ⬇️
cri/v1alpha1/cri_utils.go 83.22% <100%> (ø) ⬆️
cri/ocicni/cni_manager.go 65% <0%> (-15%) ⬇️
apis/server/utils.go 61.9% <0%> (-4.77%) ⬇️
ctrd/image.go 76.75% <0%> (-2.2%) ⬇️
daemon/mgr/system.go 76.22% <0%> (-1.64%) ⬇️
ctrd/container.go 59.28% <0%> (-0.96%) ⬇️
daemon/containerio/container_io.go 74.86% <0%> (-0.83%) ⬇️
cri/v1alpha2/cri.go 66.46% <0%> (-0.3%) ⬇️
... and 6 more

@pouchrobot pouchrobot added kind/bug This is bug report for project size/S labels Sep 21, 2018
@@ -97,7 +97,7 @@ func (c *Container) SetStatusRunning(pid int64) {
// When a container's status turns to StatusStopped, the following fields need updated:
// Status -> StatusStopped
// FinishedAt -> time.Now()
// Pid -> -1
// Pid -> 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 good catch.

Copy link
Contributor

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fuweid fuweid merged commit dbd12d6 into AliyunContainerService:master Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] Can't get pid from container which was stopped
4 participants