prune: use zfs destroy with sanity check

This commit is contained in:
Christian Schwarz 2017-09-01 17:09:54 +02:00
parent fee2071514
commit 4a00bef40b

View File

@ -2,12 +2,13 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/spf13/cobra"
"github.com/zrepl/zrepl/util"
"github.com/zrepl/zrepl/zfs"
"os" "os"
"sort" "sort"
"time" "time"
"github.com/spf13/cobra"
"github.com/zrepl/zrepl/util"
"github.com/zrepl/zrepl/zfs"
) )
var pruneArgs struct { var pruneArgs struct {
@ -121,7 +122,7 @@ func doPrune(ctx PruneContext, log Logger) error {
// special handling for EBUSY (zfs hold) // special handling for EBUSY (zfs hold)
// error handling for clones? just echo to cli, skip over, and exit with non-zero status code (we're idempotent) // error handling for clones? just echo to cli, skip over, and exit with non-zero status code (we're idempotent)
if !ctx.DryRun { if !ctx.DryRun {
err := zfs.ZFSDestroy(r.ToAbsPath(fs)) err := zfs.ZFSDestroyFilesystemVersion(fs, r.FilesystemVersion)
if err != nil { if err != nil {
// handle // handle
log.Printf("error: %s", err) log.Printf("error: %s", err)