From: Neeraj Pratap Singh Date: Wed, 20 Apr 2022 12:52:46 +0000 (+0530) Subject: mgr/snap_schedule: replace .snap with the client configured snap dirname X-Git-Tag: v16.2.13~105^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=939c489a19b923ce0de5b1cab4ac8a87f91ceb6e;p=ceph.git mgr/snap_schedule: replace .snap with the client configured snap dirname Signed-off-by: Neeraj Pratap Singh (cherry picked from commit 38bf0ab262807af45a961f5e55cb9686bbe18864) --- diff --git a/src/pybind/mgr/snap_schedule/fs/schedule_client.py b/src/pybind/mgr/snap_schedule/fs/schedule_client.py index dff14966e97..e1e5c8237e4 100644 --- a/src/pybind/mgr/snap_schedule/fs/schedule_client.py +++ b/src/pybind/mgr/snap_schedule/fs/schedule_client.py @@ -276,7 +276,8 @@ class SnapSchedClient(CephfsClient): time = datetime.now(timezone.utc) with open_filesystem(self, fs_name) as fs_handle: snap_ts = time.strftime(SNAPSHOT_TS_FORMAT_TZ) - snap_name = f'{path}/.snap/{SNAPSHOT_PREFIX}-{snap_ts}' + 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}') @@ -305,7 +306,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}-'): @@ -320,7 +322,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: sched.update_pruned(time, db, len(to_prune)) except Exception: