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 --- glusterfsd/src/glusterfsd.c | 10 +++++++++- glusterfsd/src/glusterfsd.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'glusterfsd') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 78b06bf470..31a9bf7168 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -244,6 +244,8 @@ static struct argp_option gf_options[] = { "Override default for secure (SSL) management connections"}, {"localtime-logging", ARGP_LOCALTIME_LOGGING_KEY, 0, 0, "Enable localtime logging"}, + {"process-name", ARGP_PROCESS_NAME_KEY, "PROCESS-NAME", OPTION_HIDDEN, + "option to specify the process type" }, {0, 0, 0, 0, "Miscellaneous Options:"}, {0, } }; @@ -300,7 +302,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) cmd_args->fuse_attribute_timeout); if (ret < 0) { - gf_msg ("glusterfsd", GF_LOG_ERROR, errno, + gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_4, ZR_ATTR_TIMEOUT_OPT); goto err; } @@ -1278,6 +1280,9 @@ no_oom_api: case ARGP_LOCALTIME_LOGGING_KEY: cmd_args->localtime_logging = 1; + + case ARGP_PROCESS_NAME_KEY: + cmd_args->process_name = gf_strdup (arg); break; case ARGP_SUBDIR_MOUNT_KEY: if (arg[0] != '/') { @@ -1928,6 +1933,9 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx) process_mode = gf_get_process_mode (argv[0]); ctx->process_mode = process_mode; + if (cmd_args->process_name) { + ctx->cmd_args.process_name = cmd_args->process_name; + } /* Make sure after the parsing cli, if '--volfile-server' option is given, then '--volfile-id' is mandatory */ if (cmd_args->volfile_server && !cmd_args->volfile_id) { diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h index 871bcf61e5..99d9ec4e25 100644 --- a/glusterfsd/src/glusterfsd.h +++ b/glusterfsd/src/glusterfsd.h @@ -98,6 +98,7 @@ enum argp_option_keys { #endif ARGP_LOCALTIME_LOGGING_KEY = 177, ARGP_SUBDIR_MOUNT_KEY = 178, + ARGP_PROCESS_NAME_KEY = 179, }; struct _gfd_vol_top_priv { -- cgit