From 1bfb0a750c6fcd0bbf4d68a1890704f0aefe6337 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Sun, 17 Nov 2019 11:00:50 +0530 Subject: debug/io-stats: add an option to set volume-id 'volume-id' is good to have for a graph for uniquely identifying it. Add it to graph->volume_id while generating volfile itself. This can be further used in many other places. Updates: #763 Change-Id: I80516d62d28a284e8ff4707841570ced97a37e73 Signed-off-by: Amar Tumballi --- xlators/debug/io-stats/src/io-stats.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'xlators/debug') diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 71bd03c0123..9d3a9638d0c 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -3895,6 +3895,7 @@ int init(xlator_t *this) { struct ios_conf *conf = NULL; + char *volume_id = NULL; char *sys_log_str = NULL; char *logger_str = NULL; char *log_format_str = NULL; @@ -3935,6 +3936,11 @@ init(xlator_t *this) conf->unique_id = this->name; } + ret = dict_get_strn(this->options, "volume-id", SLEN("volume-id"), + &volume_id); + if (!ret) { + strncpy(this->graph->volume_id, volume_id, GF_UUID_BUF_SIZE); + } /* * Init it just after calloc, so that we are sure the lock is inited * in case of error paths. @@ -4484,6 +4490,13 @@ struct volume_options options[] = { .tags = {"io-stats", "threading"}, .description = "When global threading is used, this value determines the " "maximum amount of threads that can be created on clients"}, + {.key = {"volume-id"}, + .type = GF_OPTION_TYPE_STR, + .op_version = {GD_OP_VERSION_7_1}, + .tags = {"global", "volume-id"}, + .description = + "This option points to the 'unique' UUID particular to this " + "volume, which would be set in 'graph->volume_id'"}, {.key = {NULL}}, }; -- cgit