devmapper: register plugin
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
This commit is contained in:
parent
cec72efc2a
commit
2218275ec9
@ -22,6 +22,7 @@ import (
|
||||
_ "github.com/containerd/containerd/runtime/v1/linux"
|
||||
_ "github.com/containerd/containerd/runtime/v2"
|
||||
_ "github.com/containerd/containerd/runtime/v2/runc/options"
|
||||
_ "github.com/containerd/containerd/snapshots/devmapper"
|
||||
_ "github.com/containerd/containerd/snapshots/native"
|
||||
_ "github.com/containerd/containerd/snapshots/overlay"
|
||||
_ "github.com/containerd/zfs"
|
||||
|
@ -27,14 +27,44 @@ import (
|
||||
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/mount"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/snapshots"
|
||||
"github.com/containerd/containerd/snapshots/devmapper/dmsetup"
|
||||
"github.com/containerd/containerd/snapshots/storage"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func init() {
|
||||
plugin.Register(&plugin.Registration{
|
||||
Type: plugin.SnapshotPlugin,
|
||||
ID: "devmapper",
|
||||
Config: &Config{
|
||||
PoolName: "containerd-pool",
|
||||
BaseImageSize: "128Mb",
|
||||
},
|
||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||
ic.Meta.Platforms = append(ic.Meta.Platforms, ocispec.Platform{
|
||||
OS: "linux",
|
||||
Architecture: "amd64",
|
||||
})
|
||||
|
||||
config, ok := ic.Config.(*Config)
|
||||
if !ok {
|
||||
return nil, errors.New("invalid devmapper configuration")
|
||||
}
|
||||
|
||||
if config.RootPath == "" {
|
||||
config.RootPath = ic.Root
|
||||
}
|
||||
|
||||
return NewSnapshotter(ic.Context, config)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const (
|
||||
metadataFileName = "metadata.db"
|
||||
fsTypeExt4 = "ext4"
|
||||
|
Loading…
Reference in New Issue
Block a user