]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/volumes/fs/fs_util.py
import ceph 16.2.7
[ceph.git] / ceph / src / pybind / mgr / volumes / fs / fs_util.py
index 65d929adac314a91805708e2a02f87fbbf219da3..ab79b279657eec0b12400dbd2701104af5458299 100644 (file)
@@ -161,3 +161,15 @@ def get_ancestor_xattr(fs, path, attr):
             raise VolumeException(-e.args[0], e.args[1])
         else:
             return get_ancestor_xattr(fs, os.path.split(path)[0], attr)
+
+def create_base_dir(fs, path, mode):
+    """
+    Create volspec base/group directory if it doesn't exist
+    """
+    try:
+        fs.stat(path)
+    except cephfs.Error as e:
+        if e.args[0] == errno.ENOENT:
+            fs.mkdirs(path, mode)
+        else:
+            raise VolumeException(-e.args[0], e.args[1])