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