Skip to content

Commit

Permalink
Merge pull request moby#48520 from arcenik/43080-zfs-destroy-missing-…
Browse files Browse the repository at this point in the history
…volume-fails

daemon/graphdriver/zfs: ignore non-existent dataset on removal
  • Loading branch information
thaJeztah authored Nov 27, 2024
2 parents b8db6d1 + e7d15d4 commit 7b8b63e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions daemon/graphdriver/zfs/zfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,17 @@ func (d *Driver) Remove(id string) error {
name := d.zfsPath(id)
dataset := zfs.Dataset{Name: name}
err := dataset.Destroy(zfs.DestroyRecursive)
if err != nil {
var errZfs *zfs.Error
isZfsError := errors.As(err, &errZfs)
if isZfsError && strings.HasSuffix(strings.TrimSpace(errZfs.Stderr), "dataset does not exist") {
log.G(context.TODO()).WithFields(log.Fields{
"error": err,
"storage-driver": "zfs",
}).Warnf("Tried to destroy inexistent dataset %q", name)
err = nil
}
}
if err == nil {
d.Lock()
delete(d.filesystemsCache, name)
Expand Down

0 comments on commit 7b8b63e

Please sign in to comment.