heal: remove glfsh_print_brick()
authorRavishankar N <ravishankar@redhat.com>
Wed, 23 Sep 2015 02:57:25 +0000 (08:27 +0530)
committerPranith Kumar Karampuri <pkarampu@redhat.com>
Wed, 23 Sep 2015 11:17:30 +0000 (04:17 -0700)
Use glfsh_print_brick_from_xl() instead so that the hostname:brickpath
displayed when heal info is run is consistent with other gluster cli
commands like `gluster volume info`.

Change-Id: I30ee3d76d0f68991a25bd678d40ec3bf7e0538c7
BUG: 1265470
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/12212
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-by: Anuradha Talur <atalur@redhat.com>
heal/src/glfs-heal.c

index 3b3003ece6738b8edbe7f7e15d8364cdba4fd696..207e47297b589e946894fdbf7aea203cb1a47008 100644 (file)
@@ -339,35 +339,6 @@ out:
 }
 
 static int
-glfsh_print_brick (xlator_t *xl, loc_t *rootloc)
-{
-        int     ret = 0;
-        dict_t  *xattr = NULL;
-        char    *pathinfo = NULL;
-        char    *brick_start = NULL;
-        char    *brick_end = NULL;
-
-        ret = syncop_getxattr (xl, rootloc, &xattr, GF_XATTR_PATHINFO_KEY,
-                               NULL, NULL);
-        if (ret < 0)
-                goto out;
-
-        ret = dict_get_str (xattr, GF_XATTR_PATHINFO_KEY, &pathinfo);
-        if (ret < 0)
-                goto out;
-
-        brick_start = strchr (pathinfo, ':') + 1;
-        brick_end = pathinfo + strlen (pathinfo) - 1;
-        *brick_end = 0;
-        printf ("Brick %s\n", brick_start);
-
-out:
-        if (xattr)
-                dict_unref (xattr);
-        return ret;
-}
-
-void
 glfsh_print_brick_from_xl (xlator_t *xl)
 {
         char    *remote_host = NULL;
@@ -386,6 +357,7 @@ out:
                 printf ("Brick - Not able to get brick information\n");
         else
                 printf ("Brick %s:%s\n", remote_host, remote_subvol);
+        return ret;
 }
 
 void
@@ -405,12 +377,9 @@ glfsh_print_pending_heals (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
         ret = dict_set_int32 (xattr_req, "heal-op", heal_op);
         if (ret)
                 goto out;
-        ret = glfsh_print_brick (xl, rootloc);
-        if (ret < 0) {
-                glfsh_print_brick_from_xl (xl);
-                printf ("Status: %s\n", strerror (-ret));
+        ret = glfsh_print_brick_from_xl (xl);
+        if (ret < 0)
                 goto out;
-        }
 
         ret = glfsh_get_index_dir_loc (rootloc, xl, &dirloc, &op_errno);
         if (ret < 0) {