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

cache manager: fix cache manager failure in none daemon mode #124

Merged
merged 1 commit into from
Aug 10, 2022

Conversation

power-more
Copy link
Contributor

Previously, both AddSnapshot and DelSnapshot will not be executed in
the none daemon mode. The fundamental reason is that the incoming
parameter is the imageID obtained from the daemon. Now we adjust the
function call path to bypass the daemon and get the imageID directly
from snapshot labels.

For AddSnapshot, we separate it from prepareRemoteSnapshot, run it
separately, and parse the imageID directly from the snapshot label.

For DelSnapshot, we advance it from Cleanup to Remove.

Signed-off-by: zhaoshang [email protected]

Previously, both AddSnapshot and DelSnapshot will not be executed in
the none daemon mode. The fundamental reason is that the incoming
parameter is the imageID obtained from the daemon. Now we adjust the
function call path to bypass the daemon and get the imageID directly
from snapshot labels.

For AddSnapshot, we separate it from prepareRemoteSnapshot, run it
separately, and parse the imageID directly from the snapshot label.

For DelSnapshot, we advance it from Cleanup to Remove.

Signed-off-by: zhaoshang <[email protected]>
@codecov-commenter
Copy link

Codecov Report

Merging #124 (60cc64f) into main (92d4e57) will increase coverage by 0.66%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #124      +/-   ##
==========================================
+ Coverage   28.44%   29.11%   +0.66%     
==========================================
  Files          18       19       +1     
  Lines        1494     1604     +110     
==========================================
+ Hits          425      467      +42     
- Misses       1012     1075      +63     
- Partials       57       62       +5     
Impacted Files Coverage Δ
pkg/filesystem/fs/fs.go 1.15% <0.00%> (-0.01%) ⬇️
pkg/auth/keychain.go 32.55% <0.00%> (-2.45%) ⬇️
config/config.go 0.00% <0.00%> (ø)
pkg/auth/kubesecret.go 34.02% <0.00%> (ø)
cmd/containerd-nydus-grpc/pkg/command/flags.go 76.88% <0.00%> (+0.32%) ⬆️
pkg/filesystem/fs/blob_manager.go 55.55% <0.00%> (+11.11%) ⬆️

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

@changweige changweige requested a review from imeoer August 4, 2022 08:54
@@ -300,6 +300,11 @@ func (o *snapshotter) Prepare(ctx context.Context, key, parent string, opts ...s
}

logCtx.Infof("found nydus meta layer id %s, parpare remote snapshot", id)

if err := o.fs.AddSnapshot(info.Labels); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why only do AddSnapshot when the container running? If the user deletes the image before any container run, can nydus blobs be GC-ed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay I miss it, blob cache is generated at only container running.

Copy link
Collaborator

@imeoer imeoer left a comment

Choose a reason for hiding this comment

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

LGTM

@changweige changweige merged commit cd6452d into containerd:main Aug 10, 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