ca3909
From a8d8fc91af226fbf49e9dd1d7d91ad287707c4fe Mon Sep 17 00:00:00 2001
ca3909
From: Vishal Pandey <vpandey@redhat.com>
ca3909
Date: Wed, 7 Aug 2019 12:53:06 +0530
ca3909
Subject: [PATCH 328/335] glusterd: Add warning and abort in case of failures
ca3909
 in migration during remove-brick commit
ca3909
ca3909
Problem -
ca3909
Currently remove-brick commit goes through even though there were files
ca3909
that failed to migrate or were skipped. There is no warning raised to the user.
ca3909
Solution-
ca3909
Add a check in the remove brick staging phase to verify if the status of the
ca3909
rebalnce process is complete but there has been failures or some skipped files
ca3909
while migration, In this case user will be given a warning and remove-brick
ca3909
commit. User will need to use the force option to remove the bricks.
ca3909
ca3909
> Upstream Path Link: https://review.gluster.org/#/c/glusterfs/+/23171/
ca3909
> Fixes: bz#1514683
ca3909
> Signed-offby- Vishal Pandey <vpandey@redhat.com>
ca3909
> Change-Id: I014d0f0afb4b2fac35ab0de52227f98dbae079d5
ca3909
ca3909
BUG: 1344758
ca3909
Change-Id: I014d0f0afb4b2fac35ab0de52227f98dbae079d5
ca3909
Signed-off-by: Vishal Pandey <vpandey@redhat.com>
ca3909
Reviewed-on: https://code.engineering.redhat.com/gerrit/185831
ca3909
Tested-by: RHGS Build Bot <nigelb@redhat.com>
ca3909
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
ca3909
---
ca3909
 xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 11 +++++++++++
ca3909
 1 file changed, 11 insertions(+)
ca3909
ca3909
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
ca3909
index ad9a572..c5141de 100644
ca3909
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
ca3909
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
ca3909
@@ -2191,6 +2191,17 @@ glusterd_op_stage_remove_brick(dict_t *dict, char **op_errstr)
ca3909
                 goto out;
ca3909
             }
ca3909
 
ca3909
+            if (volinfo->rebal.defrag_status == GF_DEFRAG_STATUS_COMPLETE) {
ca3909
+                if (volinfo->rebal.rebalance_failures > 0 ||
ca3909
+                    volinfo->rebal.skipped_files > 0) {
ca3909
+                    errstr = gf_strdup(
ca3909
+                        "use 'force' option as migration "
ca3909
+                        "of some files might have been skipped or "
ca3909
+                        "has failed");
ca3909
+                    goto out;
ca3909
+                }
ca3909
+            }
ca3909
+
ca3909
             ret = glusterd_remove_brick_validate_bricks(
ca3909
                 cmd, brick_count, dict, volinfo, &errstr, GF_DEFRAG_CMD_NONE);
ca3909
             if (ret)
ca3909
-- 
ca3909
1.8.3.1
ca3909