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: fix wrongly update cpu-quota to 0 #2684

Merged
merged 1 commit into from
Jan 24, 2019

Conversation

HusterWan
Copy link
Contributor

Signed-off-by: Michael Wan zirenwan@gmail.com

Ⅰ. Describe what this PR did

On kernel, cpu.cfs_quota_us only support:

  • -1: not limit container's cpu-quota
  • [1000, ∞) : correct values for cpu-quota

So 0 is not a valid value for cpu-quota, we can use 0 to distinct not set from other values in api. In PouchContainer API:

  • 0: don't set cpu-quota
  • -1: not limit containers'cpu-quota
  • [1000, ∞) : correct values for cpu-quota

Ⅱ. Does this pull request fix one issue?

fix: #2538

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

add test case: PouchUpdateSuite.TestUpdateContainerCPUQuota

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov
Copy link

codecov bot commented Jan 23, 2019

Codecov Report

Merging #2684 into master will increase coverage by 0.61%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2684      +/-   ##
==========================================
+ Coverage   66.85%   67.46%   +0.61%     
==========================================
  Files         276      278       +2     
  Lines       17361    17392      +31     
==========================================
+ Hits        11606    11734     +128     
+ Misses       4490     4338     -152     
- Partials     1265     1320      +55
Flag Coverage Δ
#criv1alpha2_test 39.36% <100%> (?)
#integration_test_0 36.24% <100%> (-0.2%) ⬇️
#integration_test_1 35.18% <0%> (-0.03%) ⬇️
#integration_test_2 ?
#integration_test_3 35.13% <0%> (-0.06%) ⬇️
#node_e2e_test 35.11% <0%> (+0.01%) ⬆️
#unittest 27.36% <0%> (ø) ⬆️
Impacted Files Coverage Δ
daemon/mgr/container.go 58.4% <100%> (-0.64%) ⬇️
storage/volume/modules/tmpfs/tmpfs.go 28.2% <0%> (-47.44%) ⬇️
daemon/events/filter.go 60% <0%> (-40%) ⬇️
apis/server/system_bridge.go 17.2% <0%> (-32.26%) ⬇️
apis/server/utils.go 53.84% <0%> (-21.16%) ⬇️
pkg/utils/mount.go 0% <0%> (-19.24%) ⬇️
daemon/mgr/container_list.go 61.16% <0%> (-17.48%) ⬇️
daemon/mgr/system.go 58.77% <0%> (-16.04%) ⬇️
daemon/events/events.go 68.36% <0%> (-13.27%) ⬇️
pkg/utils/filters/filter.go 65% <0%> (-12.5%) ⬇️
... and 40 more

@pouchrobot pouchrobot added kind/bug This is bug report for project size/M labels Jan 23, 2019
@HusterWan HusterWan force-pushed the zr/fix-cpuquota branch 4 times, most recently from 2d2837d to f2d635a Compare January 23, 2019 08:58
@pouchrobot pouchrobot added size/L and removed size/M labels Jan 24, 2019
@HusterWan HusterWan force-pushed the zr/fix-cpuquota branch 2 times, most recently from ccc62e3 to 67b1823 Compare January 24, 2019 06:15
Signed-off-by: Michael Wan <zirenwan@gmail.com>
@wangforthinker
Copy link
Contributor

LGTM

1 similar comment
@rudyfly
Copy link
Collaborator

rudyfly commented Jan 24, 2019

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Jan 24, 2019
@rudyfly rudyfly merged commit 81ae43f into AliyunContainerService:master Jan 24, 2019
}
containerID := result[0].ID

if string(result[0].HostConfig.CPUQuota) == cpuQuota {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it should be "!=" rather than "=="

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 LGTM one maintainer or community participant agrees to merge the pull reuqest. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] pouch inspect can not get valid cpuquota
5 participants