diff --git a/CHANGELOG.md b/CHANGELOG.md index 96bb35a..508c4b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed + +- Fix bug where the snapshot size was incorrect due to the command missing the + raw mode argument. +[#60](https://github.com/ddebeau/zfs_uploader/issues/60) + ## [0.7.2](https://github.com/ddebeau/zfs_uploader/compare/0.7.1...0.7.2) 2022-02-09 ### Fixed diff --git a/zfs_uploader/zfs.py b/zfs_uploader/zfs.py index 9440250..1376637 100644 --- a/zfs_uploader/zfs.py +++ b/zfs_uploader/zfs.py @@ -53,14 +53,14 @@ def destroy_filesystem(filesystem): def get_snapshot_send_size(filesystem, snapshot_name): - cmd = ['zfs', 'send', '--parsable', '--dryrun', + cmd = ['zfs', 'send', '--raw', '--parsable', '--dryrun', f'{filesystem}@{snapshot_name}'] out = subprocess.run(cmd, **SUBPROCESS_KWARGS) return out.stdout.splitlines()[1].split()[1] def get_snapshot_send_size_inc(filesystem, snapshot_name_1, snapshot_name_2): - cmd = ['zfs', 'send', '--parsable', '--dryrun', '-i', + cmd = ['zfs', 'send', '--raw', '--parsable', '--dryrun', '-i', f'{filesystem}@{snapshot_name_1}', f'{filesystem}@{snapshot_name_2}'] out = subprocess.run(cmd, **SUBPROCESS_KWARGS) @@ -70,7 +70,7 @@ def get_snapshot_send_size_inc(filesystem, snapshot_name_1, snapshot_name_2): def open_snapshot_stream(filesystem, snapshot_name, mode): """ Open snapshot stream. """ if mode == 'r': - cmd = ['zfs', 'send', '-w', f'{filesystem}@{snapshot_name}'] + cmd = ['zfs', 'send', '--raw', f'{filesystem}@{snapshot_name}'] return subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) elif mode == 'w': @@ -84,7 +84,7 @@ def open_snapshot_stream(filesystem, snapshot_name, mode): def open_snapshot_stream_inc(filesystem, snapshot_name_1, snapshot_name_2): """ Open incremental snapshot read stream. """ - cmd = ['zfs', 'send', '-w', '-i', f'{filesystem}@{snapshot_name_1}', + cmd = ['zfs', 'send', '--raw', '-i', f'{filesystem}@{snapshot_name_1}', f'{filesystem}@{snapshot_name_2}'] return subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)