]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/mgr/volumes: add encoding to attrs/info
authorPatrick Donnelly <pdonnell@ibm.com>
Fri, 18 Apr 2025 00:14:26 +0000 (20:14 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Fri, 18 Apr 2025 00:15:11 +0000 (20:15 -0400)
This was skipped for expediency but it's easy to add.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
src/pybind/mgr/volumes/fs/operations/versions/subvolume_base.py

index 7a6dde11750b75719bce85bd0f7be16203c1b8a4..ccd174febef4447c09f1845ed3a5649c0d794494 100644 (file)
@@ -203,6 +203,11 @@ class SubvolumeBase(object):
         except EarmarkException:
             attrs["earmark"] = ''
 
+        try:
+            attrs["encoding"] = self.fs.getxattr(pathname, 'ceph.dir.encoding').decode('utf-8')
+        except cephfs.NoData:
+            attrs["encoding"] = None
+
         try:
             attrs["normalization"] = self.fs.getxattr(pathname,
                                                       'ceph.dir.normalization'
@@ -307,6 +312,13 @@ class SubvolumeBase(object):
             fs_earmark = CephFSVolumeEarmarking(self.fs, path)
             fs_earmark.set_earmark(earmark)
 
+        encoding = attrs.get("encoding")
+        if encoding is not None:
+            try:
+                self.fs.setxattr(path, "ceph.dir.encoding", encoding.encode('utf-8'), 0)
+            except cephfs.Error as e:
+                raise VolumeException(-e.args[0], e.args[1])
+
         normalization = attrs.get("normalization")
         if normalization is not None:
             try:
@@ -479,6 +491,13 @@ class SubvolumeBase(object):
         except EarmarkException:
             earmark = ''
 
+        try:
+            encoding = self.fs.getxattr(subvolpath,
+                                        'ceph.dir.encoding'
+                                        ).decode('utf-8')
+        except cephfs.NoData:
+            encoding = "none"
+
         try:
             normalization = self.fs.getxattr(subvolpath,
                                              'ceph.dir.normalization'