Merge pull request #2261 from AkihiroSuda/native-snapshotter

enable native (formerly naive) snapshotter by default
This commit is contained in:
Stephen Day 2018-04-02 11:33:25 -07:00 committed by GitHub
commit 04efcc83a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 18 deletions

View File

@ -20,6 +20,7 @@ import (
_ "github.com/containerd/aufs"
_ "github.com/containerd/containerd/linux"
_ "github.com/containerd/containerd/metrics/cgroups"
_ "github.com/containerd/containerd/snapshots/native"
_ "github.com/containerd/containerd/snapshots/overlay"
_ "github.com/containerd/zfs"
)

View File

@ -19,5 +19,5 @@
package main
import (
_ "github.com/containerd/containerd/snapshots/naive"
_ "github.com/containerd/containerd/snapshots/native"
)

View File

@ -39,7 +39,7 @@ import (
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/snapshots"
"github.com/containerd/containerd/snapshots/naive"
"github.com/containerd/containerd/snapshots/native"
"github.com/gogo/protobuf/types"
digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
@ -55,7 +55,7 @@ func testDB(t *testing.T) (context.Context, *DB, func()) {
t.Fatal(err)
}
snapshotter, err := naive.NewSnapshotter(filepath.Join(dirname, "naive"))
snapshotter, err := native.NewSnapshotter(filepath.Join(dirname, "native"))
if err != nil {
t.Fatal(err)
}
@ -70,7 +70,7 @@ func testDB(t *testing.T) (context.Context, *DB, func()) {
t.Fatal(err)
}
db := NewDB(bdb, cs, map[string]snapshots.Snapshotter{"naive": snapshotter})
db := NewDB(bdb, cs, map[string]snapshots.Snapshotter{"native": snapshotter})
if err := db.Init(ctx); err != nil {
t.Fatal(err)
}
@ -544,7 +544,7 @@ func create(obj object, tx *bolt.Tx, is images.Store, cs content.Store, sn snaps
node = &gc.Node{
Type: ResourceSnapshot,
Namespace: namespace,
Key: fmt.Sprintf("naive/%s", v.key),
Key: fmt.Sprintf("native/%s", v.key),
}
}
case testImage:
@ -563,7 +563,7 @@ func create(obj object, tx *bolt.Tx, is images.Store, cs content.Store, sn snaps
container := containers.Container{
ID: v.id,
SnapshotKey: v.snapshot,
Snapshotter: "naive",
Snapshotter: "native",
Labels: obj.labels,
Runtime: containers.RuntimeInfo{
@ -658,7 +658,7 @@ func newStores(t testing.TB) (*DB, content.Store, snapshots.Snapshotter, func())
t.Fatal(err)
}
nsn, err := naive.NewSnapshotter(filepath.Join(td, "snapshots"))
nsn, err := native.NewSnapshotter(filepath.Join(td, "snapshots"))
if err != nil {
t.Fatal(err)
}
@ -668,9 +668,9 @@ func newStores(t testing.TB) (*DB, content.Store, snapshots.Snapshotter, func())
t.Fatal(err)
}
mdb := NewDB(db, lcs, map[string]snapshots.Snapshotter{"naive": nsn})
mdb := NewDB(db, lcs, map[string]snapshots.Snapshotter{"native": nsn})
return mdb, mdb.ContentStore(), mdb.Snapshotter("naive"), func() {
return mdb, mdb.ContentStore(), mdb.Snapshotter("native"), func() {
os.RemoveAll(td)
}
}

View File

@ -25,17 +25,17 @@ import (
"github.com/boltdb/bolt"
"github.com/containerd/containerd/snapshots"
"github.com/containerd/containerd/snapshots/naive"
"github.com/containerd/containerd/snapshots/native"
"github.com/containerd/containerd/snapshots/testsuite"
"github.com/containerd/containerd/testutil"
)
func newTestSnapshotter(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error) {
naiveRoot := filepath.Join(root, "naive")
if err := os.Mkdir(naiveRoot, 0770); err != nil {
nativeRoot := filepath.Join(root, "native")
if err := os.Mkdir(nativeRoot, 0770); err != nil {
return nil, nil, err
}
snapshotter, err := naive.NewSnapshotter(naiveRoot)
snapshotter, err := native.NewSnapshotter(nativeRoot)
if err != nil {
return nil, nil, err
}
@ -45,7 +45,7 @@ func newTestSnapshotter(ctx context.Context, root string) (snapshots.Snapshotter
return nil, nil, err
}
sn := NewDB(db, nil, map[string]snapshots.Snapshotter{"naive": snapshotter}).Snapshotter("naive")
sn := NewDB(db, nil, map[string]snapshots.Snapshotter{"native": snapshotter}).Snapshotter("native")
return sn, func() error {
if err := sn.Close(); err != nil {

View File

@ -14,7 +14,7 @@
limitations under the License.
*/
package naive
package native
import (
"context"
@ -35,7 +35,7 @@ import (
func init() {
plugin.Register(&plugin.Registration{
Type: plugin.SnapshotPlugin,
ID: "naive",
ID: "native",
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
ic.Meta.Platforms = append(ic.Meta.Platforms, platforms.DefaultSpec())
return NewSnapshotter(ic.Root)

View File

@ -14,7 +14,7 @@
limitations under the License.
*/
package naive
package native
import (
"context"

View File

@ -22,5 +22,5 @@ const (
// DefaultSnapshotter will set the default snapshotter for the platform.
// This will be based on the client compilation target, so take that into
// account when choosing this value.
DefaultSnapshotter = "naive"
DefaultSnapshotter = "native"
)