mirror of
https://github.com/containerd/containerd.git
synced 2026-08-09 09:33:06 +00:00
diff/walking: enable mount manager
The default walking applier performs a real temporary mount for unpacking, but the mount manager failed to adapt to the walking differ. This fixes the EROFS snapshotter together with the default walking differ, otherwise it reports: ``` ctr: apply layer error for "[]": failed to extract layer sha256:[]: failed to mount /var/lib/containerd/tmpmounts/containerd-mount3992073457: internal mount option "X-containerd.mkfs.fs=ext4" was not consumed by the mount manager ``` Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
This commit is contained in:
@@ -17,9 +17,12 @@
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/containerd/containerd/v2/core/diff"
|
||||
"github.com/containerd/containerd/v2/core/diff/apply"
|
||||
"github.com/containerd/containerd/v2/core/metadata"
|
||||
"github.com/containerd/containerd/v2/core/mount"
|
||||
"github.com/containerd/containerd/v2/plugins"
|
||||
"github.com/containerd/containerd/v2/plugins/diff/walking"
|
||||
"github.com/containerd/platforms"
|
||||
@@ -33,6 +36,7 @@ func init() {
|
||||
ID: "walking",
|
||||
Requires: []plugin.Type{
|
||||
plugins.MetadataPlugin,
|
||||
plugins.MountManagerPlugin,
|
||||
},
|
||||
InitFn: func(ic *plugin.InitContext) (any, error) {
|
||||
md, err := ic.GetSingle(plugins.MetadataPlugin)
|
||||
@@ -40,12 +44,19 @@ func init() {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var mm mount.Manager
|
||||
if mountsI, err := ic.GetSingle(plugins.MountManagerPlugin); err == nil {
|
||||
mm = mountsI.(mount.Manager)
|
||||
} else if !errors.Is(err, plugin.ErrPluginNotFound) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ic.Meta.Platforms = append(ic.Meta.Platforms, platforms.DefaultSpec())
|
||||
cs := md.(*metadata.DB).ContentStore()
|
||||
|
||||
return diffPlugin{
|
||||
Comparer: walking.NewWalkingDiff(cs),
|
||||
Applier: apply.NewFileSystemApplier(cs),
|
||||
Applier: apply.NewFileSystemApplierWithMountManager(cs, mm),
|
||||
}, nil
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user