Change unsupported snapshot warnings to INFO

Since there is no real action the user can do, these can safely be
informative that the underlying filesystem does not support a snapshot
plugin at boot.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2018-10-26 12:44:14 -04:00
parent c4446665cb
commit 16aaf6c065
3 changed files with 90 additions and 83 deletions

View File

@ -125,7 +125,7 @@ func New(ctx context.Context, config *srvconfig.Config) (*Server, error) {
instance, err := result.Instance()
if err != nil {
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 {
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 {
sn, err := sn.Instance()
if err != nil {
if !plugin.IsSkipPlugin(err) {
log.G(ic.Context).WithError(err).
Warnf("could not use snapshotter %v in metadata plugin", name)
}
continue
}
snapshotters[name] = sn.(snapshots.Snapshotter)

View File

@ -77,7 +77,7 @@ func NewSnapshotter(root string) (snapshots.Snapshotter, error) {
return nil, err
}
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 (
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("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) {
@ -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(
fstest.CreateFile("/bottom", []byte("way at the bottom\n"), 0777),
fstest.CreateFile("/overwriteme", []byte("FIRST!\n"), 0777),
@ -952,4 +956,5 @@ func check128LayersMount(ctx context.Context, t *testing.T, snapshotter snapshot
if err := fstest.CheckDirectoryEqual(view, flat); err != nil {
t.Fatalf("fullview should equal to flat: %+v", err)
}
}
}