]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/volumes: the 'mode' should honor idempotent subvolume creation
authorNikhilkumar Shelke <nshelke@redhat.com>
Tue, 8 Mar 2022 09:00:00 +0000 (14:30 +0530)
committerNikhilkumar Shelke <nshelke@redhat.com>
Wed, 9 Mar 2022 05:55:27 +0000 (11:25 +0530)
currently the 'mode' argument is not honored idempotent
subvolume creation for existing subvolume.

Fixes: https://tracker.ceph.com/issues/54375
Signed-off-by: Nikhilkumar Shelke <nshelke@redhat.com>
src/pybind/mgr/volumes/fs/operations/versions/subvolume_base.py
src/pybind/mgr/volumes/fs/volume.py

index 346751b221092c7c4dc97c59e9477f08df009f7f..68d03e8d008e270b8795d85e75f65309a589334a 100644 (file)
@@ -250,6 +250,11 @@ class SubvolumeBase(object):
         if uid is not None and gid is not None:
             self.fs.chown(path, uid, gid)
 
+        # set mode
+        mode = attrs.get("mode", None)
+        if mode is not None:
+            self.fs.lchmod(path, mode)
+
     def _resize(self, path, newsize, noshrink):
         try:
             newsize = int(newsize)
index 10247e211117972c7cccf37c907c0f3fa5b30802..38dbc34e1a885d1e0474c42027970fb8ad6ae737 100644 (file)
@@ -176,6 +176,7 @@ class VolumeClient(CephfsClient["Module"]):
         pool       = kwargs['pool_layout']
         uid        = kwargs['uid']
         gid        = kwargs['gid']
+        mode       = kwargs['mode']
         isolate_nspace = kwargs['namespace_isolated']
 
         try:
@@ -187,6 +188,7 @@ class VolumeClient(CephfsClient["Module"]):
                             attrs = {
                                 'uid': uid if uid else subvolume.uid,
                                 'gid': gid if gid else subvolume.gid,
+                                'mode': octal_str_to_decimal_int(mode),
                                 'data_pool': pool,
                                 'pool_namespace': subvolume.namespace if isolate_nspace else None,
                                 'quota': size