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:
parent
c4446665cb
commit
16aaf6c065
@ -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 {
|
||||||
log.G(ic.Context).WithError(err).
|
if !plugin.IsSkipPlugin(err) {
|
||||||
Warnf("could not use snapshotter %v in metadata plugin", name)
|
log.G(ic.Context).WithError(err).
|
||||||
|
Warnf("could not use snapshotter %v in metadata plugin", name)
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
snapshotters[name] = sn.(snapshots.Snapshotter)
|
snapshotters[name] = sn.(snapshots.Snapshotter)
|
||||||
|
@ -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")
|
||||||
|
@ -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,93 +863,98 @@ 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) {
|
||||||
lowestApply := fstest.Apply(
|
return func(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshotter, work string) {
|
||||||
fstest.CreateFile("/bottom", []byte("way at the bottom\n"), 0777),
|
if name == "Aufs" {
|
||||||
fstest.CreateFile("/overwriteme", []byte("FIRST!\n"), 0777),
|
t.Skip("aufs tests have issues with whiteouts here on some CI kernels")
|
||||||
fstest.CreateDir("/ADDHERE", 0755),
|
}
|
||||||
fstest.CreateDir("/ONLYME", 0755),
|
lowestApply := fstest.Apply(
|
||||||
fstest.CreateFile("/ONLYME/bottom", []byte("bye!\n"), 0777),
|
fstest.CreateFile("/bottom", []byte("way at the bottom\n"), 0777),
|
||||||
)
|
fstest.CreateFile("/overwriteme", []byte("FIRST!\n"), 0777),
|
||||||
|
fstest.CreateDir("/ADDHERE", 0755),
|
||||||
appliers := []fstest.Applier{lowestApply}
|
|
||||||
for i := 1; i <= 127; i++ {
|
|
||||||
appliers = append(appliers, fstest.Apply(
|
|
||||||
fstest.CreateFile("/overwriteme", []byte(fmt.Sprintf("%d WAS HERE!\n", i)), 0777),
|
|
||||||
fstest.CreateFile(fmt.Sprintf("/ADDHERE/file-%d", i), []byte("same\n"), 0755),
|
|
||||||
fstest.RemoveAll("/ONLYME"),
|
|
||||||
fstest.CreateDir("/ONLYME", 0755),
|
fstest.CreateDir("/ONLYME", 0755),
|
||||||
fstest.CreateFile(fmt.Sprintf("/ONLYME/file-%d", i), []byte("only me!\n"), 0777),
|
fstest.CreateFile("/ONLYME/bottom", []byte("bye!\n"), 0777),
|
||||||
))
|
)
|
||||||
}
|
|
||||||
|
|
||||||
flat := filepath.Join(work, "flat")
|
appliers := []fstest.Applier{lowestApply}
|
||||||
if err := os.MkdirAll(flat, 0777); err != nil {
|
for i := 1; i <= 127; i++ {
|
||||||
t.Fatalf("failed to create flat dir(%s): %+v", flat, err)
|
appliers = append(appliers, fstest.Apply(
|
||||||
}
|
fstest.CreateFile("/overwriteme", []byte(fmt.Sprintf("%d WAS HERE!\n", i)), 0777),
|
||||||
|
fstest.CreateFile(fmt.Sprintf("/ADDHERE/file-%d", i), []byte("same\n"), 0755),
|
||||||
// NOTE: add gc labels to avoid snapshots get removed by gc...
|
fstest.RemoveAll("/ONLYME"),
|
||||||
parent := ""
|
fstest.CreateDir("/ONLYME", 0755),
|
||||||
for i, applier := range appliers {
|
fstest.CreateFile(fmt.Sprintf("/ONLYME/file-%d", i), []byte("only me!\n"), 0777),
|
||||||
preparing := filepath.Join(work, fmt.Sprintf("prepare-layer-%d", i))
|
))
|
||||||
if err := os.MkdirAll(preparing, 0777); err != nil {
|
|
||||||
t.Fatalf("[layer %d] failed to create preparing dir(%s): %+v", i, preparing, err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mounts, err := snapshotter.Prepare(ctx, preparing, parent, opt)
|
flat := filepath.Join(work, "flat")
|
||||||
|
if err := os.MkdirAll(flat, 0777); err != nil {
|
||||||
|
t.Fatalf("failed to create flat dir(%s): %+v", flat, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: add gc labels to avoid snapshots get removed by gc...
|
||||||
|
parent := ""
|
||||||
|
for i, applier := range appliers {
|
||||||
|
preparing := filepath.Join(work, fmt.Sprintf("prepare-layer-%d", i))
|
||||||
|
if err := os.MkdirAll(preparing, 0777); err != nil {
|
||||||
|
t.Fatalf("[layer %d] failed to create preparing dir(%s): %+v", i, preparing, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
mounts, err := snapshotter.Prepare(ctx, preparing, parent, opt)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("[layer %d] failed to get mount info: %+v", i, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := mount.All(mounts, preparing); err != nil {
|
||||||
|
t.Fatalf("[layer %d] failed to mount on the target(%s): %+v", i, preparing, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := fstest.CheckDirectoryEqual(preparing, flat); err != nil {
|
||||||
|
testutil.Unmount(t, preparing)
|
||||||
|
t.Fatalf("[layer %d] preparing doesn't equal to flat before apply: %+v", i, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := applier.Apply(flat); err != nil {
|
||||||
|
testutil.Unmount(t, preparing)
|
||||||
|
t.Fatalf("[layer %d] failed to apply on flat dir: %+v", i, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = applier.Apply(preparing); err != nil {
|
||||||
|
testutil.Unmount(t, preparing)
|
||||||
|
t.Fatalf("[layer %d] failed to apply on preparing dir: %+v", i, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := fstest.CheckDirectoryEqual(preparing, flat); err != nil {
|
||||||
|
testutil.Unmount(t, preparing)
|
||||||
|
t.Fatalf("[layer %d] preparing doesn't equal to flat after apply: %+v", i, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
testutil.Unmount(t, preparing)
|
||||||
|
|
||||||
|
parent = filepath.Join(work, fmt.Sprintf("committed-%d", i))
|
||||||
|
if err := snapshotter.Commit(ctx, parent, preparing, opt); err != nil {
|
||||||
|
t.Fatalf("[layer %d] failed to commit the preparing: %+v", i, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
view := filepath.Join(work, "fullview")
|
||||||
|
if err := os.MkdirAll(view, 0777); err != nil {
|
||||||
|
t.Fatalf("failed to create fullview dir(%s): %+v", view, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
mounts, err := snapshotter.View(ctx, view, parent, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("[layer %d] failed to get mount info: %+v", i, err)
|
t.Fatalf("failed to get view's mount info: %+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := mount.All(mounts, preparing); err != nil {
|
if err := mount.All(mounts, view); err != nil {
|
||||||
t.Fatalf("[layer %d] failed to mount on the target(%s): %+v", i, preparing, err)
|
t.Fatalf("failed to mount on the target(%s): %+v", view, err)
|
||||||
}
|
}
|
||||||
|
defer testutil.Unmount(t, view)
|
||||||
|
|
||||||
if err := fstest.CheckDirectoryEqual(preparing, flat); err != nil {
|
if err := fstest.CheckDirectoryEqual(view, flat); err != nil {
|
||||||
testutil.Unmount(t, preparing)
|
t.Fatalf("fullview should equal to flat: %+v", err)
|
||||||
t.Fatalf("[layer %d] preparing doesn't equal to flat before apply: %+v", i, err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := applier.Apply(flat); err != nil {
|
|
||||||
testutil.Unmount(t, preparing)
|
|
||||||
t.Fatalf("[layer %d] failed to apply on flat dir: %+v", i, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = applier.Apply(preparing); err != nil {
|
|
||||||
testutil.Unmount(t, preparing)
|
|
||||||
t.Fatalf("[layer %d] failed to apply on preparing dir: %+v", i, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := fstest.CheckDirectoryEqual(preparing, flat); err != nil {
|
|
||||||
testutil.Unmount(t, preparing)
|
|
||||||
t.Fatalf("[layer %d] preparing doesn't equal to flat after apply: %+v", i, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
testutil.Unmount(t, preparing)
|
|
||||||
|
|
||||||
parent = filepath.Join(work, fmt.Sprintf("committed-%d", i))
|
|
||||||
if err := snapshotter.Commit(ctx, parent, preparing, opt); err != nil {
|
|
||||||
t.Fatalf("[layer %d] failed to commit the preparing: %+v", i, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
view := filepath.Join(work, "fullview")
|
|
||||||
if err := os.MkdirAll(view, 0777); err != nil {
|
|
||||||
t.Fatalf("failed to create fullview dir(%s): %+v", view, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
mounts, err := snapshotter.View(ctx, view, parent, opt)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("failed to get view's mount info: %+v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := mount.All(mounts, view); err != nil {
|
|
||||||
t.Fatalf("failed to mount on the target(%s): %+v", view, err)
|
|
||||||
}
|
|
||||||
defer testutil.Unmount(t, view)
|
|
||||||
|
|
||||||
if err := fstest.CheckDirectoryEqual(view, flat); err != nil {
|
|
||||||
t.Fatalf("fullview should equal to flat: %+v", err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user