diff options
author | Nandaja Varma <nandaja.varma@gmail.com> | 2015-03-17 13:16:06 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2015-06-20 21:27:06 -0700 |
commit | 38d602e820b99b0c9e2efe788df7450e4d863196 (patch) | |
tree | 81d2d62adaae3e55662fe11c9772b9944f54a7aa /xlators/mgmt/glusterd/src/glusterd-volume-ops.c | |
parent | 16115c232e48f080624b68eb94f813fb3c226e58 (diff) |
ops/glusterd: Porting messages to new logging framework
cherry-picked from commit 70bb8bf65b4cefb503fa94452c200b0b71a06535
>Change-Id: Iafeb07aabc1781d98f51c6c2627bf3bbdf493153
>BUG: 1194640
>Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com>
>Reviewed-on: http://review.gluster.org/9905
>Tested-by: Gluster Build System <jenkins@build.gluster.com>
>Tested-by: NetBSD Build System <jenkins@build.gluster.org>
>Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Change-Id: Iafeb07aabc1781d98f51c6c2627bf3bbdf493153
BUG: 1217722
Signed-off-by: Nandaja Varma <nvarma@redhat.com>
Reviewed-on: http://review.gluster.org/11230
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-ops.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 419 |
1 files changed, 272 insertions, 147 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 017193fcc53..d801a13fc09 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -117,7 +117,9 @@ glusterd_check_brick_order(dict_t *dict, char *err_str) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, + "Unable to get volume name"); goto out; } @@ -125,20 +127,24 @@ glusterd_check_brick_order(dict_t *dict, char *err_str) if (ret) { snprintf (err_str, 512, "Unable to get type of volume %s", volname); - gf_log (this->name, GF_LOG_WARNING, "%s", err_str); + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_DICT_GET_FAILED, + "%s", err_str); goto out; } ret = dict_get_str (dict, "bricks", &brick_list); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Bricks check : Could not " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Bricks check : Could not " "retrieve bricks list"); goto out; } ret = dict_get_int32 (dict, "count", &brick_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Bricks check : Could not " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Bricks check : Could not " "retrieve brick count"); goto out; } @@ -146,16 +152,18 @@ glusterd_check_brick_order(dict_t *dict, char *err_str) if (type != GF_CLUSTER_TYPE_DISPERSE) { ret = dict_get_int32 (dict, "replica-count", &sub_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Bricks check : Could" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Bricks check : Could" " not retrieve replica count"); goto out; } - gf_log (this->name, GF_LOG_DEBUG, "Replicate cluster type " + gf_msg_debug (this->name, 0, "Replicate cluster type " "found. Checking brick order."); } else { ret = dict_get_int32 (dict, "disperse-count", &sub_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Bricks check : Could" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Bricks check : Could" " not retrieve disperse count"); goto out; } @@ -177,14 +185,17 @@ glusterd_check_brick_order(dict_t *dict, char *err_str) ret = getaddrinfo (brick, NULL, NULL, &ai_info); if (ret != 0) { ret = 0; - gf_log (this->name, GF_LOG_ERROR, "unable to resolve " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_HOSTNAME_RESOLVE_FAIL, + "unable to resolve " "host name"); goto out; } ai_list_tmp1 = malloc (sizeof (addrinfo_list_t)); if (ai_list_tmp1 == NULL) { ret = 0; - gf_log (this->name, GF_LOG_ERROR, "failed to allocate " + gf_msg (this->name, GF_LOG_ERROR, ENOMEM, + GD_MSG_NO_MEMORY, "failed to allocate " "memory"); goto out; } @@ -222,18 +233,20 @@ glusterd_check_brick_order(dict_t *dict, char *err_str) } ++j; } - gf_log (this->name, GF_LOG_DEBUG, "Brick order okay"); + gf_msg_debug (this->name, 0, "Brick order okay"); ret = 0; goto out; check_failed: - gf_log (this->name, GF_LOG_ERROR, "Failed bad brick order check"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_BAD_BRKORDER_CHECK_FAIL, "Failed bad brick order check"); snprintf (err_str, sizeof (failed_string), failed_string); ret = -1; goto out; found_bad_brick_order: - gf_log (this->name, GF_LOG_INFO, "Bad brick order found"); + gf_msg (this->name, GF_LOG_INFO, 0, + GD_MSG_BAD_BRKORDER, "Bad brick order found"); snprintf (err_str, sizeof (found_string), found_string); ret = -1; out: @@ -281,11 +294,12 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) req->rpc_err = GARBAGE_ARGS; snprintf (err_str, sizeof (err_str), "Failed to decode request " "received from cli"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_REQ_DECODE_FAIL, "%s", err_str); goto out; } - gf_log (this->name, GF_LOG_DEBUG, "Received create volume req"); + gf_msg_debug (this->name, 0, "Received create volume req"); if (cli_req.dict.dict_len) { /* Unserialize the dictionary */ @@ -295,7 +309,8 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (err_str, sizeof (err_str), "Unable to decode " @@ -311,14 +326,16 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get volume " "name"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } if ((ret = glusterd_check_volume_exists (volname))) { snprintf (err_str, sizeof (err_str), "Volume %s already exists", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, EEXIST, + GD_MSG_VOL_ALREADY_EXIST, "%s", err_str); goto out; } @@ -326,7 +343,8 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get brick count" " for volume %s", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } @@ -334,7 +352,8 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get type of " "volume %s", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } @@ -342,19 +361,22 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get " "transport-type of volume %s", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } ret = dict_get_str (dict, "bricks", &bricks); if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get bricks for " "volume %s", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } if (!dict_get (dict, "force")) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get 'force' flag"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get 'force' flag"); goto out; } @@ -364,7 +386,8 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to set volume " "id of volume %s", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "%s", err_str); goto out; } free_ptr = NULL; @@ -375,7 +398,8 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) username = gf_strdup (uuid_utoa (tmp_uuid)); ret = dict_set_dynstr (dict, "internal-username", username); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to set username for " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set username for " "volume %s", volname); goto out; } @@ -384,7 +408,8 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) password = gf_strdup (uuid_utoa (tmp_uuid)); ret = dict_set_dynstr (dict, "internal-password", password); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to set password for " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set password for " "volume %s", volname); goto out; } @@ -437,7 +462,8 @@ __glusterd_handle_cli_start_volume (rpcsvc_request_t *req) snprintf (errstr, sizeof (errstr), "Failed to decode message " "received from cli"); req->rpc_err = GARBAGE_ARGS; - gf_log (this->name, sizeof (errstr), "%s", errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_REQ_DECODE_FAIL, "%s", errstr); goto out; } @@ -449,7 +475,8 @@ __glusterd_handle_cli_start_volume (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (errstr, sizeof (errstr), "Unable to decode " @@ -461,12 +488,13 @@ __glusterd_handle_cli_start_volume (rpcsvc_request_t *req) ret = dict_get_str (dict, "volname", &volname); if (ret) { snprintf (errstr, sizeof (errstr), "Unable to get volume name"); - gf_log (this->name, GF_LOG_ERROR, "%s", errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", errstr); goto out; } - gf_log (this->name, GF_LOG_DEBUG, "Received start vol req" - " for volume %s", volname); + gf_msg_debug (this->name, 0, "Received start vol req" + " for volume %s", volname); ret = glusterd_op_begin_synctask (req, GD_OP_START_VOLUME, dict); @@ -510,7 +538,8 @@ __glusterd_handle_cli_stop_volume (rpcsvc_request_t *req) snprintf (err_str, sizeof (err_str), "Failed to decode message " "received from cli"); req->rpc_err = GARBAGE_ARGS; - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_REQ_DECODE_FAIL, "%s", err_str); goto out; } if (cli_req.dict.dict_len) { @@ -521,7 +550,8 @@ __glusterd_handle_cli_stop_volume (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (err_str, sizeof (err_str), "Unable to decode " @@ -535,11 +565,12 @@ __glusterd_handle_cli_stop_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Failed to get volume " "name"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } - gf_log (this->name, GF_LOG_DEBUG, "Received stop vol req " + gf_msg_debug (this->name, 0, "Received stop vol req " "for volume %s", dup_volname); ret = glusterd_op_begin_synctask (req, GD_OP_STOP_VOLUME, dict); @@ -585,7 +616,8 @@ __glusterd_handle_cli_delete_volume (rpcsvc_request_t *req) if (ret < 0) { snprintf (err_str, sizeof (err_str), "Failed to decode request " "received from cli"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_REQ_DECODE_FAIL, "%s", err_str); req->rpc_err = GARBAGE_ARGS; goto out; } @@ -598,7 +630,8 @@ __glusterd_handle_cli_delete_volume (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (err_str, sizeof (err_str), "Unable to decode " @@ -611,12 +644,13 @@ __glusterd_handle_cli_delete_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Failed to get volume " "name"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); req->rpc_err = GARBAGE_ARGS; goto out; } - gf_log (this->name, GF_LOG_DEBUG, "Received delete vol req" + gf_msg_debug (this->name, 0, "Received delete vol req" "for volume %s", volname); ret = glusterd_op_begin_synctask (req, GD_OP_DELETE_VOLUME, dict); @@ -727,7 +761,8 @@ __glusterd_handle_cli_heal_volume (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (op_errstr, sizeof (op_errstr), @@ -742,7 +777,8 @@ __glusterd_handle_cli_heal_volume (rpcsvc_request_t *req) if (ret) { snprintf (op_errstr, sizeof (op_errstr), "Unable to find " "volume name"); - gf_log (this->name, GF_LOG_ERROR, "%s", op_errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", op_errstr); goto out; } @@ -786,7 +822,8 @@ out: if (op_errstr[0] == '\0') snprintf (op_errstr, sizeof (op_errstr), "operation failed"); - gf_log (this->name, GF_LOG_ERROR, "%s", op_errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_GLUSTERD_OP_FAILED, "%s", op_errstr); ret = glusterd_op_send_cli_response (cli_op, ret, 0, req, dict, op_errstr); } @@ -836,7 +873,8 @@ __glusterd_handle_cli_statedump_volume (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (err_str, sizeof (err_str), "Unable to " @@ -848,14 +886,16 @@ __glusterd_handle_cli_statedump_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get the volume " "name"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } ret = dict_get_str (dict, "options", &options); if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get options"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } @@ -863,7 +903,8 @@ __glusterd_handle_cli_statedump_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str , sizeof (err_str), "Unable to get option " "count"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } @@ -1030,7 +1071,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } @@ -1046,28 +1088,34 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, ret = dict_get_int32 (dict, "count", &brick_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get brick count " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get brick count " "for volume %s", volname); goto out; } ret = dict_get_str (dict, "volume-id", &volume_uuid_str); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume id of " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume id of " "volume %s", volname); goto out; } ret = gf_uuid_parse (volume_uuid_str, volume_uuid); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to parse volume id of" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_UUID_PARSE_FAIL, + "Unable to parse volume id of" " volume %s", volname); goto out; } ret = dict_get_str (dict, "bricks", &bricks); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get bricks for " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, + "Unable to get bricks for " "volume %s", volname); goto out; } @@ -1115,7 +1163,9 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, ret = glusterd_resolve_brick (brick_info); if (ret) { - gf_log (this->name, GF_LOG_ERROR, FMTSTR_RESOLVE_BRICK, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RESOLVE_BRICK_FAIL, + FMTSTR_RESOLVE_BRICK, brick_info->hostname, brick_info->path); goto out; } @@ -1142,7 +1192,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, (brick_info->path, brick_info->hostname, brick_info->mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_BRICK_MOUNTDIR_GET_FAIL, "Failed to get brick mount_dir"); goto out; } @@ -1152,7 +1203,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, ret = dict_set_dynstr_with_alloc (rsp_dict, key, brick_info->mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set %s", key); goto out; } @@ -1173,7 +1225,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, if (ret) { snprintf (msg, sizeof (msg), "Unable to get type of " "volume %s", volname); - gf_log (this->name, GF_LOG_WARNING, "%s", msg); + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_DICT_GET_FAILED, "%s", msg); goto out; } @@ -1183,7 +1236,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, (type == GF_CLUSTER_TYPE_DISPERSE)) { ret = glusterd_check_brick_order(dict, msg); if (ret) { - gf_log(this->name, GF_LOG_ERROR, "Not " + gf_msg(this->name, GF_LOG_ERROR, 0, + GD_MSG_BAD_BRKORDER, "Not " "creating volume because of bad " "brick order"); goto out; @@ -1194,7 +1248,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, ret = dict_set_int32 (rsp_dict, "brick_count", local_brick_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set local_brick_count"); goto out; } @@ -1207,7 +1262,7 @@ out: gf_log (this->name, GF_LOG_ERROR, "%s", msg); *op_errstr = gf_strdup (msg); } - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -1226,13 +1281,15 @@ glusterd_op_stop_volume_args_get (dict_t *dict, char** volname, int *flags) ret = dict_get_str (dict, "volname", volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } ret = dict_get_int32 (dict, "flags", flags); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get flags"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get flags"); goto out; } out: @@ -1250,19 +1307,22 @@ glusterd_op_statedump_volume_args_get (dict_t *dict, char **volname, ret = dict_get_str (dict, "volname", volname); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get volname"); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volname"); goto out; } ret = dict_get_str (dict, "options", options); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get options"); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get options"); goto out; } ret = dict_get_int32 (dict, "option_cnt", option_cnt); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get option count"); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get option count"); goto out; } @@ -1311,7 +1371,8 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, ret = glusterd_volinfo_find (volname, &volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, FMTSTR_CHECK_VOL_EXISTS, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLINFO_GET_FAIL, FMTSTR_CHECK_VOL_EXISTS, volname); goto out; } @@ -1333,7 +1394,8 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, brick_count++; ret = glusterd_resolve_brick (brickinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, FMTSTR_RESOLVE_BRICK, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RESOLVE_BRICK_FAIL, FMTSTR_RESOLVE_BRICK, brickinfo->hostname, brickinfo->path); goto out; } @@ -1396,7 +1458,8 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, (brickinfo->path, brickinfo->hostname, brickinfo->mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_BRICK_MOUNTDIR_GET_FAIL, "Failed to get brick mount_dir"); goto out; } @@ -1406,7 +1469,8 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, ret = dict_set_dynstr_with_alloc (rsp_dict, key, brickinfo->mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set %s", key); goto out; } @@ -1433,7 +1497,8 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, ret = dict_set_int32 (rsp_dict, "brick_count", local_brick_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set local_brick_count"); goto out; } @@ -1471,7 +1536,8 @@ glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr) if (!exists) { snprintf (msg, sizeof (msg), FMTSTR_CHECK_VOL_EXISTS, volname); - gf_log (this->name, GF_LOG_ERROR, "%s", msg); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, "%s", msg); ret = -1; goto out; } @@ -1479,7 +1545,8 @@ glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr) ret = glusterd_volinfo_find (volname, &volinfo); if (ret) { snprintf (msg, sizeof (msg), FMTSTR_CHECK_VOL_EXISTS, volname); - gf_log (this->name, GF_LOG_ERROR, "%s", msg); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLINFO_GET_FAIL, "%s", msg); goto out; } @@ -1494,7 +1561,8 @@ glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr) if (_gf_false == glusterd_is_volume_started (volinfo)) { snprintf (msg, sizeof(msg), "Volume %s " "is not in the started state", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", msg); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_STARTED, "%s", msg); ret = -1; goto out; } @@ -1519,14 +1587,15 @@ glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr) if (glusterd_is_defrag_on (volinfo)) { snprintf (msg, sizeof(msg), "rebalance session is " "in progress for the volume '%s'", volname); - gf_log (this->name, GF_LOG_WARNING, "%s", msg); + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_OIP, "%s", msg); ret = -1; goto out; } out: if (msg[0] != 0) *op_errstr = gf_strdup (msg); - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -1546,7 +1615,8 @@ glusterd_op_stage_delete_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } @@ -1595,7 +1665,7 @@ out: gf_log (this->name, GF_LOG_ERROR, "%s", msg); *op_errstr = gf_strdup (msg); } - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -1699,14 +1769,16 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr) priv = this->private; if (!priv) { ret = -1; - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_PRIV_NULL, "priv is NULL"); goto out; } ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get volume name"); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } @@ -1714,7 +1786,8 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr) if (ret) { ret = -1; snprintf (msg, sizeof (msg), "Volume %s does not exist", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", msg); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1727,7 +1800,8 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr) ret = -1; snprintf (msg, sizeof (msg), "Volume %s is not started.", volname); - gf_log (THIS->name, GF_LOG_WARNING, "%s", msg); + gf_msg (THIS->name, GF_LOG_WARNING, 0, + GD_MSG_VOL_NOT_STARTED, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1745,7 +1819,8 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr) snprintf (msg, sizeof (msg), "Self-heal-daemon is " "disabled. Heal will not be triggered on volume %s", volname); - gf_log (this->name, GF_LOG_WARNING, "%s", msg); + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_SELF_HEALD_DISABLED, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1756,7 +1831,7 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr) ret = 0; out: - gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug ("glusterd", 0, "Returning %d", ret); return ret; } @@ -1820,7 +1895,7 @@ glusterd_op_stage_statedump_volume (dict_t *dict, char **op_errstr) out: if (ret && msg[0] != '\0') *op_errstr = gf_strdup (msg); - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -1838,7 +1913,8 @@ glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "volname", &volname); if (ret) { snprintf (msg, sizeof(msg), "Failed to get volume name"); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1846,7 +1922,8 @@ glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "path", &path); if (ret) { snprintf (msg, sizeof(msg), "Failed to get path"); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1854,7 +1931,8 @@ glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "kind", &kind); if (ret) { snprintf (msg, sizeof(msg), "Failed to get kind"); - gf_log ("", GF_LOG_ERROR, "%s", msg); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1862,7 +1940,8 @@ glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "type", &type); if (ret) { snprintf (msg, sizeof(msg), "Failed to get type"); - gf_log ("", GF_LOG_ERROR, "%s", msg); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1871,7 +1950,8 @@ glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr) if (ret) { snprintf (msg, sizeof(msg), "Volume %s does not exist", volname); - gf_log ("", GF_LOG_ERROR, "%s", msg); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1883,14 +1963,15 @@ glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr) if (!glusterd_is_volume_started (volinfo)) { snprintf (msg, sizeof(msg), "Volume %s is not started", volname); - gf_log ("", GF_LOG_ERROR, "%s", msg); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_STARTED, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } ret = 0; out: - gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug ("glusterd", 0, "Returning %d", ret); return ret; } @@ -1930,7 +2011,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = glusterd_volinfo_new (&volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, ENOMEM, + GD_MSG_NO_MEMORY, "Unable to allocate memory for volinfo"); goto out; } @@ -1938,7 +2020,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } @@ -1947,21 +2030,24 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_int32 (dict, "type", &volinfo->type); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get type of volume" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get type of volume" " %s", volname); goto out; } ret = dict_get_int32 (dict, "count", &volinfo->brick_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get brick count of" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get brick count of" " volume %s", volname); goto out; } ret = dict_get_int32 (dict, "port", &volinfo->port); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get port"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get port"); goto out; } @@ -1969,7 +2055,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "bricks", &bricks); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get bricks for " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get bricks for " "volume %s", volname); goto out; } @@ -1983,7 +2070,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_int32 (dict, "replica-count", &volinfo->replica_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get " "replica count for volume %s", volname); goto out; } @@ -1993,7 +2081,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_int32 (dict, "stripe-count", &volinfo->stripe_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get stripe" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get stripe" " count for volume %s", volname); goto out; } @@ -2001,14 +2090,16 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_int32 (dict, "stripe-count", &volinfo->stripe_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get stripe" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get stripe" " count for volume %s", volname); goto out; } ret = dict_get_int32 (dict, "replica-count", &volinfo->replica_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get " "replica count for volume %s", volname); goto out; } @@ -2018,19 +2109,22 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_int32 (dict, "disperse-count", &volinfo->disperse_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get " "disperse count for volume %s", volname); goto out; } ret = dict_get_int32 (dict, "redundancy-count", &volinfo->redundancy_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get " "redundancy count for volume %s", volname); goto out; } if (priv->op_version < GD_OP_VERSION_3_6_0) { - gf_log (this->name, GF_LOG_ERROR, "Disperse volume " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_UNSUPPORTED_VERSION, "Disperse volume " "needs op-version 3.6.0 or higher"); ret = -1; goto out; @@ -2053,27 +2147,31 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "transport", &trans_type); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get transport type of volume %s", volname); goto out; } ret = dict_get_str (dict, "volume-id", &str); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume-id of volume %s", volname); goto out; } ret = gf_uuid_parse (str, volinfo->volume_id); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_UUID_PARSE_FAIL, "unable to parse uuid %s of volume %s", str, volname); goto out; } ret = dict_get_str (dict, "internal-username", &username); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "unable to get internal username of volume %s", volname); goto out; @@ -2082,7 +2180,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "internal-password", &password); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "unable to get internal password of volume %s", volname); goto out; @@ -2119,7 +2218,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = glusterd_resolve_brick (brickinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, FMTSTR_RESOLVE_BRICK, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RESOLVE_BRICK_FAIL, FMTSTR_RESOLVE_BRICK, brickinfo->hostname, brickinfo->path); goto out; } @@ -2132,7 +2232,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) snprintf (key, sizeof(key), "brick%d.mount_dir", i); ret = dict_get_str (dict, key, &brick_mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s not present", key); goto out; } @@ -2145,7 +2246,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) && brickinfo->vg[0]) { ret = glusterd_is_valid_vg (brickinfo, 0, msg); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "%s", msg); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_INVALID_VG, "%s", msg); goto out; } @@ -2244,12 +2346,14 @@ glusterd_start_volume (glusterd_volinfo_t *volinfo, int flags, ret = glusterd_store_volinfo (volinfo, verincrement); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to store volinfo of " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLINFO_SET_FAIL, + "Failed to store volinfo of " "%s volume", volinfo->volname); goto out; } out: - gf_log (this->name, GF_LOG_TRACE, "returning %d ", ret); + gf_msg_trace (this->name, 0, "returning %d ", ret); return ret; } @@ -2279,7 +2383,8 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr) ret = glusterd_volinfo_find (volname, &volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, FMTSTR_CHECK_VOL_EXISTS, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, FMTSTR_CHECK_VOL_EXISTS, volname); goto out; } @@ -2302,7 +2407,8 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, key, &brick_mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s not present", key); goto out; } @@ -2326,7 +2432,7 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr) ret = glusterd_svcs_manager (volinfo); out: - gf_log (this->name, GF_LOG_TRACE, "returning %d ", ret); + gf_msg_trace (this->name, 0, "returning %d ", ret); return ret; } @@ -2348,7 +2454,8 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo) cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) { ret = glusterd_brick_stop (volinfo, brickinfo, _gf_false); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to stop " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_BRICK_STOP_FAIL, "Failed to stop " "brick (%s)", brickinfo->path); goto out; } @@ -2358,7 +2465,8 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo) ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to store volinfo of " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLINFO_SET_FAIL, "Failed to store volinfo of " "%s volume", volinfo->volname); goto out; } @@ -2367,7 +2475,7 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo) GLUSTERFS_GET_AUX_MOUNT_PIDFILE (pidfile, volinfo->volname); if (!gf_is_service_running (pidfile, NULL)) { - gf_log (this->name, GF_LOG_DEBUG, "Aux mount of volume %s " + gf_msg_debug (this->name, 0, "Aux mount of volume %s " "absent", volinfo->volname); } else { GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (mountdir, volinfo->volname, @@ -2375,9 +2483,10 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo) ret = gf_umount_lazy (this->name, mountdir, 0); if (ret) - gf_log (this->name, GF_LOG_ERROR, - "umount on %s failed, reason : %s", - mountdir, strerror (errno)); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_UNOUNT_FAILED, + "umount on %s failed", + mountdir); } if (!volinfo->is_snap_volume) { @@ -2389,7 +2498,8 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo) ret = glusterd_svcs_manager (volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to notify graph " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_GRAPH_CHANGE_NOTIFY_FAIL, "Failed to notify graph " "change for %s volume", volinfo->volname); goto out; @@ -2417,14 +2527,16 @@ glusterd_op_stop_volume (dict_t *dict) ret = glusterd_volinfo_find (volname, &volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, FMTSTR_CHECK_VOL_EXISTS, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, FMTSTR_CHECK_VOL_EXISTS, volname); goto out; } ret = glusterd_stop_volume (volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to stop %s volume", + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_STOP_FAILED, "Failed to stop %s volume", volname); goto out; } @@ -2448,13 +2560,15 @@ glusterd_op_delete_volume (dict_t *dict) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } ret = glusterd_volinfo_find (volname, &volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, FMTSTR_CHECK_VOL_EXISTS, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, FMTSTR_CHECK_VOL_EXISTS, volname); goto out; } @@ -2465,7 +2579,7 @@ glusterd_op_delete_volume (dict_t *dict) ret = glusterd_delete_volume (volinfo); out: - gf_log (this->name, GF_LOG_DEBUG, "returning %d", ret); + gf_msg_debug (this->name, 0, "returning %d", ret); return ret; } @@ -2496,7 +2610,7 @@ glusterd_op_statedump_volume (dict_t *dict, char **op_errstr) ret = glusterd_volinfo_find (volname, &volinfo); if (ret) goto out; - gf_log ("", GF_LOG_DEBUG, "Performing statedump on volume %s", volname); + gf_msg_debug ("glusterd", 0, "Performing statedump on volume %s", volname); if (strstr (options, "nfs") != NULL) { ret = glusterd_nfs_statedump (options, option_cnt, op_errstr); if (ret) @@ -2517,7 +2631,8 @@ glusterd_op_statedump_volume (dict_t *dict, char **op_errstr) * exiting, if statedump of this brick fails. */ if (ret) - gf_log (THIS->name, GF_LOG_WARNING, "could not " + gf_msg (THIS->name, GF_LOG_WARNING, 0, + GD_MSG_BRK_STATEDUMP_FAIL, "could not " "take the statedump of the brick %s:%s." " Proceeding to other bricks", brickinfo->hostname, brickinfo->path); @@ -2544,7 +2659,7 @@ glusterd_clearlocks_send_cmd (glusterd_volinfo_t *volinfo, char *cmd, if (ret < 0) { snprintf (errstr, err_len, "clear-locks getxattr command " "failed. Reason: %s", strerror (errno)); - gf_log (THIS->name, GF_LOG_DEBUG, "%s", errstr); + gf_msg_debug (THIS->name, 0, "%s", errstr); goto out; } @@ -2563,7 +2678,7 @@ glusterd_clearlocks_rmdir_mount (glusterd_volinfo_t *volinfo, char *mntpt) ret = rmdir (mntpt); if (ret) { - gf_log (THIS->name, GF_LOG_DEBUG, "rmdir failed"); + gf_msg_debug (THIS->name, 0, "rmdir failed"); goto out; } @@ -2594,7 +2709,7 @@ glusterd_clearlocks_unmount (glusterd_volinfo_t *volinfo, char *mntpt) synclock_lock (&priv->big_lock); if (ret) { ret = 0; - gf_log ("", GF_LOG_DEBUG, + gf_msg_debug ("glusterd", 0, "umount failed on maintenance client"); } @@ -2615,7 +2730,7 @@ glusterd_clearlocks_create_mount (glusterd_volinfo_t *volinfo, char **mntpt) volinfo->volname); tmpl = mkdtemp (template); if (!tmpl) { - gf_log (THIS->name, GF_LOG_DEBUG, "Couldn't create temporary " + gf_msg_debug (THIS->name, 0, "Couldn't create temporary " "mount directory. Reason %s", strerror (errno)); goto out; } @@ -2667,11 +2782,11 @@ glusterd_clearlocks_mount (glusterd_volinfo_t *volinfo, char **xl_opts, ret = runner_run (&runner); synclock_lock (&priv->big_lock); if (ret) { - gf_log (THIS->name, GF_LOG_DEBUG, + gf_msg_debug (THIS->name, 0, "Could not start glusterfs"); goto out; } - gf_log (THIS->name, GF_LOG_DEBUG, + gf_msg_debug (THIS->name, 0, "Started glusterfs successfully"); out: @@ -2692,7 +2807,7 @@ glusterd_clearlocks_get_local_client_ports (glusterd_volinfo_t *volinfo, GF_ASSERT (xl_opts); if (!xl_opts) { - gf_log (THIS->name, GF_LOG_DEBUG, "Should pass non-NULL " + gf_msg_debug (THIS->name, 0, "Should pass non-NULL " "xl_opts"); goto out; } @@ -2716,7 +2831,7 @@ glusterd_clearlocks_get_local_client_ports (glusterd_volinfo_t *volinfo, GF_PMAP_PORT_BRICKSERVER); if (!port) { ret = -1; - gf_log (THIS->name, GF_LOG_DEBUG, "Couldn't get port " + gf_msg_debug (THIS->name, 0, "Couldn't get port " " for brick %s:%s", brickinfo->hostname, brickinfo->path); goto out; @@ -2756,26 +2871,30 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "Failed to get volume name"); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get volume name"); goto out; } - gf_log ("", GF_LOG_DEBUG, "Performing clearlocks on volume %s", volname); + gf_msg_debug ("glusterd", 0, "Performing clearlocks on volume %s", volname); ret = dict_get_str (dict, "path", &path); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "Failed to get path"); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get path"); goto out; } ret = dict_get_str (dict, "kind", &kind); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "Failed to get kind"); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get kind"); goto out; } ret = dict_get_str (dict, "type", &type); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "Failed to get type"); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get type"); goto out; } @@ -2800,7 +2919,8 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict) if (ret) { snprintf (msg, sizeof (msg), "Volume %s doesn't exist.", volname); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, "%s", msg); goto out; } @@ -2813,7 +2933,8 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict) if (ret) { snprintf (msg, sizeof (msg), "Couldn't get port numbers of " "local bricks"); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_BRK_PORT_NUM_GET_FAIL, "%s", msg); goto out; } @@ -2821,7 +2942,8 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict) if (ret) { snprintf (msg, sizeof (msg), "Creating mount directory " "for clear-locks failed."); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_CLRLOCKS_MOUNTDIR_CREATE_FAIL, "%s", msg); goto out; } @@ -2829,7 +2951,8 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict) if (ret) { snprintf (msg, sizeof (msg), "Failed to mount clear-locks " "maintenance client."); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_CLRLOCKS_CLNT_MOUNT_FAIL, "%s", msg); goto out; } @@ -2845,14 +2968,16 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict) GF_FREE (free_ptr); snprintf (msg, sizeof (msg), "Failed to set clear-locks " "result"); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "%s", msg); } umount: glusterd_clearlocks_unmount (volinfo, mntpt); if (glusterd_clearlocks_rmdir_mount (volinfo, mntpt)) - gf_log (THIS->name, GF_LOG_WARNING, "Couldn't unmount " + gf_msg (THIS->name, GF_LOG_WARNING, 0, + GD_MSG_CLRLOCKS_CLNT_UMOUNT_FAIL, "Couldn't unmount " "clear-locks mount point"); out: |