engines/ceph: add option for setting config file path
authorliangmingyuan <liangmingyuan@baidu.com>
Thu, 26 May 2022 18:49:16 +0000 (02:49 +0800)
committerliangmingyuan <liangmingyuan@baidu.com>
Sun, 29 May 2022 15:26:50 +0000 (23:26 +0800)
Specifies the configuration path of ceph cluster on rados test, so
conf file does not have to be /etc/ceph/ceph.conf.
To set the option, adding the next line to global section of fio:
conf=path_to_ceph_config_file

Signed-off-by: Mingyuan Liang <liangmingyuan@baidu.com>
HOWTO.rst
engines/rados.c
examples/rados.fio
fio.1

index 84bea5c5ba0b0cf577aee9d6608dcad405f7af22..f7b9cc174237556fd2eac845992ca70b4e57a7b9 100644 (file)
--- a/HOWTO.rst
+++ b/HOWTO.rst
@@ -2491,6 +2491,11 @@ with the caveat that when used on the command line, they must come after the
        the full *type.id* string. If no type. prefix is given, fio will add
        'client.' by default.
 
+.. option:: conf=str : [rados]
+
+    Specifies the configuration path of ceph cluster, so conf file does not
+    have to be /etc/ceph/ceph.conf.
+
 .. option:: busy_poll=bool : [rbd,rados]
 
         Poll store instead of waiting for completion. Usually this provides better
index 976f9229b082723e2a67ebc70fe53d43aa7e111c..d0d15c5b54c8380353b56e8b9856a8475a1b9b25 100644 (file)
@@ -37,6 +37,7 @@ struct rados_options {
        char *cluster_name;
        char *pool_name;
        char *client_name;
+       char *conf;
        int busy_poll;
        int touch_objects;
 };
@@ -69,6 +70,16 @@ static struct fio_option options[] = {
                .category = FIO_OPT_C_ENGINE,
                .group    = FIO_OPT_G_RBD,
        },
+       {
+               .name     = "conf",
+               .lname    = "ceph configuration file path",
+               .type     = FIO_OPT_STR_STORE,
+               .help     = "Path of the ceph configuration file",
+               .off1     = offsetof(struct rados_options, conf),
+               .def      = "/etc/ceph/ceph.conf",
+               .category = FIO_OPT_C_ENGINE,
+               .group    = FIO_OPT_G_RBD,
+       },
        {
                .name     = "busy_poll",
                .lname    = "busy poll mode",
@@ -184,7 +195,7 @@ static int _fio_rados_connect(struct thread_data *td)
                goto failed_early;
        }
 
-       r = rados_conf_read_file(rados->cluster, NULL);
+       r = rados_conf_read_file(rados->cluster, o->conf);
        if (r < 0) {
                log_err("rados_conf_read_file failed.\n");
                goto failed_early;
index 035cbff4ab1481172f7e90ac0a6554d56ca0aed6..dd86f354c8173479969b677ae9247c55ef747b82 100644 (file)
@@ -14,6 +14,7 @@
 ioengine=rados
 clientname=admin
 pool=rados
+conf=/etc/ceph/ceph.conf
 busy_poll=0
 rw=randwrite
 bs=4k
diff --git a/fio.1 b/fio.1
index ded7bbfc993bd431a10a034a1c63e14d765d44e1..83d2f2dd6452dc2af2d57a642944fd8e78fa63e3 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -2243,6 +2243,10 @@ Ceph cluster. If the \fBclustername\fR is specified, the \fBclientname\fR shall
 the full *type.id* string. If no type. prefix is given, fio will add 'client.'
 by default.
 .TP
+.BI (rados)conf \fR=\fPstr
+Specifies the configuration path of ceph cluster, so conf file does not
+have to be /etc/ceph/ceph.conf.
+.TP
 .BI (rbd,rados)busy_poll \fR=\fPbool
 Poll store instead of waiting for completion. Usually this provides better
 throughput at cost of higher(up to 100%) CPU utilization.