From f8cd77e6e4e7c93e1780d2e3d4375ebbb51e5e51 Mon Sep 17 00:00:00 2001 From: Edwin Eefting Date: Tue, 26 Sep 2023 18:39:03 +0200 Subject: [PATCH] --destroy-incompatible now only rolls back if needed --- zfs_autobackup/ZfsAutobackup.py | 6 +++--- zfs_autobackup/ZfsDataset.py | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/zfs_autobackup/ZfsAutobackup.py b/zfs_autobackup/ZfsAutobackup.py index f9cd5bf..e64c365 100644 --- a/zfs_autobackup/ZfsAutobackup.py +++ b/zfs_autobackup/ZfsAutobackup.py @@ -33,8 +33,8 @@ class ZfsAutobackup(ZfsAuto): if args.allow_empty: args.min_change = 0 - if args.destroy_incompatible: - args.rollback = True + # if args.destroy_incompatible: + # args.rollback = True if args.resume: self.warning("The --resume option isn't needed anymore (it's autodetected now)") @@ -99,7 +99,7 @@ class ZfsAutobackup(ZfsAuto): group.add_argument('--force', '-F', action='store_true', help='Use zfs -F option to force overwrite/rollback. (Useful with --strip-path=1, but use with care)') group.add_argument('--destroy-incompatible', action='store_true', - help='Destroy incompatible snapshots on target. Use with care! (implies --rollback)') + help='Destroy incompatible snapshots on target. Use with care! (also does rollback of dataset)') group.add_argument('--ignore-transfer-errors', action='store_true', help='Ignore transfer errors (still checks if received filesystem exists. useful for ' 'acltype errors)') diff --git a/zfs_autobackup/ZfsDataset.py b/zfs_autobackup/ZfsDataset.py index 1d6682a..8b4fa57 100644 --- a/zfs_autobackup/ZfsDataset.py +++ b/zfs_autobackup/ZfsDataset.py @@ -1038,6 +1038,9 @@ class ZfsDataset: snapshot.destroy() self.snapshots.remove(snapshot) + if len(incompatible_target_snapshots)>0: + self.rollback() + def sync_snapshots(self, target_dataset, features, show_progress, filter_properties, set_properties, ignore_recv_exit_code, holds, rollback, decrypt, encrypt, also_other_snapshots,