9ae3f9
From 03d2c7b52da5efd6ad660315a0548c8b91e51439 Mon Sep 17 00:00:00 2001
9ae3f9
From: Sheetal Pamecha <spamecha@redhat.com>
9ae3f9
Date: Sun, 22 Dec 2019 22:52:30 +0530
9ae3f9
Subject: [PATCH 398/449] ec: change error message for heal commands for
9ae3f9
 disperse volume
9ae3f9
9ae3f9
Currently when we issue a heal statistics or similar commands
9ae3f9
for disperse volume, it fails with message "Volume is not of
9ae3f9
type replicate." Adding message "this command is supported for
9ae3f9
volumes of type replicate" to reflect supportability and better
9ae3f9
understanding of heal functionality for disperse volumes.
9ae3f9
9ae3f9
> Upstream Patch Link: https://review.gluster.org/#/c/glusterfs/+/23916/
9ae3f9
> fixes: bz#1785998
9ae3f9
> Change-Id: I9688a9fdf427cb6f657cfd5b8db2f76a6c56f6e2
9ae3f9
> Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
9ae3f9
9ae3f9
BUG: 1487177
9ae3f9
Change-Id: I9688a9fdf427cb6f657cfd5b8db2f76a6c56f6e2
9ae3f9
Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
9ae3f9
Reviewed-on: https://code.engineering.redhat.com/gerrit/202344
9ae3f9
Tested-by: RHGS Build Bot <nigelb@redhat.com>
9ae3f9
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
9ae3f9
---
9ae3f9
 heal/src/glfs-heal.c                            | 15 ++++++++++-----
9ae3f9
 xlators/mgmt/glusterd/src/glusterd-volume-ops.c |  4 +++-
9ae3f9
 2 files changed, 13 insertions(+), 6 deletions(-)
9ae3f9
9ae3f9
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c
9ae3f9
index 7e37e47..125b12c 100644
9ae3f9
--- a/heal/src/glfs-heal.c
9ae3f9
+++ b/heal/src/glfs-heal.c
9ae3f9
@@ -1726,14 +1726,19 @@ main(int argc, char **argv)
9ae3f9
         goto out;
9ae3f9
     }
9ae3f9
 
9ae3f9
+    char *var_str = (heal_op == GF_SHD_OP_INDEX_SUMMARY ||
9ae3f9
+                     heal_op == GF_SHD_OP_HEAL_SUMMARY)
9ae3f9
+                        ? "replicate/disperse"
9ae3f9
+                        : "replicate";
9ae3f9
+
9ae3f9
     ret = glfsh_validate_volume(top_subvol, heal_op);
9ae3f9
     if (ret < 0) {
9ae3f9
         ret = -EINVAL;
9ae3f9
-        gf_asprintf(&op_errstr, "Volume %s is not of type %s", volname,
9ae3f9
-                    (heal_op == GF_SHD_OP_INDEX_SUMMARY ||
9ae3f9
-                     heal_op == GF_SHD_OP_HEAL_SUMMARY)
9ae3f9
-                        ? "replicate/disperse"
9ae3f9
-                        : "replicate");
9ae3f9
+        gf_asprintf(&op_errstr,
9ae3f9
+                    "This command is supported "
9ae3f9
+                    "for only volumes of %s type. Volume %s "
9ae3f9
+                    "is not of type %s",
9ae3f9
+                    var_str, volname, var_str);
9ae3f9
         goto out;
9ae3f9
     }
9ae3f9
     rootloc.inode = inode_ref(top_subvol->itable->root);
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
9ae3f9
index 076bc80..93042ab 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
9ae3f9
@@ -2008,7 +2008,9 @@ glusterd_handle_heal_cmd(xlator_t *this, glusterd_volinfo_t *volinfo,
9ae3f9
             if (!glusterd_is_volume_replicate(volinfo)) {
9ae3f9
                 ret = -1;
9ae3f9
                 snprintf(msg, sizeof(msg),
9ae3f9
-                         "Volume %s is not of type "
9ae3f9
+                         "This command is supported "
9ae3f9
+                         "for only volume of replicated "
9ae3f9
+                         "type. Volume %s is not of type "
9ae3f9
                          "replicate",
9ae3f9
                          volinfo->volname);
9ae3f9
                 *op_errstr = gf_strdup(msg);
9ae3f9
-- 
9ae3f9
1.8.3.1
9ae3f9