]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_ceph_new: Introduce new parametric option 'proxy'
authorGuenther Deschner <gd@samba.org>
Thu, 5 Sep 2024 07:43:38 +0000 (13:13 +0530)
committerJule Anger <janger@samba.org>
Mon, 17 Feb 2025 16:09:08 +0000 (16:09 +0000)
Provide early support for consuming yet to come libcephfs proxy[1] for
optimized resource utilization. For better control we make use of an
additional module specific option 'proxy' to specify the intent to load
proxy library. With the default value 'no' a regular cephfs connection
is established. There is also an 'auto' mode which can fall back to the
regular connection if proxy requirements are not met.

[1] https://github.com/ceph/ceph/pull/58376

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15703

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 90464bdcafda0f0f0e4d2b549fd1675c076ee188)

source3/modules/vfs_ceph_new.c

index 87f58364f8ead063302068008e4656b02dde12f6..fd977dbe7ef9c02e6d821bb89ef4abe0e5dafdfe 100644 (file)
@@ -78,12 +78,34 @@ static ssize_t lstatus_code(intmax_t ret)
        return (ssize_t)ret;
 }
 
+enum vfs_cephfs_proxy_mode {
+       VFS_CEPHFS_PROXY_NO = 0,
+       VFS_CEPHFS_PROXY_YES,
+       VFS_CEPHFS_PROXY_AUTO
+};
+
+static const struct enum_list enum_vfs_cephfs_proxy_vals[] = {
+       {VFS_CEPHFS_PROXY_NO, "No"},
+       {VFS_CEPHFS_PROXY_NO, "False"},
+       {VFS_CEPHFS_PROXY_NO, "0"},
+       {VFS_CEPHFS_PROXY_NO, "Off"},
+       {VFS_CEPHFS_PROXY_NO, "disable"},
+       {VFS_CEPHFS_PROXY_YES, "Yes"},
+       {VFS_CEPHFS_PROXY_YES, "True"},
+       {VFS_CEPHFS_PROXY_YES, "1"},
+       {VFS_CEPHFS_PROXY_YES, "On"},
+       {VFS_CEPHFS_PROXY_YES, "enable"},
+       {VFS_CEPHFS_PROXY_AUTO, "auto"},
+       {-1, NULL}
+};
+
 struct vfs_ceph_config {
        const char *conf_file;
        const char *user_id;
        const char *fsname;
        struct cephmount_cached *mount_entry;
        struct ceph_mount_info *mount;
+       enum vfs_cephfs_proxy_mode proxy;
 };
 
 /*
@@ -275,6 +297,13 @@ static bool vfs_ceph_load_config(struct vfs_handle_struct *handle,
                                                       "user_id", "");
        config_tmp->fsname      = lp_parm_const_string(snum, module_name,
                                                       "filesystem", "");
+       config_tmp->proxy       = lp_parm_enum(snum, module_name, "proxy",
+                                              enum_vfs_cephfs_proxy_vals,
+                                              VFS_CEPHFS_PROXY_NO);
+       if (config_tmp->proxy == -1) {
+               DBG_ERR("value for proxy: mode unknown\n");
+               return false;
+       }
 
        SMB_VFS_HANDLE_SET_DATA(handle, config_tmp, NULL,
                                struct vfs_ceph_config, return false);