Skip to content

Commit

Permalink
snapshot: reconstruct function to handle remote mounts
Browse files Browse the repository at this point in the history
Signed-off-by: ChengyuZhu6 <[email protected]>
  • Loading branch information
ChengyuZhu6 committed Dec 4, 2023
1 parent de4cbf5 commit 659424d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion snapshot/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
8 changes: 4 additions & 4 deletions snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 659424d

Please sign in to comment.