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