Fix snapshot retention times

The current period should not count, so e.g. monthly=3 results in the 3
_previous_ months snapshots being kept (plus the snapshot for the current
month.
This commit is contained in:
2021-10-04 17:57:15 +02:00
parent 79bda932b3
commit 70d36ac45f

View File

@@ -13,7 +13,7 @@ def keep_time(now, snapshots, convert, delta, count):
keep = set()
if count < 1:
return keep
start = convert(now) - delta*(count-1)
start = convert(now) - delta*count
for snapshot in snapshots:
snapdate = datetime.strptime(snapshot, 'zfs-smart-snap-%Y-%m-%d-%H%M').replace(tzinfo=timezone.utc)
if snapdate >= start: