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

feature: add disk quota for container metadata directory #2102

Merged
merged 1 commit into from
Aug 21, 2018

Conversation

rudyfly
Copy link
Collaborator

@rudyfly rudyfly commented Aug 15, 2018

Ⅰ. Describe what this PR did

Add disk quota for container metadata directory, use to limit the size
of container's log files.

Ⅱ. Does this pull request fix one issue?

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

Added test case TestRunWithDiskQuotaForLog

Ⅳ. Describe how to verify it

run test case TestRunWithDiskQuotaForLog

Ⅴ. Special notes for reviews

Signed-off-by: Rudy Zhang [email protected]

@codecov-io
Copy link

codecov-io commented Aug 15, 2018

Codecov Report

Merging #2102 into master will decrease coverage by 0.11%.
The diff coverage is 29.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2102      +/-   ##
==========================================
- Coverage   64.88%   64.77%   -0.12%     
==========================================
  Files         208      208              
  Lines       16458    16482      +24     
==========================================
- Hits        10679    10676       -3     
- Misses       4451     4477      +26     
- Partials     1328     1329       +1
Flag Coverage Δ
#criv1alpha1test 32.96% <6.81%> (-0.19%) ⬇️
#criv1alpha2test 33.77% <6.81%> (-0.05%) ⬇️
#integrationtest 39.48% <29.54%> (-0.09%) ⬇️
#unittest 23.9% <0%> (-0.04%) ⬇️
Impacted Files Coverage Δ
storage/quota/quota.go 17.82% <0%> (ø) ⬆️
daemon/mgr/container_storage.go 47.44% <13.63%> (-1.79%) ⬇️
daemon/mgr/container.go 55.87% <58.82%> (-0.18%) ⬇️
apis/server/utils.go 61.9% <0%> (-4.77%) ⬇️
ctrd/image.go 76.75% <0%> (-2.2%) ⬇️
cri/v1alpha1/cri.go 63.44% <0%> (-0.69%) ⬇️
daemon/logger/jsonfile/utils.go 73.17% <0%> (+1.62%) ⬆️
ctrd/watch.go 80.3% <0%> (+4.54%) ⬆️

@@ -331,3 +333,65 @@ func (suite *PouchRunVolumeSuite) TestRunWithDiskQuota(c *check.C) {

c.Assert(found, check.Equals, true)
}

// TestRunWithDiskQuota tests running container with --disk-quota.
Copy link
Contributor

Choose a reason for hiding this comment

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

%s/TestRunWithDiskQuota/TestRunWithDiskQuotaForLog


// set container's metadata directory diskquota, for limit the size of container's logs
metaDir := mgr.Store.Path(c.ID)
err = quota.SetDiskQuota(metaDir, defaultQuota, newID)
Copy link
Contributor

Choose a reason for hiding this comment

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

rootfs will be set diskquota twice, will it be a problem? just a question

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is not a problem...

}

defer func() {
if ret := mgr.Unmount(ctx, c); ret != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

can not get the error info when Unmount failed

Add disk quota for container metadata directory, use to limit the size
of container's log files.

Signed-off-by: Rudy Zhang <[email protected]>
@HusterWan
Copy link
Contributor

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Aug 21, 2018
@HusterWan HusterWan merged commit c4fd9bb into AliyunContainerService:master Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants