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