From 2306935d3244023b43a651312611c409ddd0609d Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Tue, 22 Nov 2016 19:04:54 +0530 Subject: [PATCH 190/206] glusterd: fix few events generation This patch does the following: 1. Generate PEER_REJECT event if the peer add request is from an unknown peer during peer handshaking. 2. EVENT_COMPARE_FRIEND_VOLUME_FAILED should be generated based on status code, not ret. 3. Add EVENT_BRICKPATH_RESOLVE_FAILED event in case glusterd fails to resolve bricks, this is mainly at restore path. 4. Remove EVENT_BRICKS_START_FAILED event as we already have EVENT_BRICK_START_FAILED >Reviewed-on: http://review.gluster.org/15903 >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Reviewed-by: Samikshan Bairagya >Reviewed-on: http://review.gluster.org/15912 >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Reviewed-by: Samikshan Bairagya Change-Id: I90e5bc4a331166d0bb3554eb2ec9df2526837a1d BUG: 1397430 Signed-off-by: Atin Mukherjee Reviewed-on: https://code.engineering.redhat.com/gerrit/91097 --- events/eventskeygen.py | 1 - xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 3 ++- xlators/mgmt/glusterd/src/glusterd-handler.c | 1 + xlators/mgmt/glusterd/src/glusterd-replace-brick.c | 1 - xlators/mgmt/glusterd/src/glusterd-store.c | 8 ++++++++ xlators/mgmt/glusterd/src/glusterd-utils.c | 11 ++++++----- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/events/eventskeygen.py b/events/eventskeygen.py index 33398ee..438f6b6 100644 --- a/events/eventskeygen.py +++ b/events/eventskeygen.py @@ -112,7 +112,6 @@ keys = ( "EVENT_BRICK_STOP_FAILED", "EVENT_BRICK_DISCONNECTED", "EVENT_BRICK_CONNECTED", - "EVENT_BRICKS_START_FAILED", "EVENT_BRICKPATH_RESOLVE_FAILED", "EVENT_NOTIFY_UNKNOWN_OP", "EVENT_QUORUM_LOST", diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 971dac8..5791e98 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -1501,7 +1501,8 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count, ret = glusterd_resolve_brick (brickinfo); if (ret) { gf_msg ("glusterd", GF_LOG_ERROR, 0, - GD_MSG_RESOLVE_BRICK_FAIL, FMTSTR_RESOLVE_BRICK, + GD_MSG_RESOLVE_BRICK_FAIL, + FMTSTR_RESOLVE_BRICK, brickinfo->hostname, brickinfo->path); goto out; } diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index b9270d8..a41960d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -107,6 +107,7 @@ glusterd_handle_friend_req (rpcsvc_request_t *req, uuid_t uuid, peerinfo = glusterd_peerinfo_find (uuid, rhost); if (peerinfo == NULL) { + gf_event (EVENT_PEER_REJECT, "peer=%s", hostname); ret = glusterd_xfer_friend_add_resp (req, hostname, rhost, port, -1, GF_PROBE_UNKNOWN_PEER); if (friend_req->vols.vols_val) { diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c index aaa5a35..f77785c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c +++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c @@ -376,7 +376,6 @@ glusterd_op_perform_replace_brick (glusterd_volinfo_t *volinfo, goto out; ret = glusterd_resolve_brick (new_brickinfo); - if (ret) goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index 70627f3..cf1b3ae 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -3433,6 +3433,10 @@ glusterd_resolve_snap_bricks (xlator_t *this, glusterd_snap_t *snap) brick_list) { ret = glusterd_resolve_brick (brickinfo); if (ret) { + gf_event (EVENT_BRICKPATH_RESOLVE_FAILED, + "peer=%s;volume=%s;brick=%s", + brickinfo->hostname, volinfo->volname, + brickinfo->path); gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_RESOLVE_BRICK_FAIL, "resolve brick failed in restore"); @@ -4404,6 +4408,10 @@ glusterd_resolve_all_bricks (xlator_t *this) brick_list) { ret = glusterd_resolve_brick (brickinfo); if (ret) { + gf_event (EVENT_BRICKPATH_RESOLVE_FAILED, + "peer=%s;volume=%s;brick=%s", + brickinfo->hostname, volinfo->volname, + brickinfo->path); gf_msg ("glusterd", GF_LOG_ERROR, 0, GD_MSG_RESOLVE_BRICK_FAIL, "resolve brick failed in restore"); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 8955994..98c0059 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -2990,7 +2990,7 @@ glusterd_compare_friend_volume (dict_t *peer_data, int32_t count, *status = GLUSTERD_VOL_COMP_SCS; out: - if (ret) { + if (*status == GLUSTERD_VOL_COMP_RJT) { gf_event (EVENT_COMPARE_FRIEND_VOLUME_FAILED, "volume=%s", volinfo->volname); } @@ -4136,10 +4136,7 @@ glusterd_import_friend_volume (dict_t *peer_data, size_t count) } if (glusterd_is_volume_started (new_volinfo)) { - if (glusterd_start_bricks (new_volinfo)) { - gf_event (EVENT_BRICKS_START_FAILED, "volume=%s", - new_volinfo->volname); - } + (void) glusterd_start_bricks (new_volinfo); if (glusterd_is_snapd_enabled (new_volinfo)) { svc = &(new_volinfo->snapd.svc); if (svc->manager (svc, new_volinfo, @@ -5903,6 +5900,10 @@ glusterd_brick_stop (glusterd_volinfo_t *volinfo, if (gf_uuid_is_null (brickinfo->uuid)) { ret = glusterd_resolve_brick (brickinfo); if (ret) { + gf_event (EVENT_BRICKPATH_RESOLVE_FAILED, + "peer=%s;volume=%s;brick=%s", + brickinfo->hostname, volinfo->volname, + brickinfo->path); gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_RESOLVE_BRICK_FAIL, FMTSTR_RESOLVE_BRICK, brickinfo->hostname, brickinfo->path); -- 2.9.3