From: Christopher Hoffman Date: Wed, 7 May 2025 14:45:45 +0000 (+0000) Subject: pybind/mgr/volumes/fs: Prepare mgr to clone fscrypt snaps X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=566aa2193906558e84c8d7c511480c75fabeae49;p=ceph-ci.git pybind/mgr/volumes/fs: Prepare mgr to clone fscrypt snaps Signed-off-by: Christopher Hoffman --- diff --git a/src/pybind/mgr/mgr_util.py b/src/pybind/mgr/mgr_util.py index 8574bf5f728..f8a5d9d3eeb 100644 --- a/src/pybind/mgr/mgr_util.py +++ b/src/pybind/mgr/mgr_util.py @@ -180,6 +180,7 @@ class CephfsConnectionPool(object): self.fs.conf_set("client_mount_gid", "0") self.fs.conf_set("client_check_pool_perm", "false") self.fs.conf_set("client_quota", "false") + self.fs.conf_set("client_fscrypt_as", "false") logger.debug("CephFS initializing...") self.fs.init() logger.debug("CephFS mounting...") diff --git a/src/pybind/mgr/volumes/fs/operations/versions/subvolume_base.py b/src/pybind/mgr/volumes/fs/operations/versions/subvolume_base.py index 99906fbae1d..2f2cc642b96 100644 --- a/src/pybind/mgr/volumes/fs/operations/versions/subvolume_base.py +++ b/src/pybind/mgr/volumes/fs/operations/versions/subvolume_base.py @@ -225,6 +225,18 @@ class SubvolumeBase(object): except EncryptionTagException: attrs["enctag"] = '' + try: + attrs["fscrypt_auth"] = self.fs.getxattr(pathname, + 'ceph.fscrypt.auth') + except cephfs.NoData: + attrs["fscrypt_auth"] = None + + try: + attrs["fscrypt_file"] = self.fs.getxattr(pathname, + 'ceph.fscrypt.file') + except cephfs.NoData: + attrs["fscrypt_file"] = None + return attrs def set_attrs(self, path, attrs): @@ -336,6 +348,24 @@ class SubvolumeBase(object): fs_enctag = CephFSVolumeEncryptionTag(self.fs, path) fs_enctag.set_tag(enctag) + fscrypt_auth = attrs.get("fscrypt_auth") + if fscrypt_auth is not None: + try: + self.fs.setxattr(path, 'ceph.fscrypt.auth', + fscrypt_auth, 0) + except cephfs.InvalidValue: + raise VolumeException(-errno.EINVAL, + "invalid fscrypt_auth specified: '{0}'".format(fscrypt_auth)) + + fscrypt_file = attrs.get("fscrypt_file") + if fscrypt_file is not None: + try: + self.fs.setxattr(path, 'ceph.fscrypt.file', + fscrypt_file, 0) + except cephfs.InvalidValue: + raise VolumeException(-errno.EINVAL, + "invalid fscrypt_file specified: '{0}'".format(fscrypt_file)) + def _resize(self, path, newsize, noshrink): try: newsize = int(newsize)