-
Bug
-
Resolution: Unresolved
-
Major
-
rhel-10.2
-
None
-
snapm-0.5.2-3.el10
-
None
-
Important
-
rhel-storage-management
-
2
-
False
-
True
-
-
No
-
None
-
Unspecified Release Note Type - Unknown
-
Unspecified
-
Unspecified
-
Unspecified
-
-
All
-
None
What were you trying to do that didn't work?
If the number of snapshot sets classified into a category is less than the number of snapshots to retain for that category a negative index is incorrectly calculated when building keep_by_category[category]: this causes the front of the list to be truncated (similar to #600):
{{}}
DEBUG - GcPolicyParamsTimeline(keep_yearly=1, keep_quarterly=0, keep_monthly=6, keep_weekly=4, keep_daily=7, keep_hourly=12): classifying 7 snapshot sets DEBUG - Classified yearly: hourly.0 DEBUG - Classified quarterly: DEBUG - Classified monthly: hourly.0 DEBUG - Classified weekly: hourly.4 DEBUG - Classified daily: hourly.0, hourly.4, hourly.11 DEBUG - Classified hourly: hourly.0, hourly.4, hourly.11, hourly.30, hourly.31, hourly.32, hourly.33 DEBUG - Selected 1 sets for yearly retention: hourly.0 DEBUG - Selected 0 sets for quarterly retention: DEBUG - Selected 1 sets for monthly retention: hourly.0 DEBUG - Selected 1 sets for weekly retention: hourly.4 DEBUG - Selected 3 sets for daily retention: hourly.0, hourly.4, hourly.11 DEBUG - Selected 5 sets for hourly retention: hourly.31, hourly.32, hourly.33, hourly.30, hourly.11 DEBUG - GcPolicyParamsTimeline(keep_yearly=1, keep_quarterly=0, keep_monthly=6, keep_weekly=4, keep_daily=7, keep_hourly=12) garbage collecting:
{{}}
In this example there are 7 hourly snapshots - all of which should be retained by keep_hourly=12. In this case, the index generated is [len(hourly) - keep_hourly] == -5, resulting in only the last 5 elements of the hourly retention list being kept (in this case, nothing is garbage collected, since hourly.0 and hourly.4 are separately retained by their weekly/monthly classification, but the behaviour is still wrong).
Fix this by computing the start index as max(len(category) - keep_category, 0).
What is the impact of this issue to you?
Timeline GC policy incorrectly removes snapshot sets that should be retained, leading to unexpected loss of snapshot sets that were intended to be preserved.
Please provide the package NVR for which the bug is seen:
snapm-0.5.2-1.el10
How reproducible is this bug?:
100%
Steps to reproduce
- Configure a schedule with -p timeline and the following retention parameters:
keep_yearly=1, keep_quarterly=0, keep_monthly=6, keep_weekly=4, keep_daily=7, keep_hourly=12
- Wait a few hours for scheduled creation/gc to kick in
- Inspect the available snapshot sets with snapm snapset list
Expected results
Retained snapshot sets match configured retention policy.
Actual results
Hourly snapshot sets that are not also yearly, monthly, weekly, daily are incorrectly deleted as they are created.
- links to
-
RHBA-2025:156034
snapm update