summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShreyas Siravara <sshreyas@fb.com>2017-09-02 19:42:43 -0700
committerShreyas Siravara <sshreyas@fb.com>2017-09-03 03:20:56 +0000
commit9dbbe0e250a6f1b61d0dd8aa73288260a2a4ddb6 (patch)
tree4e93e5af3bfceefc9aecfa6ad24d57302cf9970a
parent03f1742d2b45ab000c1d79619fc5ef2c2f4cd53e (diff)
gfproxy: Make io-stats aware of the gfproxy daemon
Summary: - This diff enables gfproxyd to output a stats file that looks like 'glusterfs_gfproxyd_{volname}.dump' - This is a port of D3753684 to 3.8 Test Plan: Tested on devserver, verified output. Reviewers: kvigor Reviewed By: kvigor Change-Id: I8559974e9d24976fd1c8b6145fbc81be40fd4134 Reviewed-on: https://review.gluster.org/18189 Reviewed-by: Shreyas Siravara <sshreyas@fb.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org>
-rw-r--r--xlators/debug/io-stats/src/io-stats.c17
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c23
2 files changed, 40 insertions, 0 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index c710b59a520..2f9a2d92f15 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -151,6 +151,7 @@ struct ios_conf {
struct dnscache *dnscache;
int32_t ios_dnscache_ttl_sec;
gf_boolean_t iamnfsd;
+ gf_boolean_t iamgfproxyd;
};
@@ -782,6 +783,7 @@ _io_stats_get_key_prefix (xlator_t *this, char **key_prefix) {
int bytes_written = 0;
int i = 0;
int ret = 0;
+ struct ios_conf *conf = this->private;
xlator_name = strdupa (this->name);
for (i = 0; i < strlen (xlator_name); i++) {
@@ -797,6 +799,9 @@ _io_stats_get_key_prefix (xlator_t *this, char **key_prefix) {
xlator_name = "nfsd";
if (this->prev->instance_name)
instance_name = strdupa (this->prev->instance_name);
+ } else if (conf->iamgfproxyd) {
+ xlator_name = "gfproxyd";
+ instance_name = this->name;
}
if (strcmp (__progname, "glusterfsd") == 0)
@@ -3314,6 +3319,9 @@ _ios_dump_thread (xlator_t *this) {
strcmp (this->prev->name, "nfs-server") == 0) {
xlator_name = "nfsd";
instance_name = this->prev->instance_name;
+ } else if (conf->iamgfproxyd == _gf_true) {
+ xlator_name = "gfproxyd";
+ instance_name = strdupa (this->name);
}
if (sys_mkdir (_IOS_DUMP_DIR, S_IRWXU | S_IRWXO | S_IRWXG) == (-1)) {
if (errno != EEXIST) {
@@ -4079,6 +4087,8 @@ init (xlator_t *this)
GF_OPTION_INIT ("iam-nfs-daemon", conf->iamnfsd, bool, out);
+ GF_OPTION_INIT ("iam-gfproxy-daemon", conf->iamgfproxyd, bool, out);
+
GF_OPTION_INIT ("dump-fd-stats", conf->dump_fd_stats, bool, out);
GF_OPTION_INIT ("count-fop-hits", conf->count_fop_hits, bool, out);
@@ -4505,6 +4515,13 @@ struct volume_options options[] = {
"translator is running as part of an NFS daemon "
"or not."
},
+ { .key = {"iam-gfproxy-daemon"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "off",
+ .description = "This option differentiates if the io-stats "
+ "translator is running as part of an GFProxy daemon "
+ "or not."
+ },
{ .key = {NULL} },
};
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index c6abfd87307..e187e506640 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1462,6 +1462,24 @@ server_spec_extended_option_handler (volgen_graph_t *graph,
static void get_vol_tstamp_file (char *filename, glusterd_volinfo_t *volinfo);
static int
+volgen_graph_set_iam_gfproxyd (volgen_graph_t *graph)
+{
+ xlator_t *trav;
+ int ret = 0;
+
+ for (trav = first_of (graph); trav; trav = trav->next) {
+ if (strcmp (trav->type, "debug/io-stats") != 0) {
+ continue;
+ }
+
+ ret = xlator_set_option (trav, "iam-gfproxy-daemon", "yes");
+ if (ret)
+ break;
+ }
+ return ret;
+}
+
+static int
gfproxy_server_graph_builder (volgen_graph_t *graph,
glusterd_volinfo_t *volinfo,
dict_t *set_dict, void *param)
@@ -1499,6 +1517,11 @@ gfproxy_server_graph_builder (volgen_graph_t *graph,
if (!xl)
goto out;
+ /* Tell the graph we are a gfproxy daemon */
+ ret = volgen_graph_set_iam_gfproxyd (graph);
+ if (ret != 0)
+ goto out;
+
ret = xlator_set_option (xl, "listen-port", GF_PROXY_DAEMON_PORT_STR);
if (ret != 0)
goto out;