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