Skip to content

Commit 35b6248

Browse files
Merge pull request ceph#56732 from mchangir/mgr-snap_schedule-restore-yearly-spec-from-Y-to-y
mgr/snap_schedule: restore yearly spec to lowercase y Reviewed-by: Venky Shankar <[email protected]> Reviewed-by: Jos Collin <[email protected]> Reviewed-by: Rishabh Dave <[email protected]>
2 parents 0b71779 + 7151415 commit 35b6248

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

doc/cephfs/snap-schedule.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Snapshot schedules are identified by path, their repeat interval and their start
3131
time. The
3232
repeat interval defines the time between two subsequent snapshots. It is
3333
specified by a number and a period multiplier, one of `h(our)`, `d(ay)`,
34-
`w(eek)`, `M(onth)` and `Y(ear)`. E.g. a repeat interval of `12h` specifies one
34+
`w(eek)`, `M(onth)` and `y(ear)`. E.g. a repeat interval of `12h` specifies one
3535
snapshot every 12 hours.
3636
The start time is specified as a time string (more details about passing times
3737
below). By default
@@ -53,7 +53,7 @@ The semantics are that a spec will ensure `<number>` snapshots are kept that are
5353
at least `<time period>` apart. For Example `7d` means the user wants to keep 7
5454
snapshots that are at least one day (but potentially longer) apart from each other.
5555
The following time periods are recognized: `h(our)`, `d(ay)`, `w(eek)`, `M(onth)`,
56-
`Y(ear)` and `n`. The latter is a special modifier where e.g. `10n` means keep
56+
`y(ear)` and `n`. The latter is a special modifier where e.g. `10n` means keep
5757
the last 10 snapshots regardless of timing,
5858

5959
All subcommands take optional `fs` argument to specify paths in

qa/tasks/cephfs/test_snap_schedules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ def test_snap_schedule_all_periods(self):
568568

569569
test_dir = TestSnapSchedulesSnapdir.TEST_DIRECTORY + "/yearly"
570570
self.mount_a.run_shell(['mkdir', '-p', test_dir])
571-
self.fs_snap_schedule_cmd('add', path=test_dir, snap_schedule='1Y')
571+
self.fs_snap_schedule_cmd('add', path=test_dir, snap_schedule='1y')
572572

573573
test_dir = TestSnapSchedulesSnapdir.TEST_DIRECTORY + "/bad_period_spec"
574574
self.mount_a.run_shell(['mkdir', '-p', test_dir])

src/pybind/mgr/snap_schedule/fs/schedule.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def parse_retention(retention: str) -> Dict[str, int]:
6565
return ret
6666

6767

68-
RETENTION_MULTIPLIERS = ['n', 'm', 'h', 'd', 'w', 'M', 'Y']
68+
RETENTION_MULTIPLIERS = ['n', 'm', 'h', 'd', 'w', 'M', 'y']
6969

7070
TableRowT = Dict[str, Union[int, str]]
7171

@@ -108,7 +108,7 @@ def __init__(self,
108108
# test to see if period and spec are valid
109109
# this test will throw a ValueError exception if
110110
# period is negative or zero
111-
# spec is empty or other than n,m,h,d,w,M,Y
111+
# spec is empty or other than n,m,h,d,w,M,y
112112
rep = self.repeat
113113
self.retention = json.loads(retention_policy)
114114
if start is None:
@@ -412,7 +412,7 @@ def repeat(self) -> int:
412412
except ValueError:
413413
raise ValueError('invalid schedule specified - period should be '
414414
'non-zero positive value and multiplier should '
415-
'be one of h,d,w,M,Y e.g. 1h or 4d etc.')
415+
'be one of h,d,w,M,y e.g. 1h or 4d etc.')
416416
if period <= 0:
417417
raise ValueError('invalid schedule specified - period must be a '
418418
'non-zero positive value e.g. 1h or 4d etc.')
@@ -427,11 +427,11 @@ def repeat(self) -> int:
427427
return period * 60 * 60 * 24 * 7
428428
elif mult == 'M':
429429
return period * 60 * 60 * 24 * 30
430-
elif mult == 'Y':
430+
elif mult == 'y':
431431
return period * 60 * 60 * 24 * 365
432432
else:
433433
raise ValueError('invalid schedule specified - multiplier should '
434-
'be one of h,d,w,M,Y')
434+
'be one of h,d,w,M,y')
435435

436436
UPDATE_LAST = '''UPDATE schedules_meta
437437
SET

src/pybind/mgr/snap_schedule/fs/schedule_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def get_prune_set(candidates: Set[Tuple[cephfs.DirEntry, datetime]],
8484
("d", '%Y-%m-%d'),
8585
("w", '%G-%V'),
8686
("M", '%Y-%m'),
87-
("Y", '%Y'),
87+
("y", '%Y'),
8888
])
8989
keep = []
9090
if not retention:
@@ -414,7 +414,7 @@ def store_snap_schedule(self,
414414
if sched.parse_schedule(sched.schedule)[1] == 'm' and not self.allow_minute_snaps:
415415
log.error('not allowed')
416416
raise ValueError('invalid schedule specified - multiplier should '
417-
'be one of h,d,w,M,Y')
417+
'be one of h,d,w,M,y')
418418
log.debug(f'attempting to add schedule {sched}')
419419
with self.get_schedule_db(fs) as conn_mgr:
420420
db = conn_mgr.dbinfo.db

0 commit comments

Comments
 (0)