mirror of
https://github.com/ceph/ceph
synced 2025-03-22 18:27:10 +00:00
snap-schedule: count retained snapshots per retention policy
Before this commit the length of the already-retained snapshots terminated the loop. This fails when muliple retention policies are set. Fixes: https://tracker.ceph.com/issues/52388 Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
This commit is contained in:
parent
740122f546
commit
853d97bbae
@ -90,6 +90,7 @@ def get_prune_set(candidates: Set[Tuple[cephfs.DirEntry, datetime]],
|
||||
if not period_count:
|
||||
continue
|
||||
last = None
|
||||
kept_for_this_period = 0
|
||||
for snap in sorted(candidates, key=lambda x: x[0].d_name,
|
||||
reverse=True):
|
||||
snap_ts = snap[1].strftime(date_pattern)
|
||||
@ -99,7 +100,8 @@ def get_prune_set(candidates: Set[Tuple[cephfs.DirEntry, datetime]],
|
||||
log.debug((f'keeping {snap[0].d_name} due to '
|
||||
f'{period_count}{period}'))
|
||||
keep.append(snap)
|
||||
if len(keep) == period_count:
|
||||
kept_for_this_period += 1
|
||||
if kept_for_this_period == period_count:
|
||||
log.debug(('found enough snapshots for '
|
||||
f'{period_count}{period}'))
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user