Merge pull request #2745 from crosbymichael/snapshot-warnings

Change unsupported snapshot warnings to INFO
This commit is contained in:
Michael Crosby 2018-10-26 15:22:04 -04:00 committed by GitHub
commit 7f8b405eac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 92 additions and 85 deletions

View File

@ -125,7 +125,7 @@ func New(ctx context.Context, config *srvconfig.Config) (*Server, error) {
instance, err := result.Instance() instance, err := result.Instance()
if err != nil { if err != nil {
if plugin.IsSkipPlugin(err) { if plugin.IsSkipPlugin(err) {
log.G(ctx).WithField("type", p.Type).Infof("skip loading plugin %q...", id) log.G(ctx).WithError(err).WithField("type", p.Type).Infof("skip loading plugin %q...", id)
} else { } else {
log.G(ctx).WithError(err).Warnf("failed to load plugin %s", id) log.G(ctx).WithError(err).Warnf("failed to load plugin %s", id)
} }
@ -251,8 +251,10 @@ func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]*plugin.Regis
for name, sn := range snapshottersRaw { for name, sn := range snapshottersRaw {
sn, err := sn.Instance() sn, err := sn.Instance()
if err != nil { if err != nil {
if !plugin.IsSkipPlugin(err) {
log.G(ic.Context).WithError(err). log.G(ic.Context).WithError(err).
Warnf("could not use snapshotter %v in metadata plugin", name) Warnf("could not use snapshotter %v in metadata plugin", name)
}
continue continue
} }
snapshotters[name] = sn.(snapshots.Snapshotter) snapshotters[name] = sn.(snapshots.Snapshotter)

View File

@ -77,7 +77,7 @@ func NewSnapshotter(root string) (snapshots.Snapshotter, error) {
return nil, err return nil, err
} }
if mnt.FSType != "btrfs" { if mnt.FSType != "btrfs" {
return nil, fmt.Errorf("path %s must be a btrfs filesystem to be used with the btrfs snapshotter", root) return nil, errors.Wrapf(plugin.ErrSkipPlugin, "path %s must be a btrfs filesystem to be used with the btrfs snapshotter", root)
} }
var ( var (
active = filepath.Join(root, "active") active = filepath.Join(root, "active")

View File

@ -64,7 +64,7 @@ func SnapshotterSuite(t *testing.T, name string, snapshotterFn func(ctx context.
t.Run("CloseTwice", makeTest(name, snapshotterFn, closeTwice)) t.Run("CloseTwice", makeTest(name, snapshotterFn, closeTwice))
t.Run("RootPermission", makeTest(name, snapshotterFn, checkRootPermission)) t.Run("RootPermission", makeTest(name, snapshotterFn, checkRootPermission))
t.Run("128LayersMount", makeTest(name, snapshotterFn, check128LayersMount)) t.Run("128LayersMount", makeTest(name, snapshotterFn, check128LayersMount(name)))
} }
func makeTest(name string, snapshotterFn func(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error), fn func(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshotter, work string)) func(t *testing.T) { func makeTest(name string, snapshotterFn func(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error), fn func(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshotter, work string)) func(t *testing.T) {
@ -863,7 +863,11 @@ func checkRootPermission(ctx context.Context, t *testing.T, snapshotter snapshot
} }
} }
func check128LayersMount(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshotter, work string) { func check128LayersMount(name string) func(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshotter, work string) {
return func(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshotter, work string) {
if name == "Aufs" {
t.Skip("aufs tests have issues with whiteouts here on some CI kernels")
}
lowestApply := fstest.Apply( lowestApply := fstest.Apply(
fstest.CreateFile("/bottom", []byte("way at the bottom\n"), 0777), fstest.CreateFile("/bottom", []byte("way at the bottom\n"), 0777),
fstest.CreateFile("/overwriteme", []byte("FIRST!\n"), 0777), fstest.CreateFile("/overwriteme", []byte("FIRST!\n"), 0777),
@ -953,3 +957,4 @@ func check128LayersMount(ctx context.Context, t *testing.T, snapshotter snapshot
t.Fatalf("fullview should equal to flat: %+v", err) t.Fatalf("fullview should equal to flat: %+v", err)
} }
} }
}

View File

@ -81,7 +81,7 @@ k8s.io/kubernetes v1.12.0
k8s.io/utils cd34563cd63c2bd7c6fe88a73c4dcf34ed8a67cb k8s.io/utils cd34563cd63c2bd7c6fe88a73c4dcf34ed8a67cb
# zfs dependencies # zfs dependencies
github.com/containerd/zfs 9a0b8b8b5982014b729cd34eb7cd7a11062aa6ec github.com/containerd/zfs 9f6ef3b1fe5144bd91fe5855b4eba81bc0d17d03
github.com/mistifyio/go-zfs 166add352731e515512690329794ee593f1aaff2 github.com/mistifyio/go-zfs 166add352731e515512690329794ee593f1aaff2
github.com/pborman/uuid c65b2f87fee37d1c7854c9164a450713c28d50cd github.com/pborman/uuid c65b2f87fee37d1c7854c9164a450713c28d50cd

View File

@ -50,7 +50,7 @@ func NewSnapshotter(root string) (snapshots.Snapshotter, error) {
return nil, err return nil, err
} }
if m.FSType != "zfs" { if m.FSType != "zfs" {
return nil, errors.Errorf("path %s must be a zfs filesystem to be used with the zfs snapshotter", root) return nil, errors.Wrapf(plugin.ErrSkipPlugin, "path %s must be a zfs filesystem to be used with the zfs snapshotter", root)
} }
dataset, err := zfs.GetDataset(m.Source) dataset, err := zfs.GetDataset(m.Source)
if err != nil { if err != nil {