]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/snap_schedule: restore yearly spec to lowercase y
authorMilind Changire <mchangir@redhat.com>
Fri, 5 Apr 2024 15:32:52 +0000 (21:02 +0530)
committerMilind Changire <mchangir@redhat.com>
Mon, 13 May 2024 12:03:56 +0000 (17:33 +0530)
Introduced-by: https://github.com/ceph/ceph/pull/53070
Fixes: https://tracker.ceph.com/issues/65350
Signed-off-by: Milind Changire <mchangir@redhat.com>
(cherry picked from commit 7151415801bc2120d823d4447e86de0de892469e)

doc/cephfs/snap-schedule.rst
qa/tasks/cephfs/test_snap_schedules.py
src/pybind/mgr/snap_schedule/fs/schedule.py
src/pybind/mgr/snap_schedule/fs/schedule_client.py

index ef746be23590f01952dba8ea4499faa535306243..a94d938040ff1707d26da5dec61f4c9129d769e9 100644 (file)
@@ -31,7 +31,7 @@ Snapshot schedules are identified by path, their repeat interval and their start
 time. The
 repeat interval defines the time between two subsequent snapshots. It is
 specified by a number and a period multiplier, one of `h(our)`, `d(ay)`,
-`w(eek)`, `M(onth)` and `Y(ear)`. E.g. a repeat interval of `12h` specifies one
+`w(eek)`, `M(onth)` and `y(ear)`. E.g. a repeat interval of `12h` specifies one
 snapshot every 12 hours.
 The start time is specified as a time string (more details about passing times
 below). By default
@@ -53,7 +53,7 @@ The semantics are that a spec will ensure `<number>` snapshots are kept that are
 at least `<time period>` apart. For Example `7d` means the user wants to keep 7
 snapshots that are at least one day (but potentially longer) apart from each other.
 The following time periods are recognized: `h(our)`, `d(ay)`, `w(eek)`, `M(onth)`, 
-`Y(ear)` and `n`. The latter is a special modifier where e.g. `10n` means keep
+`y(ear)` and `n`. The latter is a special modifier where e.g. `10n` means keep
 the last 10 snapshots regardless of timing,
 
 All subcommands take optional `fs` argument to specify paths in
index 8bbd679efa30c1047e254885bc7d4e29760c8d80..bae9d976b0ec7ce9eb4bdbf417a4a107a2963b12 100644 (file)
@@ -568,7 +568,7 @@ class TestSnapSchedules(TestSnapSchedulesHelper):
 
         test_dir = TestSnapSchedulesSnapdir.TEST_DIRECTORY + "/yearly"
         self.mount_a.run_shell(['mkdir', '-p', test_dir])
-        self.fs_snap_schedule_cmd('add', path=test_dir, snap_schedule='1Y')
+        self.fs_snap_schedule_cmd('add', path=test_dir, snap_schedule='1y')
 
         test_dir = TestSnapSchedulesSnapdir.TEST_DIRECTORY + "/bad_period_spec"
         self.mount_a.run_shell(['mkdir', '-p', test_dir])
index ba4390939bf7573accab9d48bbde8a59faa8fe3f..5a8bee2bbb1b194059b00dae7c5d29716c4be18f 100644 (file)
@@ -65,7 +65,7 @@ def parse_retention(retention: str) -> Dict[str, int]:
     return ret
 
 
-RETENTION_MULTIPLIERS = ['n', 'm', 'h', 'd', 'w', 'M', 'Y']
+RETENTION_MULTIPLIERS = ['n', 'm', 'h', 'd', 'w', 'M', 'y']
 
 TableRowT = Dict[str, Union[int, str]]
 
@@ -108,7 +108,7 @@ class Schedule(object):
         # test to see if period and spec are valid
         # this test will throw a ValueError exception if
         # period is negative or zero
-        # spec is empty or other than n,m,h,d,w,M,Y
+        # spec is empty or other than n,m,h,d,w,M,y
         rep = self.repeat
         self.retention = json.loads(retention_policy)
         if start is None:
@@ -412,7 +412,7 @@ class Schedule(object):
         except ValueError:
             raise ValueError('invalid schedule specified - period should be '
                              'non-zero positive value and multiplier should '
-                             'be one of h,d,w,M,Y e.g. 1h or 4d etc.')
+                             'be one of h,d,w,M,y e.g. 1h or 4d etc.')
         if period <= 0:
             raise ValueError('invalid schedule specified - period must be a '
                              'non-zero positive value e.g. 1h or 4d etc.')
@@ -427,11 +427,11 @@ class Schedule(object):
             return period * 60 * 60 * 24 * 7
         elif mult == 'M':
             return period * 60 * 60 * 24 * 30
-        elif mult == 'Y':
+        elif mult == 'y':
             return period * 60 * 60 * 24 * 365
         else:
             raise ValueError('invalid schedule specified - multiplier should '
-                             'be one of h,d,w,M,Y')
+                             'be one of h,d,w,M,y')
 
     UPDATE_LAST = '''UPDATE schedules_meta
     SET
index 8b199b632c322b79a458cffd405baa6354623bc0..1c46ccc693321dca0c7cb7272abf7c6684b9bd4c 100644 (file)
@@ -84,7 +84,7 @@ def get_prune_set(candidates: Set[Tuple[cephfs.DirEntry, datetime]],
         ("d", '%Y-%m-%d'),
         ("w", '%G-%V'),
         ("M", '%Y-%m'),
-        ("Y", '%Y'),
+        ("y", '%Y'),
     ])
     keep = []
     if not retention:
@@ -414,7 +414,7 @@ class SnapSchedClient(CephfsClient):
         if sched.parse_schedule(sched.schedule)[1] == 'm' and not self.allow_minute_snaps:
             log.error('not allowed')
             raise ValueError('invalid schedule specified - multiplier should '
-                             'be one of h,d,w,M,Y')
+                             'be one of h,d,w,M,y')
         log.debug(f'attempting to add schedule {sched}')
         with self.get_schedule_db(fs) as conn_mgr:
             db = conn_mgr.dbinfo.db