Skip to content

Commit

Permalink
snapshot: pass image url into remote mout slice
Browse files Browse the repository at this point in the history
pass image url into remote mout slice.

Signed-off-by: ChengyuZhu6 <[email protected]>
  • Loading branch information
ChengyuZhu6 committed Aug 15, 2023
1 parent d338463 commit 2bb7063
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ func (o *snapshotter) Mounts(ctx context.Context, key string) ([]mount.Mount, er
metaSnapshotID = id
}
}

if config.GetPassImageURLEnabled() {
return o.passImageNameMounts(ctx, info.Parent)
}
snap, err := snapshot.GetSnapshot(ctx, o.ms, key)
if err != nil {
return nil, errors.Wrapf(err, "get snapshot %s", key)
Expand Down Expand Up @@ -716,7 +718,25 @@ func overlayMount(options []string) []mount.Mount {
},
}
}
func (o *snapshotter) passImageNameMounts(ctx context.Context, parent string) ([]mount.Mount, error) {
_, pInfo, _, err := snapshot.GetSnapshotInfo(ctx, o.ms, parent)
if err != nil {
return nil, errors.Wrapf(err, "passImageNameMounts get snapshot %q info failed", parent)
}
passImageOption := fmt.Sprintf("imageurl=%s", pInfo.Labels["containerd.io/snapshot/cri.image-ref"])

var overlayOptions []string
overlayOptions = append(overlayOptions, passImageOption)

return []mount.Mount{
{
Type: "fuse.nydus-overlayfs",
Source: "overlay",
Options: overlayOptions,
},
}, nil

}
func (o *snapshotter) prepareRemoteSnapshot(id string, labels map[string]string) error {
return o.fs.Mount(id, labels)
}
Expand Down

0 comments on commit 2bb7063

Please sign in to comment.