]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/mgr/volumes/fs: Prepare mgr to clone fscrypt snaps
authorChristopher Hoffman <choffman@redhat.com>
Wed, 7 May 2025 14:45:45 +0000 (14:45 +0000)
committerChristopher Hoffman <choffman@redhat.com>
Fri, 15 Aug 2025 16:03:31 +0000 (16:03 +0000)
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
src/pybind/mgr/mgr_util.py
src/pybind/mgr/volumes/fs/operations/versions/subvolume_base.py

index 8574bf5f728a6b1a2a4e647829be2d1a6e6d2bc4..f8a5d9d3eebf1dd9f5129ccfbf2b144bce328330 100644 (file)
@@ -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...")
index 99906fbae1d5b554dbbb94d2916ca26c9f4009b8..2f2cc642b9622cdcdc93113037d5388a96eeb135 100644 (file)
@@ -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)