diff options
author | Xavier Hernandez <jahernan@redhat.com> | 2017-12-12 22:31:53 +0100 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2017-12-14 02:33:51 +0000 |
commit | 415e0bcc80b350fc75f325b490560f44ba419b20 (patch) | |
tree | 6b428127e3fb460da434e7eab18352c65898eb9b /glusterfsd | |
parent | bafe0c14f5743cb084a89595860e4ba33baf900c (diff) |
all: Simplify component message id's definition
This patch creates a new way of defining message id's that is easier
and less error prone because it doesn't require so many manual changes
each time a new component is defined or a new message created.
Change-Id: I71ba8af9ac068f5add7e74f316a2478bc991c67b
Signed-off-by: Xavier Hernandez <jahernan@redhat.com>
Diffstat (limited to 'glusterfsd')
-rw-r--r-- | glusterfsd/src/glusterfsd-messages.h | 145 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd-mgmt.c | 9 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd.c | 148 |
3 files changed, 155 insertions, 147 deletions
diff --git a/glusterfsd/src/glusterfsd-messages.h b/glusterfsd/src/glusterfsd-messages.h index e9c28f71263..8df32a33179 100644 --- a/glusterfsd/src/glusterfsd-messages.h +++ b/glusterfsd/src/glusterfsd-messages.h @@ -13,105 +13,54 @@ #include "glfs-message-id.h" -/* NOTE: Rules for message additions - * 1) Each instance of a message is _better_ left with a unique message ID, even - * if the message format is the same. Reasoning is that, if the message - * format needs to change in one instance, the other instances are not - * impacted or the new change does not change the ID of the instance being - * modified. - * 2) Addition of a message, - * - Should increment the GLFS_NUM_MESSAGES - * - Append to the list of messages defined, towards the end - * - Retain macro naming as glfs_msg_X (for redability across developers) - * NOTE: Rules for message format modifications - * 3) Check acorss the code if the message ID macro in question is reused - * anywhere. If reused then then the modifications should ensure correctness - * everywhere, or needs a new message ID as (1) above was not adhered to. If - * not used anywhere, proceed with the required modification. - * NOTE: Rules for message deletion - * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used - * anywhere, then can be deleted, but will leave a hole by design, as - * addition rules specify modification to the end of the list and not filling - * holes. +/* To add new message IDs, append new identifiers at the end of the list. + * + * Never remove a message ID. If it's not used anymore, you can rename it or + * leave it as it is, but not delete it. This is to prevent reutilization of + * IDs by other messages. + * + * The component name must match one of the entries defined in + * glfs-message-id.h. */ -#define GLFS_COMP_BASE GLFS_MSGID_COMP_GLUSTERFSD -#define GLFS_NUM_MESSAGES 37 -#define GLFS_MSGID_END (GLFS_COMP_BASE + GLFS_NUM_MESSAGES + 1) -/* Messaged with message IDs */ -#define glfs_msg_start_x GLFS_COMP_BASE, "Invalid: Start of messages" -/*------------*/ -#define glusterfsd_msg_1 (GLFS_COMP_BASE + 1), "Could not create absolute" \ - " mountpoint path" -#define glusterfsd_msg_2 (GLFS_COMP_BASE + 2), "Could not get current " \ - "working directory" -#define glusterfsd_msg_3 (GLFS_COMP_BASE + 3), "failed to set mount-point" \ - " to options dictionary" -#define glusterfsd_msg_4 (GLFS_COMP_BASE + 4), "failed to set dict value" \ - " for key %s" -#define glusterfsd_msg_5 (GLFS_COMP_BASE + 5), "failed to set 'disable'" \ - " for key %s" -#define glusterfsd_msg_6 (GLFS_COMP_BASE + 6), "failed to set 'enable'" \ - " for key %s" -#define glusterfsd_msg_7 (GLFS_COMP_BASE + 7), "Not a client process, not" \ - " performing mount operation" -#define glusterfsd_msg_8 (GLFS_COMP_BASE + 8), "MOUNT-POINT %s" \ - " initialization failed" -#define glusterfsd_msg_9 (GLFS_COMP_BASE + 9), "loading volume file %s" \ - " failed" -#define glusterfsd_msg_10 (GLFS_COMP_BASE + 10), "xlator option %s is" \ - " invalid" -#define glusterfsd_msg_11 (GLFS_COMP_BASE + 11), "Fetching the volume" \ - " file from server..." -#define glusterfsd_msg_12 (GLFS_COMP_BASE + 12), "volume initialization" \ - " failed." -#define glusterfsd_msg_13 (GLFS_COMP_BASE + 13), "ERROR: glusterfs uuid" \ - " generation failed" -#define glusterfsd_msg_14 (GLFS_COMP_BASE + 14), "ERROR: glusterfs %s" \ - " pool creation failed" -#define glusterfsd_msg_15 (GLFS_COMP_BASE + 15), "ERROR: '--volfile-id' is" \ - " mandatory if '-s' OR '--volfile-server'" \ - " option is given" -#define glusterfsd_msg_16 (GLFS_COMP_BASE + 16), "ERROR: parsing the" \ - " volfile failed" -#define glusterfsd_msg_17 (GLFS_COMP_BASE + 17), "pidfile %s open failed" -#define glusterfsd_msg_18 (GLFS_COMP_BASE + 18), "pidfile %s lock failed" -#define glusterfsd_msg_19 (GLFS_COMP_BASE + 19), "pidfile %s unlock failed" -#define glusterfsd_msg_20 (GLFS_COMP_BASE + 20), "pidfile %s truncation" \ - " failed" -#define glusterfsd_msg_21 (GLFS_COMP_BASE + 21), "pidfile %s write failed" -#define glusterfsd_msg_22 (GLFS_COMP_BASE + 22), "failed to execute" \ - " pthread_sigmask" -#define glusterfsd_msg_23 (GLFS_COMP_BASE + 23), "failed to create pthread" -#define glusterfsd_msg_24 (GLFS_COMP_BASE + 24), "daemonization failed" -#define glusterfsd_msg_25 (GLFS_COMP_BASE + 25), "mount failed" -#define glusterfsd_msg_26 (GLFS_COMP_BASE + 26), "failed to construct" \ - " the graph" -#define glusterfsd_msg_27 (GLFS_COMP_BASE + 27), "fuse xlator cannot be" \ - " specified in volume file" -#define glusterfsd_msg_28 (GLFS_COMP_BASE + 28), "Cannot reach volume" \ - " specification file" -#define glusterfsd_msg_29 (GLFS_COMP_BASE + 29), "ERROR: glusterfs context" \ - " not initialized" -#define glusterfsd_msg_30 (GLFS_COMP_BASE + 30), "Started running %s" \ - " version %s (args: %s)" -#define glusterfsd_msg_31 (GLFS_COMP_BASE + 31), "Could not create new" \ - " sync-environment" -#define glusterfsd_msg_32 (GLFS_COMP_BASE + 32), "received signum (%d)," \ - " shutting down" -#define glusterfsd_msg_33 (GLFS_COMP_BASE + 33), "obsolete option " \ - "'--volfile-max-fetch-attempts or fetch-attempts' " \ - "was provided" -#define glusterfsd_msg_34 (GLFS_COMP_BASE + 34), "memory accounting init" \ - " failed." -#define glusterfsd_msg_35 (GLFS_COMP_BASE + 35), "rpc req buffer " \ - " unserialization failed." -#define glusterfsd_msg_36 (GLFS_COMP_BASE + 36), "problem in xlator " \ - " loading." -#define glusterfsd_msg_37 (GLFS_COMP_BASE + 37), "failed to get dict value" - -/*------------*/ -#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages" - +GLFS_MSGID(GLUSTERFSD, + glusterfsd_msg_1, + glusterfsd_msg_2, + glusterfsd_msg_3, + glusterfsd_msg_4, + glusterfsd_msg_5, + glusterfsd_msg_6, + glusterfsd_msg_7, + glusterfsd_msg_8, + glusterfsd_msg_9, + glusterfsd_msg_10, + glusterfsd_msg_11, + glusterfsd_msg_12, + glusterfsd_msg_13, + glusterfsd_msg_14, + glusterfsd_msg_15, + glusterfsd_msg_16, + glusterfsd_msg_17, + glusterfsd_msg_18, + glusterfsd_msg_19, + glusterfsd_msg_20, + glusterfsd_msg_21, + glusterfsd_msg_22, + glusterfsd_msg_23, + glusterfsd_msg_24, + glusterfsd_msg_25, + glusterfsd_msg_26, + glusterfsd_msg_27, + glusterfsd_msg_28, + glusterfsd_msg_29, + glusterfsd_msg_30, + glusterfsd_msg_31, + glusterfsd_msg_32, + glusterfsd_msg_33, + glusterfsd_msg_34, + glusterfsd_msg_35, + glusterfsd_msg_36, + glusterfsd_msg_37 +); #endif /* !_GLUSTERFSD_MESSAGES_H_ */ diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index c5000da4175..59b5bc658c3 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -780,7 +780,8 @@ glusterfs_handle_bitrot (rpcsvc_request_t *req) &input); if (ret < 0) { - gf_msg (this->name, GF_LOG_ERROR, 0, glusterfsd_msg_35); + gf_msg (this->name, GF_LOG_ERROR, 0, glusterfsd_msg_35, + "rpc req buffer unserialization failed."); goto out; } @@ -789,7 +790,8 @@ glusterfs_handle_bitrot (rpcsvc_request_t *req) xlator = xlator_search_by_name (any, xname); if (!xlator) { snprintf (msg, sizeof (msg), "xlator %s is not loaded", xname); - gf_msg (this->name, GF_LOG_ERROR, 0, glusterfsd_msg_36); + gf_msg (this->name, GF_LOG_ERROR, 0, glusterfsd_msg_36, + "problem in xlator loading."); goto out; } @@ -802,7 +804,8 @@ glusterfs_handle_bitrot (rpcsvc_request_t *req) ret = dict_get_str (input, "scrub-value", &scrub_opt); if (ret) { snprintf (msg, sizeof (msg), "Failed to get scrub value"); - gf_msg (this->name, GF_LOG_ERROR, 0, glusterfsd_msg_37); + gf_msg (this->name, GF_LOG_ERROR, 0, glusterfsd_msg_37, + "failed to get dict value"); ret = -1; goto out; } diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index db7720b1829..b836bbc21c0 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -283,12 +283,15 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) cmd_args->mount_point); if (ret == -1) { gf_msg ("glusterfsd", GF_LOG_ERROR, errno, - glusterfsd_msg_1); + glusterfsd_msg_1, + "Could not create absolute mountpoint " + "path"); goto err; } } else { gf_msg ("glusterfsd", GF_LOG_ERROR, errno, - glusterfsd_msg_2); + glusterfsd_msg_2, + "Could not get current working directory"); goto err; } } else @@ -296,7 +299,8 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) ret = dict_set_dynstr (options, ZR_MOUNTPOINT_OPT, mount_point); if (ret < 0) { - gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_3); + gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_3, + "failed to set mount-point to options dictionary"); goto err; } @@ -306,7 +310,8 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, errno, - glusterfsd_msg_4, ZR_ATTR_TIMEOUT_OPT); + glusterfsd_msg_4, "failed to set dict value " + "for key " ZR_ATTR_TIMEOUT_OPT); goto err; } } @@ -316,6 +321,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) cmd_args->fuse_entry_timeout); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " ZR_ENTRY_TIMEOUT_OPT); goto err; } @@ -326,6 +332,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) cmd_args->fuse_negative_timeout); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " ZR_NEGATIVE_TIMEOUT_OPT); goto err; } @@ -336,7 +343,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) cmd_args->client_pid); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, - "client-pid"); + "failed to set dict value for key client-pid"); goto err; } } @@ -346,6 +353,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) cmd_args->uid_map_root); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " "uid-map-root"); goto err; } @@ -356,6 +364,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) cmd_args->volfile_check); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " ZR_STRICT_VOLFILE_CHECK); goto err; } @@ -366,6 +375,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) cmd_args->dump_fuse); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " ZR_DUMP_FUSE); goto err; } @@ -375,7 +385,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) ret = dict_set_static_ptr (options, "acl", "on"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, - "acl"); + "failed to set dict value for key acl"); goto err; } } @@ -384,7 +394,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) ret = dict_set_static_ptr (options, "selinux", "on"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, - "selinux"); + "failed to set dict value for key selinux"); goto err; } } @@ -393,7 +403,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) ret = dict_set_static_ptr (options, "capability", "on"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, - "capability"); + "failed to set dict value for key capability"); goto err; } } @@ -403,6 +413,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) "on"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " "aux-gfid-mount"); goto err; } @@ -412,6 +423,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) ret = dict_set_static_ptr (options, "enable-ino32", "on"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " "enable-ino32"); goto err; } @@ -421,7 +433,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) ret = dict_set_static_ptr (options, "read-only", "on"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, - "read-only"); + "failed to set dict value for key read-only"); goto err; } } @@ -432,6 +444,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) "on"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " "fopen-keep-cache"); goto err; } @@ -441,6 +454,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) "off"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " "fopen-keep-cache"); goto err; } @@ -457,7 +471,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) cmd_args->gid_timeout); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, - "gid-timeout"); + "failed to set dict value for key gid-timeout"); goto err; } } @@ -466,6 +480,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) ret = dict_set_static_ptr (options, "resolve-gids", "on"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " "resolve-gids"); goto err; } @@ -476,6 +491,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) cmd_args->background_qlen); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " "background-qlen"); goto err; } @@ -485,6 +501,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) cmd_args->congestion_threshold); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " "congestion-threshold"); goto err; } @@ -496,6 +513,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) "disable"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_5, + "failed to set 'disable' for key " ZR_DIRECT_IO_OPT); goto err; } @@ -505,6 +523,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) "enable"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_6, + "failed to set 'enable' for key " ZR_DIRECT_IO_OPT); goto err; } @@ -522,6 +541,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) "enable"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_6, + "failed to set 'enable' for key " "no-root-squash"); goto err; } @@ -532,6 +552,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) "disable"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_5, + "failed to set 'disable' for key " "no-root-squash"); goto err; } @@ -545,7 +566,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) "enable"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, - "sync-mtab"); + "failed to set dict value for key sync-mtab"); goto err; } } @@ -555,6 +576,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) cmd_args->use_readdirp); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " "use-readdirp"); goto err; } @@ -564,6 +586,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) cmd_args->event_history); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " "event-history"); goto err; } @@ -572,6 +595,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) ret = dict_set_static_ptr (options, "thin-client", "on"); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " "thin-client"); goto err; } @@ -598,7 +622,8 @@ create_fuse_mount (glusterfs_ctx_t *ctx) } if (ctx->process_mode != GF_CLIENT_PROCESS) { - gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_7); + gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_7, + "Not a client process, not performing mount operation"); return -1; } @@ -613,6 +638,7 @@ create_fuse_mount (glusterfs_ctx_t *ctx) if (xlator_set_type (master, "mount/fuse") == -1) { gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_8, + "MOUNT-POINT %s initialization failed", cmd_args->mount_point); goto err; } @@ -631,6 +657,7 @@ create_fuse_mount (glusterfs_ctx_t *ctx) cmd_args->fuse_mountopts); if (ret < 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " ZR_FUSE_MOUNTOPTS); goto err; } @@ -669,13 +696,13 @@ get_volfp (glusterfs_ctx_t *ctx) ret = sys_lstat (cmd_args->volfile, &statbuf); if (ret == -1) { gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_9, - cmd_args->volfile); + "loading volume file %s failed", cmd_args->volfile); return NULL; } if ((specfp = fopen (cmd_args->volfile, "r")) == NULL) { gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_9, - cmd_args->volfile); + "loading volume file %s failed", cmd_args->volfile); return NULL; } @@ -717,7 +744,7 @@ gf_remember_backup_volfile_server (char *arg) if (!server->volfile_server) { gf_msg ("glusterfsd", GF_LOG_WARNING, 0, glusterfsd_msg_10, - arg); + "xlator option %s is invalid", arg); goto out; } @@ -758,7 +785,8 @@ gf_remember_xlator_option (char *arg) dot = strchr (arg, '.'); if (!dot) { - gf_msg ("", GF_LOG_WARNING, 0, glusterfsd_msg_10, arg); + gf_msg ("", GF_LOG_WARNING, 0, glusterfsd_msg_10, + "xlator option %s is invalid", arg); goto out; } @@ -771,7 +799,8 @@ gf_remember_xlator_option (char *arg) equals = strchr (arg, '='); if (!equals) { - gf_msg ("", GF_LOG_WARNING, 0, glusterfsd_msg_10, arg); + gf_msg ("", GF_LOG_WARNING, 0, glusterfsd_msg_10, + "xlator option %s is invalid", arg); goto out; } @@ -783,7 +812,8 @@ gf_remember_xlator_option (char *arg) strncpy (option->key, dot + 1, (equals - dot - 1)); if (!*(equals + 1)) { - gf_msg ("", GF_LOG_WARNING, 0, glusterfsd_msg_10, arg); + gf_msg ("", GF_LOG_WARNING, 0, glusterfsd_msg_10, + "xlator option %s is invalid", arg); goto out; } @@ -1390,7 +1420,8 @@ cleanup_and_exit (int signum) gf_log_disable_suppression_before_exit (ctx); - gf_msg_callingfn ("", GF_LOG_WARNING, 0, glusterfsd_msg_32, signum); + gf_msg_callingfn ("", GF_LOG_WARNING, 0, glusterfsd_msg_32, + "received signum (%d), shutting down", signum); if (ctx->cleanup_started) return; @@ -1474,7 +1505,8 @@ reincarnate (int signum) cmd_args = &ctx->cmd_args; if (cmd_args->volfile_server) { - gf_msg ("glusterfsd", GF_LOG_INFO, 0, glusterfsd_msg_11); + gf_msg ("glusterfsd", GF_LOG_INFO, 0, glusterfsd_msg_11, + "Fetching the volume file from server..."); ret = glusterfs_volfile_fetch (ctx); } else { gf_msg_debug ("glusterfsd", 0, @@ -1486,7 +1518,8 @@ reincarnate (int signum) gf_log_logrotate (1); if (ret < 0) - gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_12); + gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_12, + "volume initialization failed."); return; } @@ -1534,7 +1567,8 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx) ret = xlator_mem_acct_init (THIS, gfd_mt_end); if (ret != 0) { - gf_msg(THIS->name, GF_LOG_CRITICAL, 0, glusterfsd_msg_34); + gf_msg(THIS->name, GF_LOG_CRITICAL, 0, glusterfsd_msg_34, + "memory accounting init failed."); return ret; } @@ -1548,7 +1582,8 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx) ctx->process_uuid = generate_glusterfs_ctx_id (); if (!ctx->process_uuid) { - gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_13); + gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_13, + "ERROR: glusterfs uuid generation failed"); goto out; } @@ -1556,20 +1591,23 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx) ctx->iobuf_pool = iobuf_pool_new (); if (!ctx->iobuf_pool) { - gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, "iobuf"); + gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, + "ERROR: glusterfs iobuf pool creation failed"); goto out; } ctx->event_pool = event_pool_new (DEFAULT_EVENT_POOL_SIZE, STARTING_EVENT_THREADS); if (!ctx->event_pool) { - gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, "event"); + gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, + "ERROR: glusterfs event pool creation failed"); goto out; } ctx->pool = GF_CALLOC (1, sizeof (call_pool_t), gfd_mt_call_pool_t); if (!ctx->pool) { - gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, "call"); + gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, + "ERROR: glusterfs call pool creation failed"); goto out; } @@ -1579,19 +1617,22 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx) /* frame_mem_pool size 112 * 4k */ ctx->pool->frame_mem_pool = mem_pool_new (call_frame_t, 4096); if (!ctx->pool->frame_mem_pool) { - gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, "frame"); + gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, + "ERROR: glusterfs frame pool creation failed"); goto out; } /* stack_mem_pool size 256 * 1024 */ ctx->pool->stack_mem_pool = mem_pool_new (call_stack_t, 1024); if (!ctx->pool->stack_mem_pool) { - gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, "stack"); + gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, + "ERROR: glusterfs stack pool creation failed"); goto out; } ctx->stub_mem_pool = mem_pool_new (call_stub_t, 1024); if (!ctx->stub_mem_pool) { - gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, "stub"); + gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, + "ERROR: glusterfs stub pool creation failed"); goto out; } @@ -1985,7 +2026,9 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx) /* 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) { - gf_msg ("glusterfs", GF_LOG_CRITICAL, 0, glusterfsd_msg_15); + gf_msg ("glusterfs", GF_LOG_CRITICAL, 0, glusterfsd_msg_15, + "ERROR: '--volfile-id' is mandatory if '-s' OR " + "'--volfile-server' option is given"); ret = -1; goto out; } @@ -2004,7 +2047,8 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx) ret = sys_stat (cmd_args->volfile, &stbuf); if (ret) { gf_msg ("glusterfs", GF_LOG_CRITICAL, errno, - glusterfsd_msg_16); + glusterfsd_msg_16, + "ERROR: parsing the volfile failed"); /* argp_usage (argp.) */ fprintf (stderr, "USAGE: %s [options] [mountpoint]\n", argv[0]); @@ -2059,7 +2103,9 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx) compatibility with third party applications */ if (cmd_args->max_connect_attempts) { - gf_msg ("glusterfs", GF_LOG_WARNING, 0, glusterfsd_msg_33); + gf_msg ("glusterfs", GF_LOG_WARNING, 0, glusterfsd_msg_33, + "obsolete option '--volfile-max-fecth-attempts or " + "fetch-attempts' was provided"); } #ifdef GF_DARWIN_HOST_OS @@ -2088,7 +2134,7 @@ glusterfs_pidfile_setup (glusterfs_ctx_t *ctx) pidfp = fopen (cmd_args->pid_file, "a+"); if (!pidfp) { gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_17, - cmd_args->pid_file); + "pidfile %s open failed", cmd_args->pid_file); goto out; } @@ -2141,28 +2187,28 @@ glusterfs_pidfile_update (glusterfs_ctx_t *ctx, pid_t pid) ret = lockf (fileno (pidfp), F_TLOCK, 0); if (ret) { gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_18, - cmd_args->pid_file); + "pidfile %s lock failed", cmd_args->pid_file); return ret; } ret = sys_ftruncate (fileno (pidfp), 0); if (ret) { gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_20, - cmd_args->pid_file); + "pidfile %s truncation failed", cmd_args->pid_file); return ret; } ret = fprintf (pidfp, "%d\n", pid); if (ret <= 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_21, - cmd_args->pid_file); + "pidfile %s write failed", cmd_args->pid_file); return ret; } ret = fflush (pidfp); if (ret) { gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_21, - cmd_args->pid_file); + "pidfile %s write failed", cmd_args->pid_file); return ret; } @@ -2255,7 +2301,8 @@ glusterfs_signals_setup (glusterfs_ctx_t *ctx) ret = pthread_sigmask (SIG_BLOCK, &set, NULL); if (ret) { - gf_msg ("glusterfsd", GF_LOG_WARNING, errno, glusterfsd_msg_22); + gf_msg ("glusterfsd", GF_LOG_WARNING, errno, glusterfsd_msg_22, + "failed to execute pthread_sigmask"); return ret; } @@ -2267,7 +2314,8 @@ glusterfs_signals_setup (glusterfs_ctx_t *ctx) fallback to signals getting handled by other threads. setup the signal handlers */ - gf_msg ("glusterfsd", GF_LOG_WARNING, errno, glusterfsd_msg_23); + gf_msg ("glusterfsd", GF_LOG_WARNING, errno, glusterfsd_msg_23, + "failed to create pthread"); return ret; } @@ -2317,7 +2365,8 @@ daemonize (glusterfs_ctx_t *ctx) sys_close (ctx->daemon_pipe[1]); } - gf_msg ("daemonize", GF_LOG_ERROR, errno, glusterfsd_msg_24); + gf_msg ("daemonize", GF_LOG_ERROR, errno, glusterfsd_msg_24, + "daemonization failed"); goto out; case 0: /* child */ @@ -2339,7 +2388,7 @@ daemonize (glusterfs_ctx_t *ctx) err = cstatus; } gf_msg ("daemonize", GF_LOG_ERROR, 0, - glusterfsd_msg_25); + glusterfsd_msg_25, "mount failed"); exit (err); } } @@ -2414,14 +2463,17 @@ glusterfs_process_volfp (glusterfs_ctx_t *ctx, FILE *fp) graph = glusterfs_graph_construct (fp); if (!graph) { - gf_msg ("", GF_LOG_ERROR, 0, glusterfsd_msg_26); + gf_msg ("", GF_LOG_ERROR, 0, glusterfsd_msg_26, + "failed to construct the graph"); goto out; } for (trav = graph->first; trav; trav = trav->next) { if (strcmp (trav->type, "mount/fuse") == 0) { gf_msg ("glusterfsd", GF_LOG_ERROR, 0, - glusterfsd_msg_27); + glusterfsd_msg_27, + "fuse xlator cannot be specified in volume " + "file"); goto out; } } @@ -2484,7 +2536,8 @@ glusterfs_volumes_init (glusterfs_ctx_t *ctx) fp = get_volfp (ctx); if (!fp) { - gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_28); + gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_28, + "Cannot reach volume specification file"); ret = -1; goto out; } @@ -2515,7 +2568,8 @@ main (int argc, char *argv[]) ctx = glusterfs_ctx_new (); if (!ctx) { - gf_msg ("glusterfs", GF_LOG_CRITICAL, 0, glusterfsd_msg_29); + gf_msg ("glusterfs", GF_LOG_CRITICAL, 0, glusterfsd_msg_29, + "ERROR: glusterfs context not initialized"); return ENOMEM; } glusterfsd_ctx = ctx; @@ -2567,6 +2621,7 @@ main (int argc, char *argv[]) (sizeof (cmdlinestr) - 1)); } gf_msg (argv[0], GF_LOG_INFO, 0, glusterfsd_msg_30, + "Started running %s version %s (args: %s)", argv[0], PACKAGE_VERSION, cmdlinestr); ctx->cmdlinestr = gf_strdup (cmdlinestr); @@ -2597,7 +2652,8 @@ main (int argc, char *argv[]) ctx->env = syncenv_new (0, 0, 0); if (!ctx->env) { - gf_msg ("", GF_LOG_ERROR, 0, glusterfsd_msg_31); + gf_msg ("", GF_LOG_ERROR, 0, glusterfsd_msg_31, + "Could not create new sync-environment"); goto out; } |