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