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