|
|
d1681e |
From dd892d811ec66841b274f5ed6e22040cbdc003b0 Mon Sep 17 00:00:00 2001
|
|
|
d1681e |
From: karthik-us <ksubrahm@redhat.com>
|
|
|
d1681e |
Date: Mon, 20 Nov 2017 11:46:59 +0530
|
|
|
d1681e |
Subject: [PATCH 080/128] heal: New feature heal info summary to list the
|
|
|
d1681e |
status of brick and count of entries to be healed
|
|
|
d1681e |
|
|
|
d1681e |
Command output:
|
|
|
d1681e |
Brick 192.168.2.8:/brick/1
|
|
|
d1681e |
Status: Connected
|
|
|
d1681e |
Total Number of entries: 363
|
|
|
d1681e |
Number of entries in heal pending: 362
|
|
|
d1681e |
Number of entries in split-brain: 0
|
|
|
d1681e |
Number of entries possibly healing: 1
|
|
|
d1681e |
|
|
|
d1681e |
|
|
|
d1681e |
<cliOutput>
|
|
|
d1681e |
<healInfo>
|
|
|
d1681e |
<bricks>
|
|
|
d1681e |
<brick hostUuid="9105dd4b-eca8-4fdb-85b2-b81cdf77eda3">
|
|
|
d1681e |
<name>192.168.2.8:/brick/1</name>
|
|
|
d1681e |
<status>Connected</status>
|
|
|
d1681e |
<totalNumberOfEntries>363</numberOfEntries>
|
|
|
d1681e |
<numberOfEntriesInHealPending>362</numberOfEntriesInHealPending>
|
|
|
d1681e |
<numberOfEntriesInSplitBrain>0</numberOfEntriesInSplitBrain>
|
|
|
d1681e |
<numberOfEntriesPossiblyHealing>1</numberOfEntriesPossiblyHealing>
|
|
|
d1681e |
</brick>
|
|
|
d1681e |
</bricks>
|
|
|
d1681e |
</healInfo>
|
|
|
d1681e |
<opRet>0</opRet>
|
|
|
d1681e |
<opErrno>0</opErrno>
|
|
|
d1681e |
<opErrstr/>
|
|
|
d1681e |
</cliOutput>
|
|
|
d1681e |
|
|
|
d1681e |
> Change-Id: I40cb6f77a14131c9e41b292f4901b41a228863d7
|
|
|
d1681e |
> BUG: 1261463
|
|
|
d1681e |
> Signed-off-by: Mohamed Ashiq Liyazudeen <mliyazud@redhat.com>
|
|
|
d1681e |
> Reviewed-on: https://review.gluster.org/12154
|
|
|
d1681e |
> Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
d1681e |
> Tested-by: Karthik U S <ksubrahm@redhat.com>
|
|
|
d1681e |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
d1681e |
> Reviewed-by: Ravishankar N <ravishankar@redhat.com>
|
|
|
d1681e |
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
d1681e |
|
|
|
d1681e |
Change-Id: I40cb6f77a14131c9e41b292f4901b41a228863d7
|
|
|
d1681e |
BUG: 1286820
|
|
|
d1681e |
Signed-off-by: karthik-us <ksubrahm@redhat.com>
|
|
|
d1681e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/123640
|
|
|
d1681e |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
d1681e |
Reviewed-by: Ravishankar Narayanankutty <ravishankar@redhat.com>
|
|
|
d1681e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
d1681e |
---
|
|
|
d1681e |
cli/src/cli-cmd-parser.c | 5 +
|
|
|
d1681e |
cli/src/cli-cmd-volume.c | 9 +-
|
|
|
d1681e |
cli/src/cli-rpc-ops.c | 3 +-
|
|
|
d1681e |
heal/src/glfs-heal.c | 218 ++++++++++++++++++++----
|
|
|
d1681e |
rpc/rpc-lib/src/protocol-common.h | 1 +
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 1 +
|
|
|
d1681e |
6 files changed, 205 insertions(+), 32 deletions(-)
|
|
|
d1681e |
|
|
|
d1681e |
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
|
|
|
d1681e |
index c95b262..764f420 100644
|
|
|
d1681e |
--- a/cli/src/cli-cmd-parser.c
|
|
|
d1681e |
+++ b/cli/src/cli-cmd-parser.c
|
|
|
d1681e |
@@ -3952,6 +3952,11 @@ cli_cmd_volume_heal_options_parse (const char **words, int wordcount,
|
|
|
d1681e |
GF_SHD_OP_SPLIT_BRAIN_FILES);
|
|
|
d1681e |
goto done;
|
|
|
d1681e |
}
|
|
|
d1681e |
+ if (!strcmp (words[4], "summary")) {
|
|
|
d1681e |
+ ret = dict_set_int32 (dict, "heal-op",
|
|
|
d1681e |
+ GF_SHD_OP_HEAL_SUMMARY);
|
|
|
d1681e |
+ goto done;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
if (!strcmp (words[3], "statistics")) {
|
|
|
d1681e |
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
|
|
|
d1681e |
index a1e5c51..7110145 100644
|
|
|
d1681e |
--- a/cli/src/cli-cmd-volume.c
|
|
|
d1681e |
+++ b/cli/src/cli-cmd-volume.c
|
|
|
d1681e |
@@ -2803,7 +2803,8 @@ cli_print_brick_status (cli_volume_status_t *status)
|
|
|
d1681e |
(op == GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK) || \
|
|
|
d1681e |
(op == GF_SHD_OP_INDEX_SUMMARY) || \
|
|
|
d1681e |
(op == GF_SHD_OP_SPLIT_BRAIN_FILES) || \
|
|
|
d1681e |
- (op == GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE))
|
|
|
d1681e |
+ (op == GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE) || \
|
|
|
d1681e |
+ (op == GF_SHD_OP_HEAL_SUMMARY))
|
|
|
d1681e |
|
|
|
d1681e |
int
|
|
|
d1681e |
cli_launch_glfs_heal (int heal_op, dict_t *options)
|
|
|
d1681e |
@@ -2856,6 +2857,12 @@ cli_launch_glfs_heal (int heal_op, dict_t *options)
|
|
|
d1681e |
case GF_SHD_OP_GRANULAR_ENTRY_HEAL_DISABLE:
|
|
|
d1681e |
runner_add_args (&runner, "granular-entry-heal-op", NULL);
|
|
|
d1681e |
break;
|
|
|
d1681e |
+ case GF_SHD_OP_HEAL_SUMMARY:
|
|
|
d1681e |
+ runner_add_args (&runner, "info-summary", NULL);
|
|
|
d1681e |
+ if (global_state->mode & GLUSTER_MODE_XML) {
|
|
|
d1681e |
+ runner_add_args (&runner, "xml", NULL);
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+ break;
|
|
|
d1681e |
default:
|
|
|
d1681e |
ret = -1;
|
|
|
d1681e |
}
|
|
|
d1681e |
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
|
|
|
d1681e |
index 67e29a0..b91400b 100644
|
|
|
d1681e |
--- a/cli/src/cli-rpc-ops.c
|
|
|
d1681e |
+++ b/cli/src/cli-rpc-ops.c
|
|
|
d1681e |
@@ -9112,11 +9112,12 @@ gf_cli_heal_volume_cbk (struct rpc_req *req, struct iovec *iov,
|
|
|
d1681e |
case GF_SHD_OP_STATISTICS_HEAL_COUNT_PER_REPLICA:
|
|
|
d1681e |
heal_op_str = "count of entries to be healed per replica";
|
|
|
d1681e |
break;
|
|
|
d1681e |
- /* The below 3 cases are never hit; they're coded only to make
|
|
|
d1681e |
+ /* The below 4 cases are never hit; they're coded only to make
|
|
|
d1681e |
* compiler warnings go away.*/
|
|
|
d1681e |
case GF_SHD_OP_SBRAIN_HEAL_FROM_BIGGER_FILE:
|
|
|
d1681e |
case GF_SHD_OP_SBRAIN_HEAL_FROM_LATEST_MTIME:
|
|
|
d1681e |
case GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK:
|
|
|
d1681e |
+ case GF_SHD_OP_HEAL_SUMMARY:
|
|
|
d1681e |
break;
|
|
|
d1681e |
|
|
|
d1681e |
case GF_SHD_OP_INVALID:
|
|
|
d1681e |
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c
|
|
|
d1681e |
index 27115f3..27a9624 100644
|
|
|
d1681e |
--- a/heal/src/glfs-heal.c
|
|
|
d1681e |
+++ b/heal/src/glfs-heal.c
|
|
|
d1681e |
@@ -40,18 +40,25 @@ xmlDocPtr glfsh_doc = NULL;
|
|
|
d1681e |
ret = 0; \
|
|
|
d1681e |
} while (0) \
|
|
|
d1681e |
|
|
|
d1681e |
-typedef int (*print_status) (dict_t *, char *, uuid_t, uint64_t *,
|
|
|
d1681e |
+typedef struct num_entries {
|
|
|
d1681e |
+ uint64_t num_entries;
|
|
|
d1681e |
+ uint64_t pending_entries;
|
|
|
d1681e |
+ uint64_t spb_entries;
|
|
|
d1681e |
+ uint64_t possibly_healing_entries;
|
|
|
d1681e |
+} num_entries_t;
|
|
|
d1681e |
+
|
|
|
d1681e |
+typedef int (*print_status) (dict_t *, char *, uuid_t, num_entries_t *,
|
|
|
d1681e |
gf_boolean_t flag);
|
|
|
d1681e |
|
|
|
d1681e |
int glfsh_heal_splitbrain_file (glfs_t *fs, xlator_t *top_subvol,
|
|
|
d1681e |
loc_t *rootloc, char *file, dict_t *xattr_req);
|
|
|
d1681e |
|
|
|
d1681e |
-
|
|
|
d1681e |
typedef struct glfs_info {
|
|
|
d1681e |
int (*init)(void);
|
|
|
d1681e |
int (*print_brick_from_xl)(xlator_t *xl, loc_t *rootloc);
|
|
|
d1681e |
int (*print_heal_op_status)(int ret, uint64_t num_entries,
|
|
|
d1681e |
char *fmt_str);
|
|
|
d1681e |
+ int (*print_heal_op_summary)(int ret, num_entries_t *num_entries);
|
|
|
d1681e |
void (*print_heal_status)(char *path, uuid_t gfid, char *status);
|
|
|
d1681e |
void (*print_spb_status)(char *path, uuid_t gfid, char *status);
|
|
|
d1681e |
int (*end) (int op_ret, char *op_errstr);
|
|
|
d1681e |
@@ -64,7 +71,7 @@ int32_t is_xml;
|
|
|
d1681e |
#define USAGE_STR "Usage: %s <VOLNAME> [bigger-file <FILE> | "\
|
|
|
d1681e |
"latest-mtime <FILE> | "\
|
|
|
d1681e |
"source-brick <HOSTNAME:BRICKNAME> [<FILE>] | "\
|
|
|
d1681e |
- "split-brain-info]\n"
|
|
|
d1681e |
+ "split-brain-info | info-summary]\n"
|
|
|
d1681e |
|
|
|
d1681e |
typedef enum {
|
|
|
d1681e |
GLFSH_MODE_CONTINUE_ON_ERROR = 1,
|
|
|
d1681e |
@@ -259,6 +266,54 @@ out:
|
|
|
d1681e |
return ret;
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
+int
|
|
|
d1681e |
+glfsh_print_xml_heal_op_summary (int ret, num_entries_t *num_entries)
|
|
|
d1681e |
+{
|
|
|
d1681e |
+ if (ret < 0 && num_entries == 0) {
|
|
|
d1681e |
+ xmlTextWriterWriteFormatElement (glfsh_writer,
|
|
|
d1681e |
+ (xmlChar *)"status",
|
|
|
d1681e |
+ "%s", strerror (-ret));
|
|
|
d1681e |
+ xmlTextWriterWriteFormatElement (glfsh_writer,
|
|
|
d1681e |
+ (xmlChar *)"totalNumberOfEntries", "-");
|
|
|
d1681e |
+ xmlTextWriterWriteFormatElement (glfsh_writer,
|
|
|
d1681e |
+ (xmlChar *)"numberOfEntriesInHealPending", "-");
|
|
|
d1681e |
+ xmlTextWriterWriteFormatElement (glfsh_writer,
|
|
|
d1681e |
+ (xmlChar *)"numberOfEntriesInSplitBrain", "-");
|
|
|
d1681e |
+ xmlTextWriterWriteFormatElement (glfsh_writer,
|
|
|
d1681e |
+ (xmlChar *)"numberOfEntriesPossiblyHealing",
|
|
|
d1681e |
+ "-");
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+ } else if (ret == 0) {
|
|
|
d1681e |
+ xmlTextWriterWriteFormatElement (glfsh_writer,
|
|
|
d1681e |
+ (xmlChar *)"status",
|
|
|
d1681e |
+ "%s", "Connected");
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+
|
|
|
d1681e |
+ if (ret < 0) {
|
|
|
d1681e |
+ xmlTextWriterWriteFormatElement (glfsh_writer,
|
|
|
d1681e |
+ (xmlChar *)"status", "Failed to process entries"
|
|
|
d1681e |
+ " completely. "
|
|
|
d1681e |
+ "(%s)totalNumberOfEntries%"PRIu64"",
|
|
|
d1681e |
+ strerror (-ret), num_entries->num_entries);
|
|
|
d1681e |
+ } else {
|
|
|
d1681e |
+ xmlTextWriterWriteFormatElement (glfsh_writer,
|
|
|
d1681e |
+ (xmlChar *)"totalNumberOfEntries",
|
|
|
d1681e |
+ "%"PRIu64"", num_entries->num_entries);
|
|
|
d1681e |
+ xmlTextWriterWriteFormatElement (glfsh_writer,
|
|
|
d1681e |
+ (xmlChar *)"numberOfEntriesInHealPending",
|
|
|
d1681e |
+ "%"PRIu64"", num_entries->pending_entries);
|
|
|
d1681e |
+ xmlTextWriterWriteFormatElement (glfsh_writer,
|
|
|
d1681e |
+ (xmlChar *)"numberOfEntriesInSplitBrain",
|
|
|
d1681e |
+ "%"PRIu64"", num_entries->spb_entries);
|
|
|
d1681e |
+ xmlTextWriterWriteFormatElement (glfsh_writer,
|
|
|
d1681e |
+ (xmlChar *)"numberOfEntriesPossiblyHealing",
|
|
|
d1681e |
+ "%"PRIu64"",
|
|
|
d1681e |
+ num_entries->possibly_healing_entries);
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+out:
|
|
|
d1681e |
+ return xmlTextWriterEndElement (glfsh_writer);
|
|
|
d1681e |
+}
|
|
|
d1681e |
+
|
|
|
d1681e |
void
|
|
|
d1681e |
glfsh_print_xml_file_status (char *path, uuid_t gfid, char *status)
|
|
|
d1681e |
{
|
|
|
d1681e |
@@ -338,6 +393,39 @@ glfsh_no_print_hr_heal_op_status (int ret, uint64_t num_entries, char *fmt_str)
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
int
|
|
|
d1681e |
+glfsh_print_hr_heal_op_summary (int ret, num_entries_t *num_entries)
|
|
|
d1681e |
+{
|
|
|
d1681e |
+ if (ret < 0 && num_entries->num_entries == 0) {
|
|
|
d1681e |
+ printf ("Status: %s\n", strerror (-ret));
|
|
|
d1681e |
+ printf ("Total Number of entries: -\n");
|
|
|
d1681e |
+ printf ("Number of entries in heal pending: -\n");
|
|
|
d1681e |
+ printf ("Number of entries in split-brain: -\n");
|
|
|
d1681e |
+ printf ("Number of entries possibly healing: -\n");
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+ } else if (ret == 0) {
|
|
|
d1681e |
+ printf ("Status: Connected\n");
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+
|
|
|
d1681e |
+ if (ret < 0) {
|
|
|
d1681e |
+ printf ("Status: Failed to process entries completely. "
|
|
|
d1681e |
+ "(%s)\nTotal Number of entries: %"PRIu64"\n",
|
|
|
d1681e |
+ strerror (-ret), num_entries->num_entries);
|
|
|
d1681e |
+ } else {
|
|
|
d1681e |
+ printf ("Total Number of entries: %"PRIu64"\n",
|
|
|
d1681e |
+ num_entries->num_entries);
|
|
|
d1681e |
+ printf ("Number of entries in heal pending: %"PRIu64"\n",
|
|
|
d1681e |
+ num_entries->pending_entries);
|
|
|
d1681e |
+ printf ("Number of entries in split-brain: %"PRIu64"\n",
|
|
|
d1681e |
+ num_entries->spb_entries);
|
|
|
d1681e |
+ printf ("Number of entries possibly healing: %"PRIu64"\n",
|
|
|
d1681e |
+ num_entries->possibly_healing_entries);
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+out:
|
|
|
d1681e |
+ printf ("\n");
|
|
|
d1681e |
+ return 0;
|
|
|
d1681e |
+}
|
|
|
d1681e |
+
|
|
|
d1681e |
+int
|
|
|
d1681e |
glfsh_print_hr_heal_op_status (int ret, uint64_t num_entries, char *fmt_str)
|
|
|
d1681e |
{
|
|
|
d1681e |
if (ret < 0 && num_entries == 0) {
|
|
|
d1681e |
@@ -364,6 +452,13 @@ out:
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
int
|
|
|
d1681e |
+glfsh_print_info_summary (int ret, num_entries_t *num_entries)
|
|
|
d1681e |
+{
|
|
|
d1681e |
+ return glfsh_output->print_heal_op_summary (ret, num_entries);
|
|
|
d1681e |
+
|
|
|
d1681e |
+}
|
|
|
d1681e |
+
|
|
|
d1681e |
+int
|
|
|
d1681e |
glfsh_print_heal_op_status (int ret, uint64_t num_entries,
|
|
|
d1681e |
gf_xl_afr_op_t heal_op)
|
|
|
d1681e |
{
|
|
|
d1681e |
@@ -430,7 +525,8 @@ _get_ancestor (xlator_t *xl, gf_xl_afr_op_t heal_op)
|
|
|
d1681e |
NULL};
|
|
|
d1681e |
char **ancestors = NULL;
|
|
|
d1681e |
|
|
|
d1681e |
- if (heal_op == GF_SHD_OP_INDEX_SUMMARY)
|
|
|
d1681e |
+ if (heal_op == GF_SHD_OP_INDEX_SUMMARY ||
|
|
|
d1681e |
+ heal_op == GF_SHD_OP_HEAL_SUMMARY)
|
|
|
d1681e |
ancestors = heal_xls;
|
|
|
d1681e |
else
|
|
|
d1681e |
ancestors = replica_xl;
|
|
|
d1681e |
@@ -465,8 +561,35 @@ glfsh_index_purge (xlator_t *subvol, inode_t *inode, char *name)
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
int
|
|
|
d1681e |
+glfsh_print_summary_status (dict_t *dict, char *path, uuid_t gfid,
|
|
|
d1681e |
+ num_entries_t *num_entries, gf_boolean_t flag)
|
|
|
d1681e |
+{
|
|
|
d1681e |
+ int ret = 0;
|
|
|
d1681e |
+ char *value = NULL;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ ret = dict_get_str (dict, "heal-info", &value);
|
|
|
d1681e |
+ if (ret)
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ if ((!strcmp (value, "heal")) || (!strcmp (value, "heal-pending"))) {
|
|
|
d1681e |
+ (num_entries->pending_entries)++;
|
|
|
d1681e |
+ } else if ((!strcmp (value, "split-brain")) ||
|
|
|
d1681e |
+ (!strcmp (value, "split-brain-pending"))) {
|
|
|
d1681e |
+ (num_entries->spb_entries)++;
|
|
|
d1681e |
+ } else if ((!strcmp (value, "possibly-healing-pending")) ||
|
|
|
d1681e |
+ (!strcmp (value, "possibly-healing"))) {
|
|
|
d1681e |
+ (num_entries->possibly_healing_entries)++;
|
|
|
d1681e |
+ } else {
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+ (num_entries->num_entries)++;
|
|
|
d1681e |
+out:
|
|
|
d1681e |
+ return ret;
|
|
|
d1681e |
+}
|
|
|
d1681e |
+
|
|
|
d1681e |
+int
|
|
|
d1681e |
glfsh_print_spb_status (dict_t *dict, char *path, uuid_t gfid,
|
|
|
d1681e |
- uint64_t *num_entries, gf_boolean_t flag)
|
|
|
d1681e |
+ num_entries_t *num_entries, gf_boolean_t flag)
|
|
|
d1681e |
{
|
|
|
d1681e |
int ret = 0;
|
|
|
d1681e |
gf_boolean_t pending = _gf_false;
|
|
|
d1681e |
@@ -492,7 +615,7 @@ glfsh_print_spb_status (dict_t *dict, char *path, uuid_t gfid,
|
|
|
d1681e |
*/
|
|
|
d1681e |
if (split_b) {
|
|
|
d1681e |
if (!flag || (flag && !pending)) {
|
|
|
d1681e |
- (*num_entries)++;
|
|
|
d1681e |
+ (num_entries->num_entries)++;
|
|
|
d1681e |
glfsh_output->print_spb_status (path ? path :
|
|
|
d1681e |
uuid_utoa_r (gfid, gfid_str),
|
|
|
d1681e |
gfid, NULL);
|
|
|
d1681e |
@@ -503,7 +626,8 @@ glfsh_print_spb_status (dict_t *dict, char *path, uuid_t gfid,
|
|
|
d1681e |
|
|
|
d1681e |
int
|
|
|
d1681e |
glfsh_print_heal_status (dict_t *dict, char *path, uuid_t gfid,
|
|
|
d1681e |
- uint64_t *num_entries, gf_boolean_t ignore_dirty)
|
|
|
d1681e |
+ num_entries_t *num_entries,
|
|
|
d1681e |
+ gf_boolean_t ignore_dirty)
|
|
|
d1681e |
{
|
|
|
d1681e |
int ret = 0;
|
|
|
d1681e |
gf_boolean_t pending = _gf_false;
|
|
|
d1681e |
@@ -562,7 +686,7 @@ out:
|
|
|
d1681e |
if (ret == -1)
|
|
|
d1681e |
status = NULL;
|
|
|
d1681e |
|
|
|
d1681e |
- (*num_entries)++;
|
|
|
d1681e |
+ (num_entries->num_entries)++;
|
|
|
d1681e |
glfsh_output->print_heal_status (path ? path :
|
|
|
d1681e |
uuid_utoa_r (gfid, gfid_str),
|
|
|
d1681e |
gfid,
|
|
|
d1681e |
@@ -574,7 +698,7 @@ out:
|
|
|
d1681e |
|
|
|
d1681e |
int
|
|
|
d1681e |
glfsh_heal_status_boolean (dict_t *dict, char *path, uuid_t gfid,
|
|
|
d1681e |
- uint64_t *num_entries, gf_boolean_t ignore_dirty)
|
|
|
d1681e |
+ num_entries_t *num_entries, gf_boolean_t ignore_dirty)
|
|
|
d1681e |
{
|
|
|
d1681e |
int ret = 0;
|
|
|
d1681e |
char *value = NULL;
|
|
|
d1681e |
@@ -589,7 +713,7 @@ glfsh_heal_status_boolean (dict_t *dict, char *path, uuid_t gfid,
|
|
|
d1681e |
static int
|
|
|
d1681e |
glfsh_heal_entries (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
|
|
|
d1681e |
gf_dirent_t *entries, uint64_t *offset,
|
|
|
d1681e |
- uint64_t *num_entries, dict_t *xattr_req) {
|
|
|
d1681e |
+ num_entries_t *num_entries, dict_t *xattr_req) {
|
|
|
d1681e |
|
|
|
d1681e |
gf_dirent_t *entry = NULL;
|
|
|
d1681e |
gf_dirent_t *tmp = NULL;
|
|
|
d1681e |
@@ -607,7 +731,7 @@ glfsh_heal_entries (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
|
|
|
d1681e |
xattr_req);
|
|
|
d1681e |
if (ret)
|
|
|
d1681e |
continue;
|
|
|
d1681e |
- (*num_entries)++;
|
|
|
d1681e |
+ (num_entries->num_entries)++;
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
return ret;
|
|
|
d1681e |
@@ -615,7 +739,7 @@ glfsh_heal_entries (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
|
|
|
d1681e |
|
|
|
d1681e |
static int
|
|
|
d1681e |
glfsh_process_entries (xlator_t *xl, fd_t *fd, gf_dirent_t *entries,
|
|
|
d1681e |
- uint64_t *offset, uint64_t *num_entries,
|
|
|
d1681e |
+ uint64_t *offset, num_entries_t *num_entries,
|
|
|
d1681e |
print_status glfsh_print_status,
|
|
|
d1681e |
gf_boolean_t ignore_dirty, glfsh_fail_mode_t mode)
|
|
|
d1681e |
{
|
|
|
d1681e |
@@ -687,7 +811,7 @@ out:
|
|
|
d1681e |
static int
|
|
|
d1681e |
glfsh_crawl_directory (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
|
|
|
d1681e |
xlator_t *readdir_xl, fd_t *fd, loc_t *loc,
|
|
|
d1681e |
- dict_t *xattr_req, uint64_t *num_entries,
|
|
|
d1681e |
+ dict_t *xattr_req, num_entries_t *num_entries,
|
|
|
d1681e |
gf_boolean_t ignore)
|
|
|
d1681e |
{
|
|
|
d1681e |
int ret = 0;
|
|
|
d1681e |
@@ -732,6 +856,14 @@ glfsh_crawl_directory (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
|
|
|
d1681e |
ignore, mode);
|
|
|
d1681e |
if (ret < 0)
|
|
|
d1681e |
goto out;
|
|
|
d1681e |
+ } else if (heal_op == GF_SHD_OP_HEAL_SUMMARY) {
|
|
|
d1681e |
+ ret = glfsh_process_entries (readdir_xl, fd,
|
|
|
d1681e |
+ &entries, &offset,
|
|
|
d1681e |
+ num_entries,
|
|
|
d1681e |
+ glfsh_print_summary_status,
|
|
|
d1681e |
+ ignore, mode);
|
|
|
d1681e |
+ if (ret < 0)
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
} else if (heal_op == GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK) {
|
|
|
d1681e |
ret = glfsh_heal_entries (fs, top_subvol, rootloc,
|
|
|
d1681e |
&entries, &offset,
|
|
|
d1681e |
@@ -786,7 +918,7 @@ int
|
|
|
d1681e |
glfsh_print_pending_heals_type (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
|
|
|
d1681e |
xlator_t *xl, gf_xl_afr_op_t heal_op,
|
|
|
d1681e |
dict_t *xattr_req, char *vgfid,
|
|
|
d1681e |
- uint64_t *num_entries)
|
|
|
d1681e |
+ num_entries_t *num_entries)
|
|
|
d1681e |
{
|
|
|
d1681e |
int ret = 0;
|
|
|
d1681e |
loc_t dirloc = {0};
|
|
|
d1681e |
@@ -827,7 +959,8 @@ glfsh_print_pending_heals (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
|
|
|
d1681e |
is_parent_replicate)
|
|
|
d1681e |
{
|
|
|
d1681e |
int ret = 0;
|
|
|
d1681e |
- uint64_t count = 0, total = 0;
|
|
|
d1681e |
+ num_entries_t num_entries = {0, };
|
|
|
d1681e |
+ num_entries_t total = {0, };
|
|
|
d1681e |
|
|
|
d1681e |
dict_t *xattr_req = NULL;
|
|
|
d1681e |
|
|
|
d1681e |
@@ -851,13 +984,20 @@ glfsh_print_pending_heals (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
|
|
|
d1681e |
|
|
|
d1681e |
ret = glfsh_print_pending_heals_type (fs, top_subvol, rootloc, xl,
|
|
|
d1681e |
heal_op, xattr_req,
|
|
|
d1681e |
- GF_XATTROP_INDEX_GFID, &count);
|
|
|
d1681e |
+ GF_XATTROP_INDEX_GFID,
|
|
|
d1681e |
+ &num_entries);
|
|
|
d1681e |
|
|
|
d1681e |
if (ret < 0 && heal_op == GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE)
|
|
|
d1681e |
goto out;
|
|
|
d1681e |
|
|
|
d1681e |
- total += count;
|
|
|
d1681e |
- count = 0;
|
|
|
d1681e |
+ total.num_entries += num_entries.num_entries;
|
|
|
d1681e |
+ total.pending_entries += num_entries.pending_entries;
|
|
|
d1681e |
+ total.spb_entries += num_entries.spb_entries;
|
|
|
d1681e |
+ total.possibly_healing_entries += num_entries.possibly_healing_entries;
|
|
|
d1681e |
+ num_entries.num_entries = 0;
|
|
|
d1681e |
+ num_entries.pending_entries = 0;
|
|
|
d1681e |
+ num_entries.spb_entries = 0;
|
|
|
d1681e |
+ num_entries.possibly_healing_entries = 0;
|
|
|
d1681e |
if (ret == -ENOTCONN)
|
|
|
d1681e |
goto out;
|
|
|
d1681e |
|
|
|
d1681e |
@@ -866,13 +1006,20 @@ glfsh_print_pending_heals (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
|
|
|
d1681e |
rootloc, xl,
|
|
|
d1681e |
heal_op, xattr_req,
|
|
|
d1681e |
GF_XATTROP_DIRTY_GFID,
|
|
|
d1681e |
- &count);
|
|
|
d1681e |
- total += count;
|
|
|
d1681e |
+ &num_entries);
|
|
|
d1681e |
+ total.num_entries += num_entries.num_entries;
|
|
|
d1681e |
+ total.pending_entries += num_entries.pending_entries;
|
|
|
d1681e |
+ total.spb_entries += num_entries.spb_entries;
|
|
|
d1681e |
+ total.possibly_healing_entries += num_entries.possibly_healing_entries;
|
|
|
d1681e |
}
|
|
|
d1681e |
out:
|
|
|
d1681e |
if (xattr_req)
|
|
|
d1681e |
dict_unref (xattr_req);
|
|
|
d1681e |
- glfsh_print_heal_op_status (ret, total, heal_op);
|
|
|
d1681e |
+ if (heal_op == GF_SHD_OP_HEAL_SUMMARY) {
|
|
|
d1681e |
+ glfsh_print_info_summary (ret, &total);
|
|
|
d1681e |
+ } else {
|
|
|
d1681e |
+ glfsh_print_heal_op_status (ret, total.num_entries, heal_op);
|
|
|
d1681e |
+ }
|
|
|
d1681e |
return ret;
|
|
|
d1681e |
|
|
|
d1681e |
}
|
|
|
d1681e |
@@ -1193,7 +1340,7 @@ int
|
|
|
d1681e |
glfsh_heal_from_brick_type (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
|
|
|
d1681e |
char *hostname, char *brickpath, xlator_t *client,
|
|
|
d1681e |
dict_t *xattr_req, char *vgfid,
|
|
|
d1681e |
- uint64_t *num_entries)
|
|
|
d1681e |
+ num_entries_t *num_entries)
|
|
|
d1681e |
{
|
|
|
d1681e |
fd_t *fd = NULL;
|
|
|
d1681e |
loc_t dirloc = {0};
|
|
|
d1681e |
@@ -1229,9 +1376,10 @@ glfsh_heal_from_brick (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
|
|
|
d1681e |
char *hostname, char *brickpath, char *file)
|
|
|
d1681e |
{
|
|
|
d1681e |
int ret = -1;
|
|
|
d1681e |
- uint64_t count = 0, total = 0;
|
|
|
d1681e |
dict_t *xattr_req = NULL;
|
|
|
d1681e |
xlator_t *client = NULL;
|
|
|
d1681e |
+ num_entries_t num_entries = {0, };
|
|
|
d1681e |
+ num_entries_t total = {0, };
|
|
|
d1681e |
|
|
|
d1681e |
xattr_req = dict_new();
|
|
|
d1681e |
if (!xattr_req)
|
|
|
d1681e |
@@ -1258,9 +1406,9 @@ glfsh_heal_from_brick (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
|
|
|
d1681e |
hostname, brickpath,
|
|
|
d1681e |
client, xattr_req,
|
|
|
d1681e |
GF_XATTROP_INDEX_GFID,
|
|
|
d1681e |
- &count);
|
|
|
d1681e |
- total += count;
|
|
|
d1681e |
- count = 0;
|
|
|
d1681e |
+ &num_entries);
|
|
|
d1681e |
+ total.num_entries += num_entries.num_entries;
|
|
|
d1681e |
+ num_entries.num_entries = 0;
|
|
|
d1681e |
if (ret == -ENOTCONN)
|
|
|
d1681e |
goto out;
|
|
|
d1681e |
|
|
|
d1681e |
@@ -1268,8 +1416,8 @@ glfsh_heal_from_brick (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
|
|
|
d1681e |
hostname, brickpath,
|
|
|
d1681e |
client, xattr_req,
|
|
|
d1681e |
GF_XATTROP_DIRTY_GFID,
|
|
|
d1681e |
- &count);
|
|
|
d1681e |
- total += count;
|
|
|
d1681e |
+ &num_entries);
|
|
|
d1681e |
+ total.num_entries += num_entries.num_entries;
|
|
|
d1681e |
if (ret < 0)
|
|
|
d1681e |
goto out;
|
|
|
d1681e |
}
|
|
|
d1681e |
@@ -1277,7 +1425,7 @@ out:
|
|
|
d1681e |
if (xattr_req)
|
|
|
d1681e |
dict_unref (xattr_req);
|
|
|
d1681e |
if (!file)
|
|
|
d1681e |
- glfsh_print_heal_op_status (ret, total,
|
|
|
d1681e |
+ glfsh_print_heal_op_status (ret, total.num_entries,
|
|
|
d1681e |
GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK);
|
|
|
d1681e |
|
|
|
d1681e |
return ret;
|
|
|
d1681e |
@@ -1326,6 +1474,7 @@ glfsh_info_t glfsh_human_readable = {
|
|
|
d1681e |
.init = glfsh_init,
|
|
|
d1681e |
.print_brick_from_xl = glfsh_print_brick_from_xl,
|
|
|
d1681e |
.print_heal_op_status = glfsh_print_hr_heal_op_status,
|
|
|
d1681e |
+ .print_heal_op_summary = glfsh_print_hr_heal_op_summary,
|
|
|
d1681e |
.print_heal_status = glfsh_print_hr_heal_status,
|
|
|
d1681e |
.print_spb_status = glfsh_print_hr_spb_status,
|
|
|
d1681e |
.end = glfsh_end
|
|
|
d1681e |
@@ -1345,6 +1494,7 @@ glfsh_info_t glfsh_xml_output = {
|
|
|
d1681e |
.init = glfsh_xml_init,
|
|
|
d1681e |
.print_brick_from_xl = glfsh_print_xml_brick_from_xl,
|
|
|
d1681e |
.print_heal_op_status = glfsh_print_xml_heal_op_status,
|
|
|
d1681e |
+ .print_heal_op_summary = glfsh_print_xml_heal_op_summary,
|
|
|
d1681e |
.print_heal_status = glfsh_print_xml_file_status,
|
|
|
d1681e |
.print_spb_status = glfsh_print_xml_file_status,
|
|
|
d1681e |
.end = glfsh_xml_end
|
|
|
d1681e |
@@ -1385,6 +1535,8 @@ main (int argc, char **argv)
|
|
|
d1681e |
is_xml = 1;
|
|
|
d1681e |
} else if (!strcmp (argv[2], "granular-entry-heal-op")) {
|
|
|
d1681e |
heal_op = GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE;
|
|
|
d1681e |
+ } else if (!strcmp (argv[2], "info-summary")) {
|
|
|
d1681e |
+ heal_op = GF_SHD_OP_HEAL_SUMMARY;
|
|
|
d1681e |
} else {
|
|
|
d1681e |
printf (USAGE_STR, argv[0]);
|
|
|
d1681e |
ret = -1;
|
|
|
d1681e |
@@ -1396,6 +1548,10 @@ main (int argc, char **argv)
|
|
|
d1681e |
&& (!strcmp (argv[3], "xml"))) {
|
|
|
d1681e |
heal_op = GF_SHD_OP_SPLIT_BRAIN_FILES;
|
|
|
d1681e |
is_xml = 1;
|
|
|
d1681e |
+ } else if ((!strcmp (argv[2], "info-summary"))
|
|
|
d1681e |
+ && (!strcmp (argv[3], "xml"))) {
|
|
|
d1681e |
+ heal_op = GF_SHD_OP_HEAL_SUMMARY;
|
|
|
d1681e |
+ is_xml = 1;
|
|
|
d1681e |
} else if (!strcmp (argv[2], "bigger-file")) {
|
|
|
d1681e |
heal_op = GF_SHD_OP_SBRAIN_HEAL_FROM_BIGGER_FILE;
|
|
|
d1681e |
file = argv[3];
|
|
|
d1681e |
@@ -1517,7 +1673,8 @@ main (int argc, char **argv)
|
|
|
d1681e |
if (ret < 0) {
|
|
|
d1681e |
ret = -EINVAL;
|
|
|
d1681e |
gf_asprintf (&op_errstr, "Volume %s is not of type %s", volname,
|
|
|
d1681e |
- (heal_op == GF_SHD_OP_INDEX_SUMMARY) ?
|
|
|
d1681e |
+ (heal_op == GF_SHD_OP_INDEX_SUMMARY ||
|
|
|
d1681e |
+ heal_op == GF_SHD_OP_HEAL_SUMMARY) ?
|
|
|
d1681e |
"replicate/disperse":"replicate");
|
|
|
d1681e |
goto out;
|
|
|
d1681e |
}
|
|
|
d1681e |
@@ -1528,6 +1685,7 @@ main (int argc, char **argv)
|
|
|
d1681e |
case GF_SHD_OP_INDEX_SUMMARY:
|
|
|
d1681e |
case GF_SHD_OP_SPLIT_BRAIN_FILES:
|
|
|
d1681e |
case GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE:
|
|
|
d1681e |
+ case GF_SHD_OP_HEAL_SUMMARY:
|
|
|
d1681e |
ret = glfsh_gather_heal_info (fs, top_subvol, &rootloc,
|
|
|
d1681e |
heal_op);
|
|
|
d1681e |
break;
|
|
|
d1681e |
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h
|
|
|
d1681e |
index 510817c..80e1f6b 100644
|
|
|
d1681e |
--- a/rpc/rpc-lib/src/protocol-common.h
|
|
|
d1681e |
+++ b/rpc/rpc-lib/src/protocol-common.h
|
|
|
d1681e |
@@ -265,6 +265,7 @@ typedef enum {
|
|
|
d1681e |
GF_SHD_OP_SBRAIN_HEAL_FROM_LATEST_MTIME,
|
|
|
d1681e |
GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE,
|
|
|
d1681e |
GF_SHD_OP_GRANULAR_ENTRY_HEAL_DISABLE,
|
|
|
d1681e |
+ GF_SHD_OP_HEAL_SUMMARY,
|
|
|
d1681e |
} gf_xl_afr_op_t ;
|
|
|
d1681e |
|
|
|
d1681e |
struct gf_gsync_detailed_status_ {
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
d1681e |
index 725d194..222d5f4 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
d1681e |
@@ -1867,6 +1867,7 @@ glusterd_handle_heal_cmd (xlator_t *this, glusterd_volinfo_t *volinfo,
|
|
|
d1681e |
case GF_SHD_OP_HEAL_DISABLE:/* This op should be handled in volume-set*/
|
|
|
d1681e |
case GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE: /* This op should be handled in volume-set */
|
|
|
d1681e |
case GF_SHD_OP_GRANULAR_ENTRY_HEAL_DISABLE: /* This op should be handled in volume-set */
|
|
|
d1681e |
+ case GF_SHD_OP_HEAL_SUMMARY:/*glfsheal cmd*/
|
|
|
d1681e |
case GF_SHD_OP_SBRAIN_HEAL_FROM_BIGGER_FILE:/*glfsheal cmd*/
|
|
|
d1681e |
case GF_SHD_OP_SBRAIN_HEAL_FROM_LATEST_MTIME:/*glfsheal cmd*/
|
|
|
d1681e |
case GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK:/*glfsheal cmd*/
|
|
|
d1681e |
--
|
|
|
d1681e |
1.8.3.1
|
|
|
d1681e |
|