]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.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>
Wed, 5 Nov 2025 13:59:35 +0000 (13:59 +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 579c04b0063383910853b036eb3ad9e79c7c4c8c..d80991e49efdf55349322c3df99df1c6b3cd033f 100644 (file)
@@ -182,6 +182,7 @@ class CephfsConnectionPool(object):
             self.fs.conf_set("client_quota", "false")
             self.fs.conf_set("client_respect_subvolume_snapshot_visibility",
                              "false")
+            self.fs.conf_set("client_fscrypt_as", "false")
             logger.debug("CephFS initializing...")
             self.fs.init()
             logger.debug("CephFS mounting...")
index 1fcf495d4a116f4beef6c5a7d314e9b12a1dcd37..eee849e7ed1d15ab6289f984513093969d3410c1 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)