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: removing image by ID should conflict with running container. #2926

Closed
wants to merge 2 commits into from

Conversation

zjumoon01
Copy link
Contributor

Ⅰ. Describe what this PR did

If image is used by a running container and this image has another tag,
there are two reference of this image. Remove the image by ID without
"--force" will success that is unexpected.

This patch will fix it. We should check if any containers using this
image ID.

Ⅱ. Does this pull request fix one issue?

NONE

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

Ⅳ. Describe how to verify it

step 1. Pull image registry.hub.docker.com/library/busybox:1.28
step 2. Tag this image to registry.hub.docker.com/library/busybox:tag2
step 3. Run a container with this image
step 4. Pouch rmi without "--force", the image will removed unexpected.

Ⅴ. Special notes for reviews

Updating disk quota to a running container will set quota ID to all files
and directories under UpperDir in function SetQuotaForDir, which will
take a long while. Because it will costs much time in
getMountpointFstype, CheckRegularFile and filepath.Walk.

Call SetQuotaForDir Asynchronously when updating disk quota .

Signed-off-by: Wang Rui <baijia.wr@antfin.com>
If image is used by a running container and this image has another tag,
there are two reference of this image. Remove the image by ID without
"--force" will success that is unexpected.

This patch will fix it. We should check if any containers using this
image ID. And add tests.

Signed-off-by: Wang Rui <baijia.wr@antfin.com>
@codecov
Copy link

codecov bot commented Jun 24, 2019

Codecov Report

Merging #2926 into master will decrease coverage by 15.7%.
The diff coverage is 30.76%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #2926       +/-   ##
===========================================
- Coverage   66.78%   51.07%   -15.71%     
===========================================
  Files         289      286        -3     
  Lines       18299    18178      -121     
===========================================
- Hits        12221     9285     -2936     
- Misses       4645     7396     +2751     
- Partials     1433     1497       +64
Flag Coverage Δ
#integration_test_0 36.14% <15.38%> (+0.05%) ⬆️
#integration_test_1 35.07% <30.76%> (-0.43%) ⬇️
#integration_test_2 ?
#integration_test_3 ?
#node_e2e_test 34.15% <7.69%> (-0.07%) ⬇️
#unittest ?
Impacted Files Coverage Δ
storage/quota/quota.go 6.45% <0%> (ø) ⬆️
daemon/mgr/container.go 56.19% <0%> (-3.75%) ⬇️
daemon/mgr/container_storage.go 43.92% <33.33%> (-10.99%) ⬇️
apis/server/image_bridge.go 60.44% <60%> (-18.02%) ⬇️
client/container_restart.go 0% <0%> (-100%) ⬇️
client/image_pull.go 0% <0%> (-100%) ⬇️
apis/opts/sysctl.go 0% <0%> (-100%) ⬇️
client/volume_create.go 0% <0%> (-100%) ⬇️
client/image_remove.go 0% <0%> (-100%) ⬇️
client/daemon_update.go 0% <0%> (-100%) ⬇️
... and 168 more

@pouchrobot pouchrobot added kind/bug This is bug report for project size/M labels Jun 24, 2019
@zjumoon01 zjumoon01 closed this Jun 24, 2019
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/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants