From def09c4fbb2805618715c5a125ddf482d7e53de3 Mon Sep 17 00:00:00 2001 From: hari gowtham Date: Tue, 25 Jul 2017 18:07:05 +0530 Subject: Infra to indentify process Problem: currently we can't identify which process is running and how many instances of it are available. Fix: name the process when its spawned and send it to the server and save it in the client_t The processes that abide by this change from this patch are: 1) fuse mount, 2) rebalance, 3) selfheal, 4) tier, 5) quota, 6) snapshot, 7) brick. 8) gfapi (by default. gfapi. if processname is found) Note: fuse gets a process name as native-fuse-client by default. If the user gives a name for the fuse and spawns it, it will be of this type --process-name native-fuse-client.. This can be made use by the process like aux mount done by quota, geo-rep, etc by adding another option in the aux mount " -o process-name=gsync_mount" Updates: #178 Signed-off-by: hari gowtham Change-Id: Ie4d02257216839338043737691753bab9a974d5e Reviewed-on: https://review.gluster.org/17957 Smoke: Gluster Build System Tested-by: hari gowtham Reviewed-by: Amar Tumballi CentOS-regression: Gluster Build System Reviewed-by: Atin Mukherjee Reviewed-by: Aravinda VK Reviewed-by: Niels de Vos --- xlators/mgmt/glusterd/src/glusterd-quotad-svc.c | 2 ++ xlators/mgmt/glusterd/src/glusterd-rebalance.c | 1 + xlators/mgmt/glusterd/src/glusterd-shd-svc.c | 9 +++++++++ xlators/mgmt/glusterd/src/glusterd-snapd-svc.c | 4 +++- xlators/mgmt/glusterd/src/glusterd-tierd-svc.c | 1 + xlators/mgmt/glusterd/src/glusterd-utils.c | 1 + 6 files changed, 17 insertions(+), 1 deletion(-) (limited to 'xlators/mgmt/glusterd/src') diff --git a/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c b/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c index e0eb38f494a..ac8694fc440 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c @@ -122,6 +122,8 @@ glusterd_quotadsvc_start (glusterd_svc_t *svc, int flags) dict_t *cmdline = NULL; char key[16] = {0}; char *options[] = { + svc->name, + "--process-name", "*replicate*.entry-self-heal=off", "--xlator-option", "*replicate*.metadata-self-heal=off", diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 4c24b99d0b8..70b391e4188 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -289,6 +289,7 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr, "*replicate*.metadata-self-heal=off", "--xlator-option", "*replicate*.entry-self-heal=off", "--xlator-option", "*dht.readdir-optimize=on", + "--process-name", "rebalance", NULL); if (volinfo->type == GF_CLUSTER_TYPE_TIER) { diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c index e0135ea2be3..8716a0bd10b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c @@ -17,6 +17,7 @@ #include "glusterd-shd-svc.h" #include "glusterd-svc-helper.h" +#define GD_SHD_PROCESS_NAME "--process-name" char *shd_svc_name = "glustershd"; void @@ -162,6 +163,14 @@ glusterd_shdsvc_start (glusterd_svc_t *svc, int flags) /* Pass cmdline arguments as key-value pair. The key is merely * a carrier and is not used. Since dictionary follows LIFO the value * should be put in reverse order*/ + ret = dict_set_str (cmdline, "arg4", svc->name); + if (ret) + goto out; + + ret = dict_set_str (cmdline, "arg3", GD_SHD_PROCESS_NAME); + if (ret) + goto out; + ret = dict_set_str (cmdline, "arg2", glusterd_uuid_option); if (ret) goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c index 59d8fbdfa6a..ea56d8012aa 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c @@ -297,7 +297,9 @@ glusterd_snapdsvc_start (glusterd_svc_t *svc, int flags) "-p", svc->proc.pidfile, "-l", svc->proc.logfile, "--brick-name", snapd_id, - "-S", svc->conn.sockpath, NULL); + "-S", svc->conn.sockpath, + "--process-name", svc->name, + NULL); snapd_port = pmap_assign_port (THIS, volinfo->snapd.port, snapd_id); volinfo->snapd.port = snapd_port; diff --git a/xlators/mgmt/glusterd/src/glusterd-tierd-svc.c b/xlators/mgmt/glusterd/src/glusterd-tierd-svc.c index c75b378140c..bb2cbff6e93 100644 --- a/xlators/mgmt/glusterd/src/glusterd-tierd-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-tierd-svc.c @@ -330,6 +330,7 @@ glusterd_tierdsvc_start (glusterd_svc_t *svc, int flags) "--xlator-option", "*dht.readdir-optimize=on", "--xlator-option", "*tier-dht.xattr-name=trusted.tier.tier-dht", + "--process-name", svc->name, NULL); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index ee3498f3e86..9e98225e73e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -2060,6 +2060,7 @@ retry: "--brick-name", brickinfo->path, "-l", brickinfo->logfile, "--xlator-option", glusterd_uuid, + "--process-name", "brick", NULL); if (dict_get_str (priv->opts, GLUSTERD_LOCALTIME_LOGGING_KEY, -- cgit