From 659424db60f42f4bb90145701354748eee830bb4 Mon Sep 17 00:00:00 2001 From: ChengyuZhu6 Date: Mon, 4 Dec 2023 17:44:14 +0800 Subject: [PATCH] snapshot: reconstruct function to handle remote mounts Signed-off-by: ChengyuZhu6 --- snapshot/process.go | 2 +- snapshot/snapshot.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/snapshot/process.go b/snapshot/process.go index ce90f5baf6..9f0da66f2d 100644 --- a/snapshot/process.go +++ b/snapshot/process.go @@ -52,7 +52,7 @@ func chooseProcessor(ctx context.Context, logger *logrus.Entry, } logger.Infof("Nydus remote snapshot %s is ready", id) - mounts, err := sn.mountRemote(ctx, labels, s, id) + mounts, err := sn.mountRemote(ctx, labels, s, id, key) return false, mounts, err } } diff --git a/snapshot/snapshot.go b/snapshot/snapshot.go index 108ab055d3..c2e7f43523 100644 --- a/snapshot/snapshot.go +++ b/snapshot/snapshot.go @@ -433,7 +433,7 @@ func (o *snapshotter) Mounts(ctx context.Context, key string) ([]mount.Mount, er } if needRemoteMounts { - return o.mountRemote(ctx, info.Labels, *snap, metaSnapshotID) + return o.mountRemote(ctx, info.Labels, *snap, metaSnapshotID, key) } return o.mountNative(ctx, info.Labels, *snap) @@ -531,7 +531,7 @@ func (o *snapshotter) View(ctx context.Context, key, parent string, opts ...snap } if needRemoteMounts { - return o.mountRemote(ctx, base.Labels, s, metaSnapshotID) + return o.mountRemote(ctx, base.Labels, s, metaSnapshotID, key) } return o.mountNative(ctx, base.Labels, s) } @@ -840,7 +840,7 @@ func overlayMount(options []string) []mount.Mount { // `s` is the upmost snapshot and `id` refers to the nydus meta snapshot // `s` and `id` can represent a different layer, it's useful when View an image -func (o *snapshotter) mountRemote(ctx context.Context, labels map[string]string, s storage.Snapshot, id string) ([]mount.Mount, error) { +func (o *snapshotter) mountRemote(ctx context.Context, labels map[string]string, s storage.Snapshot, id, key string) ([]mount.Mount, error) { var overlayOptions []string if _, ok := labels[label.OverlayfsVolatileOpt]; ok { overlayOptions = append(overlayOptions, "volatile") @@ -871,7 +871,7 @@ func (o *snapshotter) mountRemote(ctx context.Context, labels map[string]string, log.G(ctx).Infof("remote mount options %v", overlayOptions) if o.enableKataVolume { - return o.mountWithKataVolume(ctx, id, overlayOptions) + return o.mountWithKataVolume(ctx, id, overlayOptions, key) } // Add `extraoption` if NydusOverlayFS is enable or daemonMode is `None` if o.enableNydusOverlayFS || config.GetDaemonMode() == config.DaemonModeNone {