Blob Blame History Raw
From e522517af3b4a1c449a8e74386f8c41d16e4cf16 Mon Sep 17 00:00:00 2001
From: Aravinda VK <avishwan@redhat.com>
Date: Mon, 5 Sep 2016 11:15:10 +0530
Subject: [PATCH 42/86] eventsapi: Fix Volume Stop and delete prompt issue

During Volume Stop and Delete, event is emitted even if
prompt answer is No.

Also added "force" details in START and STOP events.

> Reviewed-on: http://review.gluster.org/15399
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>

BUG: 1351589
Change-Id: I986dcff7154b584f6ed44b533d4eeabe82815235
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/84746
Reviewed-by: Milind Changire <mchangir@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 cli/src/cli-cmd-volume.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 09cfcee..3a7c9ed 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -321,7 +321,7 @@ out:
 
         CLI_STACK_DESTROY (frame);
 
-        if (ret == 0) {
+        if (ret == 0 && GF_ANSWER_YES == answer) {
                 gf_event (EVENT_VOLUME_DELETE, "name=%s", (char *)words[2]);
         }
 
@@ -400,7 +400,8 @@ out:
         CLI_STACK_DESTROY (frame);
 
         if (ret == 0) {
-                gf_event (EVENT_VOLUME_START, "name=%s", (char *)words[2]);
+                gf_event (EVENT_VOLUME_START, "name=%s;force=%d",
+                          (char *)words[2], (flags & GF_CLI_FLAG_OP_FORCE));
         }
 
         return ret;
@@ -535,8 +536,9 @@ out:
 
         CLI_STACK_DESTROY (frame);
 
-        if (ret == 0) {
-                gf_event (EVENT_VOLUME_STOP, "name=%s", (char *)words[2]);
+        if (ret == 0 && GF_ANSWER_YES == answer) {
+                gf_event (EVENT_VOLUME_STOP, "name=%s;force=%d",
+                          (char *)words[2], (flags & GF_CLI_FLAG_OP_FORCE));
         }
 
         return ret;
-- 
1.7.1