]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/snap_schedule: replace .snap with the client configured snap dirname
authorNeeraj Pratap Singh <neesingh@redhat.com>
Wed, 20 Apr 2022 12:52:46 +0000 (18:22 +0530)
committerNeeraj Pratap Singh <neesingh@redhat.com>
Mon, 22 Aug 2022 10:41:02 +0000 (16:11 +0530)
Signed-off-by: Neeraj Pratap Singh <neesingh@redhat.com>
(cherry picked from commit 38bf0ab262807af45a961f5e55cb9686bbe18864)

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

index a22f658dffed94d0562276c7123b5bc270a9b6ff..c8c9c5c8f1a617ee2e08c815882764d9757d98d1 100644 (file)
@@ -275,8 +275,9 @@ class SnapSchedClient(CephfsClient):
                                                       start=start)[0]
                     time = datetime.now(timezone.utc)
                     with open_filesystem(self, fs_name) as fs_handle:
-                        snap_ts = time.strftime(SNAPSHOT_TS_FORMAT)
-                        snap_name = f'{path}/.snap/{SNAPSHOT_PREFIX}-{snap_ts}'
+                        snap_ts = time.strftime(SNAPSHOT_TS_FORMAT_TZ)
+                        snap_dir = self.mgr.rados.conf_get('client_snapdir')
+                        snap_name = f'{path}/{snap_dir}/{SNAPSHOT_PREFIX}-{snap_ts}'
                         fs_handle.mkdir(snap_name, 0o755)
                     log.info(f'created scheduled snapshot of {path}')
                     log.debug(f'created scheduled snapshot {snap_name}')
@@ -302,7 +303,8 @@ class SnapSchedClient(CephfsClient):
             prune_candidates = set()
             time = datetime.now(timezone.utc)
             with open_filesystem(self, sched.fs) as fs_handle:
-                with fs_handle.opendir(f'{path}/.snap') as d_handle:
+                snap_dir = self.mgr.rados.conf_get('client_snapdir')
+                with fs_handle.opendir(f'{path}/{snap_dir}') as d_handle:
                     dir_ = fs_handle.readdir(d_handle)
                     while dir_:
                         if dir_.d_name.decode('utf-8').startswith(f'{SNAPSHOT_PREFIX}-'):
@@ -318,7 +320,7 @@ class SnapSchedClient(CephfsClient):
                 for k in to_prune:
                     dirname = k[0].d_name.decode('utf-8')
                     log.debug(f'rmdir on {dirname}')
-                    fs_handle.rmdir(f'{path}/.snap/{dirname}')
+                    fs_handle.rmdir(f'{path}/{snap_dir}/{dirname}')
                 if to_prune:
                     with self.get_schedule_db(sched.fs) as conn_mgr:
                         db = conn_mgr.dbinfo.db