a3470f
From 8fb2496f67b1170595144eecb9a3b8f3be35044e Mon Sep 17 00:00:00 2001
a3470f
From: Atin Mukherjee <amukherj@redhat.com>
a3470f
Date: Mon, 30 Oct 2017 15:55:32 +0530
a3470f
Subject: [PATCH 40/74] glusterd: delete source brick only once in reset-brick
a3470f
 commit force
a3470f
a3470f
While stopping the brick which is to be reset and replaced delete_brick
a3470f
flag was passed as true which resulted glusterd to free up to source
a3470f
brick before the actual operation. This results commit force to fail
a3470f
failing to find the source brickinfo.
a3470f
a3470f
>upstream patch : https://review.gluster.org/#/c/18581
a3470f
a3470f
Change-Id: I1aa7508eff7cc9c9b5d6f5163f3bb92736d6df44
a3470f
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/121876
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
---
a3470f
 .../bug-1507466-reset-brick-commit-force.t         | 24 ++++++++++++++++++++++
a3470f
 xlators/mgmt/glusterd/src/glusterd-reset-brick.c   |  2 +-
a3470f
 2 files changed, 25 insertions(+), 1 deletion(-)
a3470f
 create mode 100644 tests/bugs/glusterd/bug-1507466-reset-brick-commit-force.t
a3470f
a3470f
diff --git a/tests/bugs/glusterd/bug-1507466-reset-brick-commit-force.t b/tests/bugs/glusterd/bug-1507466-reset-brick-commit-force.t
a3470f
new file mode 100644
a3470f
index 0000000..764399d
a3470f
--- /dev/null
a3470f
+++ b/tests/bugs/glusterd/bug-1507466-reset-brick-commit-force.t
a3470f
@@ -0,0 +1,24 @@
a3470f
+#!/bin/bash
a3470f
+. $(dirname $0)/../../include.rc
a3470f
+. $(dirname $0)/../../cluster.rc
a3470f
+cleanup;
a3470f
+
a3470f
+function check_peers {
a3470f
+        $CLI_1 peer status | grep 'Peer in Cluster (Connected)' | wc -l
a3470f
+}
a3470f
+
a3470f
+TEST launch_cluster 3
a3470f
+TEST $CLI_1 peer probe $H2;
a3470f
+EXPECT_WITHIN $PROBE_TIMEOUT 1 check_peers
a3470f
+
a3470f
+TEST $CLI_1 volume create $V0 replica 2 $H1:$B0/${V0} $H2:$B0/${V0}
a3470f
+TEST $CLI_1 volume start $V0
a3470f
+
a3470f
+# Negative case with brick not killed && volume-id xattrs present
a3470f
+TEST ! $CLI_1 volume reset-brick $V0 $H1:$B0/${V0} $H1:$B0/${V0} commit force
a3470f
+
a3470f
+TEST $CLI_1 volume reset-brick $V0 $H1:$B0/${V0} start
a3470f
+# Now test if reset-brick commit force works
a3470f
+TEST $CLI_1 volume reset-brick $V0 $H1:$B0/${V0} $H1:$B0/${V0} commit force
a3470f
+
a3470f
+cleanup;
a3470f
diff --git a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
a3470f
index c127d64..abb44e0 100644
a3470f
--- a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
a3470f
+++ b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
a3470f
@@ -343,7 +343,7 @@ glusterd_op_reset_brick (dict_t *dict, dict_t *rsp_dict)
a3470f
                         gf_msg_debug (this->name, 0, "I AM THE DESTINATION HOST");
a3470f
                         ret = glusterd_volume_stop_glusterfs (volinfo,
a3470f
                                                               src_brickinfo,
a3470f
-                                                              _gf_true);
a3470f
+                                                              _gf_false);
a3470f
                         if (ret) {
a3470f
                                 gf_msg (this->name, GF_LOG_CRITICAL, 0,
a3470f
                                         GD_MSG_BRICK_STOP_FAIL,
a3470f
-- 
a3470f
1.8.3.1
a3470f