diff --git a/internal/client/migrate.go b/internal/client/migrate.go index 4ba8064..a50d302 100644 --- a/internal/client/migrate.go +++ b/internal/client/migrate.go @@ -52,7 +52,7 @@ func doMigratePlaceholder0_1(ctx context.Context, sc *cli.Subcommand, args []str cfg := sc.Config() - allFSS, err := zfs.ZFSListMapping(ctx, zfs.NoFilter()) + allFSS, err := zfs.ZFSListPaths(ctx) if err != nil { return fmt.Errorf("cannot list filesystems: %w", err) } @@ -154,7 +154,7 @@ func doMigrateReplicationCursor(ctx context.Context, sc *cli.Subcommand, args [] // scan all filesystems for v1 replication cursors - fss, err := zfs.ZFSListMapping(ctx, zfs.NoFilter()) + fss, err := zfs.ZFSListPaths(ctx) if err != nil { return fmt.Errorf("list filesystems: %w", err) } diff --git a/internal/zfs/zfs.go b/internal/zfs/zfs.go index 89e5987..f40d573 100644 --- a/internal/zfs/zfs.go +++ b/internal/zfs/zfs.go @@ -203,6 +203,23 @@ func ZFSList(ctx context.Context, properties []string, zfsArgs ...string, return res, nil } +func ZFSListPaths(ctx context.Context) ([]*DatasetPath, error) { + paths := []*DatasetPath{} + zfsList := ZFSListIter(ctx, []string{"name"}, nil, "-r", "-t", + "filesystem,volume") + for fields, err := range zfsList { + if err != nil { + return nil, err + } + path, err := NewDatasetPath(fields[0]) + if err != nil { + return nil, err + } + paths = append(paths, path) + } + return paths, nil +} + // ZFSListIter executes `zfs list` and returns an iterator with the results. // // If notExistHint is not nil and zfs exits with an error, the stderr is