Skip to content

Commit d78b0d0

Browse files
committed
Return skip error on unsupported fs
This allows the caller to handle the error as they see fit. Signed-off-by: Michael Crosby <[email protected]>
1 parent 39692b4 commit d78b0d0

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

zfs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func NewSnapshotter(root string) (snapshots.Snapshotter, error) {
5050
return nil, err
5151
}
5252
if m.FSType != "zfs" {
53-
return nil, errors.Errorf("path %s must be a zfs filesystem to be used with the zfs snapshotter", root)
53+
return nil, errors.Wrapf(plugin.ErrSkipPlugin, "path %s must be a zfs filesystem to be used with the zfs snapshotter", root)
5454
}
5555
dataset, err := zfs.GetDataset(m.Source)
5656
if err != nil {

zfs_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,26 @@ import (
1414
"github.com/containerd/containerd/pkg/testutil"
1515
"github.com/containerd/containerd/snapshots"
1616
"github.com/containerd/containerd/snapshots/testsuite"
17+
"github.com/containerd/continuity/testutil/loopback"
1718
zfs "github.com/mistifyio/go-zfs"
1819
"github.com/pkg/errors"
1920
)
2021

2122
func newTestZpool() (string, func() error, error) {
22-
lo, destroyLo, err := testutil.NewLoopback(1 << 30) // 1GiB
23+
lo, err := loopback.New(1 << 30) // 1GiB
2324
if err != nil {
2425
return "", nil, err
2526
}
2627
zpoolName := fmt.Sprintf("testzpool-%d", time.Now().UnixNano())
27-
zpool, err := zfs.CreateZpool(zpoolName, nil, lo)
28+
zpool, err := zfs.CreateZpool(zpoolName, nil, lo.File)
2829
if err != nil {
2930
return "", nil, err
3031
}
3132
return zpoolName, func() error {
3233
if err := zpool.Destroy(); err != nil {
3334
return err
3435
}
35-
return destroyLo()
36+
return lo.Close()
3637
}, nil
3738
}
3839

0 commit comments

Comments
 (0)