diff options
| author | Pranith Kumar K <pkarampu@redhat.com> | 2015-12-21 17:55:49 +0530 | 
|---|---|---|
| committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2016-03-17 23:44:48 -0700 | 
| commit | 0b4f733f5ef074a38dacd33b39e5371d467d0f25 (patch) | |
| tree | 11e79520bcaf0a91104bd43ca68ffa10f08bf5c3 | |
| parent | 1eece065f1379bf08af839bae626ae701ccd91b0 (diff) | |
heal: Have fixed number of fields in heal info output
Sample output:
⚡ gluster v heal r2 info
Brick localhost.localdomain:/home/gfs/r2_0
/a
/
Status: Connected
Number of entries: 2
Brick localhost.localdomain:/home/gfs/r2_1
Status: Transport endpoint is not connected
Number of entries: -
Brick localhost.localdomain:/home/gfs/r2_2
Status: Connected
Number of entries: 0
Brick localhost.localdomain:/home/gfs/r2_3
Status: Connected
Number of entries: 0
Partial failure will print:
...
<gfid:3efb51cf-5fa5-4bed-817b-afd600e9449e>
Status: Failed to process entries completely. (Transport endpoint is not connected)
Number of entries: 372
...
 >BUG: 1297897
 >Change-Id: I79131cbf255acd98f11eedafb53246c465f6665d
 >Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
 >Reviewed-on: http://review.gluster.org/13231
 >Smoke: Gluster Build System <jenkins@build.gluster.com>
 >Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
 >Reviewed-by: Sahina Bose <sabose@redhat.com>
 >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
 >CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
BUG: 1315141
Change-Id: I98de851b86598bb9c98e6203f855b69b585e2271
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/13616
Smoke: Gluster Build System <jenkins@build.gluster.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
| -rw-r--r-- | heal/src/glfs-heal.c | 31 | 
1 files changed, 20 insertions, 11 deletions
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c index 83c1b1035f1..c6c1161b05b 100644 --- a/heal/src/glfs-heal.c +++ b/heal/src/glfs-heal.c @@ -54,23 +54,32 @@ void  glfsh_print_heal_op_status (int ret, uint64_t num_entries,                              gf_xl_afr_op_t heal_op)  { +        char *fmt_str = NULL; -        if (ret == -ENOTCONN && num_entries == 0) { +        if (heal_op == GF_SHD_OP_INDEX_SUMMARY) +                fmt_str = "Number of entries:"; +        else if (heal_op == GF_SHD_OP_SPLIT_BRAIN_FILES) +                fmt_str = "Number of entries in split-brain:"; +        else if (heal_op == GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK) +                fmt_str = "Number of healed entries:"; + +        if (ret < 0 && num_entries == 0) {                  printf ("Status: %s\n", strerror (-ret)); +                if (fmt_str) +                        printf ("%s -\n", fmt_str);                  return; +        } else if (ret == 0) { +                printf ("Status: Connected\n");          } +          if (ret < 0) { -                printf ("Failed to process entries completely. " -                         "Number of entries so far: %"PRIu64"\n", num_entries); +                if (fmt_str) +                        printf ("Status: Failed to process entries completely. " +                                "(%s)\n%s: %"PRIu64"\n", +                         strerror (-ret), fmt_str, num_entries);          } else { -                if (heal_op == GF_SHD_OP_INDEX_SUMMARY) -                        printf ("Number of entries: %"PRIu64"\n", num_entries); -                else if (heal_op == GF_SHD_OP_SPLIT_BRAIN_FILES) -                        printf ("Number of entries in split-brain: %"PRIu64"\n" -                                , num_entries); -                else if (heal_op == GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK) -                        printf ("Number of healed entries: %"PRIu64"\n", -                                num_entries); +                if (fmt_str) +                        printf ("%s %"PRIu64"\n", fmt_str, num_entries);          }          return;  }  | 
