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] Modify the logic of obtaining image ref when deleting snapshots #170

Merged
merged 1 commit into from
Sep 15, 2022

Conversation

power-more
Copy link
Contributor

In some cases, such as a user-defined label in the upper layer, the snapshot label is not empty, but does not contain
"containerd.io/snapshot/cri.image-ref", the function should continue to execute normally instead of returning an error.

Signed-off-by: zhaoshang zhaoshangsjtu@linux.alibaba.com

@codecov-commenter
Copy link

codecov-commenter commented Sep 13, 2022

Codecov Report

Base: 30.25% // Head: 30.25% // No change to project coverage 👍

Coverage data is based on head (3c88f4a) compared to base (8af7157).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #170   +/-   ##
=======================================
  Coverage   30.25%   30.25%           
=======================================
  Files          20       20           
  Lines        1626     1626           
=======================================
  Hits          492      492           
  Misses       1069     1069           
  Partials       65       65           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

if err := o.fs.DelSnapshot(imageID); err != nil {
return errors.Wrap(err, "failed to delete snapshot in cache manager")
if _, ok := snap.Labels[label.TargetSnapshotRef]; ok {
if imageID, ok := snap.Labels[label.CRIImageRef]; ok {
Copy link
Member

Choose a reason for hiding this comment

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

Why need to check if a particular label existed for the deleted snapshot? What's the problem if we delete a snapshot which does not meet the labels combination?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it work for OCI image layer?

Copy link
Member

Choose a reason for hiding this comment

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

As discussed with @power-more , it does not affect the OCI layer.

In some cases, such as a user-defined label in the upper layer, the
snapshot label is not empty, but does not contain
"containerd.io/snapshot/cri.image-ref", the function should continue to
execute normally instead of returning an error.

Signed-off-by: zhaoshang <zhaoshangsjtu@linux.alibaba.com>
@changweige
Copy link
Member

LGTM

@changweige changweige merged commit 0f88fb6 into containerd:main Sep 15, 2022
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.

4 participants