Blob Blame History Raw
From 4923703a45ea10bbad8a84c7fd02fe3f9fa8db37 Mon Sep 17 00:00:00 2001
From: Anuradha Talur <atalur@redhat.com>
Date: Wed, 31 Aug 2016 15:27:31 +0530
Subject: [PATCH 62/86] event: fix gf_event messages for replace/reset brick op

>Change-Id: I80ebeeaffd2b228d7d0796c8d08bc2a051c4ccac
>BUG: 1266876
>Signed-off-by: Anuradha Talur <atalur@redhat.com>
>Reviewed-on: http://review.gluster.org/15370
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>

Change-Id: I80ebeeaffd2b228d7d0796c8d08bc2a051c4ccac
BUG: 1256524
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/84810
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 cli/src/cli-cmd-volume.c                           |   28 ++++++++++++-------
 events/eventskeygen.py                             |    3 +-
 xlators/mgmt/glusterd/src/glusterd-replace-brick.c |    5 ---
 3 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 4b2653b..647505e 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -1844,10 +1844,10 @@ cli_cmd_volume_reset_brick_cbk (struct cli_state *state,
         int                      ret          = -1;
         rpc_clnt_procedure_t    *proc         = NULL;
         call_frame_t            *frame        = NULL;
-        dict_t                  *options = NULL;
-        int                      sent = 0;
-        int                      parse_error = 0;
-        cli_local_t             *local = NULL;
+        dict_t                  *options      = NULL;
+        int                      sent         = 0;
+        int                      parse_error  = 0;
+        cli_local_t             *local        = NULL;
 
 #ifdef GF_SOLARIS_HOST_OS
         cli_out ("Command not supported on Solaris");
@@ -1875,14 +1875,22 @@ cli_cmd_volume_reset_brick_cbk (struct cli_state *state,
 
 out:
         if (ret) {
-                gf_event (EVENT_BRICK_RESET, "Volume reset-brick failed.");
                 cli_cmd_sent_status_get (&sent);
                 if ((sent == 0) && (parse_error == 0))
                         cli_out ("Volume reset-brick failed");
         } else {
-                gf_event (EVENT_BRICK_RESET, "Volume reset-brick succeeded.");
+                if (wordcount > 5) {
+                        gf_event (EVENT_BRICK_RESET_COMMIT,
+                                  "Volume=%s;source-brick=%s;"
+                                  "destination-brick=%s",
+                                  (char *)words[2], (char *)words[3],
+                                  (char *)words[4]);
+                } else {
+                        gf_event (EVENT_BRICK_RESET_START,
+                                  "Volume=%s;source-brick=%s",
+                                  (char *)words[2], (char *)words[3]);
+                }
         }
-
         CLI_STACK_DESTROY (frame);
 
         return ret;
@@ -1928,14 +1936,14 @@ cli_cmd_volume_replace_brick_cbk (struct cli_state *state,
 
 out:
         if (ret) {
-                gf_event (EVENT_BRICK_REPLACE, "Volume replace-brick failed.");
                 cli_cmd_sent_status_get (&sent);
                 if ((sent == 0) && (parse_error == 0))
                         cli_out ("Volume replace-brick failed");
         } else {
-                gf_event (EVENT_BRICK_RESET, "Volume replace-brick succeeded.");
+                gf_event (EVENT_BRICK_REPLACE,
+                          "Volume=%s;source-brick=%s;destination-brick=%s",
+                          (char *)words[2], (char *)words[3], (char *)words[4]);
         }
-
         CLI_STACK_DESTROY (frame);
 
         return ret;
diff --git a/events/eventskeygen.py b/events/eventskeygen.py
index 2869e45..801bee3 100644
--- a/events/eventskeygen.py
+++ b/events/eventskeygen.py
@@ -31,7 +31,8 @@ keys = (
     "EVENT_VOLUME_DELETE",
     "EVENT_VOLUME_SET",
     "EVENT_VOLUME_RESET",
-    "EVENT_BRICK_RESET",
+    "EVENT_BRICK_RESET_START",
+    "EVENT_BRICK_RESET_COMMIT",
     "EVENT_BRICK_REPLACE",
 
     #geo-rep events
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index 7338843..aaa5a35 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -146,11 +146,6 @@ __glusterd_handle_replace_brick (rpcsvc_request_t *req)
                 "Received %s request.",
                  gd_rb_op_to_str (cli_op));
 
-        gf_event ((op == GD_OP_REPLACE_BRICK) ? EVENT_BRICK_REPLACE :
-                  EVENT_BRICK_RESET, "received %s request. Source bricks %s,"
-                  "destination brick %s.", gd_rb_op_to_str (cli_op),
-                  src_brick, (dst_brick) ? dst_brick : "");
-
         ret = glusterd_mgmt_v3_initiate_replace_brick_cmd_phases (req,
                                                                   op, dict);
 
-- 
1.7.1