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: v18.0.0~228^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=38bf0ab262807af45a961f5e55cb9686bbe18864;p=ceph.git mgr/snap_schedule: replace .snap with the client configured snap dirname Signed-off-by: Neeraj Pratap Singh --- diff --git a/src/pybind/mgr/snap_schedule/fs/schedule_client.py b/src/pybind/mgr/snap_schedule/fs/schedule_client.py index 311f39eb9a3..59501378f16 100644 --- a/src/pybind/mgr/snap_schedule/fs/schedule_client.py +++ b/src/pybind/mgr/snap_schedule/fs/schedule_client.py @@ -287,7 +287,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}') @@ -313,7 +314,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}-'): @@ -328,7 +330,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