@@ -27,14 +27,44 @@ import (
2727
2828 "github.com/containerd/containerd/log"
2929 "github.com/containerd/containerd/mount"
30+ "github.com/containerd/containerd/plugin"
3031 "github.com/containerd/containerd/snapshots"
3132 "github.com/containerd/containerd/snapshots/devmapper/dmsetup"
3233 "github.com/containerd/containerd/snapshots/storage"
3334 "github.com/hashicorp/go-multierror"
35+ ocispec "github.com/opencontainers/image-spec/specs-go/v1"
3436 "github.com/pkg/errors"
3537 "github.com/sirupsen/logrus"
3638)
3739
40+ func init () {
41+ plugin .Register (& plugin.Registration {
42+ Type : plugin .SnapshotPlugin ,
43+ ID : "devmapper" ,
44+ Config : & Config {
45+ PoolName : "containerd-pool" ,
46+ BaseImageSize : "128Mb" ,
47+ },
48+ InitFn : func (ic * plugin.InitContext ) (interface {}, error ) {
49+ ic .Meta .Platforms = append (ic .Meta .Platforms , ocispec.Platform {
50+ OS : "linux" ,
51+ Architecture : "amd64" ,
52+ })
53+
54+ config , ok := ic .Config .(* Config )
55+ if ! ok {
56+ return nil , errors .New ("invalid devmapper configuration" )
57+ }
58+
59+ if config .RootPath == "" {
60+ config .RootPath = ic .Root
61+ }
62+
63+ return NewSnapshotter (ic .Context , config )
64+ },
65+ })
66+ }
67+
3868const (
3969 metadataFileName = "metadata.db"
4070 fsTypeExt4 = "ext4"
0 commit comments