Merge pull request #4533 from sedflix/aufs-seperate-plugin
feat(snapshot::aufs): config root_path
This commit is contained in:
commit
1484593ee9
@ -18,4 +18,4 @@
|
||||
|
||||
package main
|
||||
|
||||
import _ "github.com/containerd/aufs"
|
||||
import _ "github.com/containerd/aufs/plugin"
|
||||
|
@ -103,4 +103,4 @@ github.com/containerd/zfs 9abf673ca6ff9ab8d9bd776a4cef
|
||||
github.com/mistifyio/go-zfs f784269be439d704d3dfa1906f45dd848fed2beb
|
||||
|
||||
# aufs dependencies
|
||||
github.com/containerd/aufs 371312c1e31c210a21e49bf3dfd3f31729ed9f2f
|
||||
github.com/containerd/aufs dab0cbea06f43329c07667afe1a70411ad555a86
|
||||
|
1
vendor/github.com/containerd/aufs/README.md
generated
vendored
1
vendor/github.com/containerd/aufs/README.md
generated
vendored
@ -1,7 +1,6 @@
|
||||
# aufs snapshotter
|
||||
|
||||
[](https://travis-ci.org/containerd/aufs)
|
||||
|
||||
[](https://codecov.io/gh/containerd/aufs)
|
||||
|
||||
|
||||
|
15
vendor/github.com/containerd/aufs/aufs.go
generated
vendored
15
vendor/github.com/containerd/aufs/aufs.go
generated
vendored
@ -32,25 +32,12 @@ import (
|
||||
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/mount"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/snapshots"
|
||||
"github.com/containerd/containerd/snapshots/storage"
|
||||
"github.com/containerd/continuity/fs"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func init() {
|
||||
plugin.Register(&plugin.Registration{
|
||||
Type: plugin.SnapshotPlugin,
|
||||
ID: "aufs",
|
||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||
ic.Meta.Platforms = append(ic.Meta.Platforms, platforms.DefaultSpec())
|
||||
ic.Meta.Exports["root"] = ic.Root
|
||||
return New(ic.Root)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
var (
|
||||
dirperm sync.Once
|
||||
@ -65,7 +52,7 @@ type snapshotter struct {
|
||||
// New creates a new snapshotter using aufs
|
||||
func New(root string) (snapshots.Snapshotter, error) {
|
||||
if err := supported(); err != nil {
|
||||
return nil, errors.Wrap(plugin.ErrSkipPlugin, err.Error())
|
||||
return nil, err
|
||||
}
|
||||
if err := os.MkdirAll(root, 0700); err != nil {
|
||||
return nil, err
|
||||
|
22
vendor/github.com/containerd/aufs/go.mod
generated
vendored
Normal file
22
vendor/github.com/containerd/aufs/go.mod
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
module github.com/containerd/aufs
|
||||
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/Microsoft/hcsshim v0.8.7 // indirect
|
||||
github.com/containerd/containerd v1.3.1-0.20191213020239-082f7e3aed57
|
||||
github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb
|
||||
github.com/containerd/ttrpc v0.0.0-20191028202541-4f1b8fe65a5c // indirect
|
||||
github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd // indirect
|
||||
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
|
||||
github.com/gogo/protobuf v1.3.1 // indirect
|
||||
github.com/google/go-cmp v0.3.1 // indirect
|
||||
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
|
||||
github.com/opencontainers/image-spec v1.0.1 // indirect
|
||||
github.com/opencontainers/runc v1.0.0-rc9 // indirect
|
||||
github.com/pkg/errors v0.8.1
|
||||
go.etcd.io/bbolt v1.3.3 // indirect
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect
|
||||
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449
|
||||
google.golang.org/grpc v1.25.1 // indirect
|
||||
)
|
60
vendor/github.com/containerd/aufs/plugin/plugin.go
generated
vendored
Normal file
60
vendor/github.com/containerd/aufs/plugin/plugin.go
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"github.com/containerd/aufs"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
||||
// Config represents configuration for the zfs plugin
|
||||
type Config struct {
|
||||
// Root directory for the plugin
|
||||
RootPath string `toml:"root_path"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
plugin.Register(&plugin.Registration{
|
||||
Type: plugin.SnapshotPlugin,
|
||||
ID: "aufs",
|
||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||
ic.Meta.Platforms = append(ic.Meta.Platforms, platforms.DefaultSpec())
|
||||
|
||||
// get config
|
||||
config, ok := ic.Config.(*Config)
|
||||
if !ok {
|
||||
return nil, errors.New("invalid aufs configuration")
|
||||
}
|
||||
|
||||
// use default ic.Root as root path if config doesn't have a valid root path
|
||||
root := ic.Root
|
||||
if len(config.RootPath) != 0 {
|
||||
root = config.RootPath
|
||||
}
|
||||
ic.Meta.Exports["root"] = root
|
||||
|
||||
snapshotter, err := aufs.New(root)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(plugin.ErrSkipPlugin, err.Error())
|
||||
}
|
||||
return snapshotter, nil
|
||||
},
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user