handle DryRun send size estimate errors with bookmarks

This commit is contained in:
Christian Schwarz
2018-09-05 17:41:25 -07:00
parent 9eca269ad8
commit acd2418803
6 changed files with 39 additions and 15 deletions
+13
View File
@@ -309,6 +309,9 @@ func ZFSSend(fs string, from, to string) (stream io.ReadCloser, err error) {
return
}
var BookmarkSizeEstimationNotSupported error = fmt.Errorf("size estimation is not supported for bookmarks")
// May return BookmarkSizeEstimationNotSupported as err if from is a bookmark.
func ZFSSendDry(fs string, from, to string) (size int64, err error) {
fromV, err := absVersion(fs, from)
@@ -324,6 +327,16 @@ func ZFSSendDry(fs string, from, to string) (size int64, err error) {
}
}
if strings.Contains(fromV, "#") {
/* TODO:
* ZFS at the time of writing does not support dry-run send because size-estimation
* uses fromSnap's deadlist. However, for a bookmark, that deadlist no longer exists.
* Redacted send & recv will bring this functionality, see
* https://github.com/openzfs/openzfs/pull/484
*/
return 0, BookmarkSizeEstimationNotSupported
}
args := make([]string, 0)
args = append(args, "send", "-n", "-v", "-P")