From 873db854772d9e2870546bbb919f4baa10f8b0db Mon Sep 17 00:00:00 2001 From: liangmingyuan Date: Fri, 27 May 2022 02:49:16 +0800 Subject: [PATCH] engines/ceph: add option for setting config file path 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 --- HOWTO.rst | 5 +++++ engines/rados.c | 13 ++++++++++++- examples/rados.fio | 1 + fio.1 | 4 ++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/HOWTO.rst b/HOWTO.rst index 84bea5c5..f7b9cc17 100644 --- 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 diff --git a/engines/rados.c b/engines/rados.c index 976f9229..d0d15c5b 100644 --- a/engines/rados.c +++ b/engines/rados.c @@ -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; diff --git a/examples/rados.fio b/examples/rados.fio index 035cbff4..dd86f354 100644 --- a/examples/rados.fio +++ b/examples/rados.fio @@ -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 ded7bbfc..83d2f2dd 100644 --- 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. -- 2.25.1