summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'cli/src/cli-cmd.c')
0 files changed, 0 insertions, 0 deletions
2de500dff69e68bc4aebd3700c7388d0'>xlators/mgmt/glusterd/src/glusterd-syncop.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c216
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h2
5 files changed, 236 insertions, 22 deletions
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c
index 2927ab1e4fd..fe0969a3042 100644
--- a/cli/src/cli-xml-output.c
+++ b/cli/src/cli-xml-output.c
@@ -3248,13 +3248,30 @@ cli_xml_output_vol_rebalance_status (xmlTextWriterPtr writer, dict_t *dict,
overall_elapsed = elapsed;
}
+ /* Rebalance has 5 states,
+ * NOT_STARTED, STARTED, STOPPED, COMPLETE, FAILED
+ * The precedence used to determine the aggregate status is as
+ * below,
+ * STARTED > FAILED > STOPPED > COMPLETE > NOT_STARTED
+ */
+ /* TODO: Move this to a common place utilities that both CLI and
+ * glusterd need.
+ * Till then if the below algorithm is changed, change it in
+ * glusterd_volume_status_aggregate_tasks_status in
+ * glusterd-utils.c
+ */
+
if (-1 == overall_status)
overall_status = status_rcd;
- else if ((GF_DEFRAG_STATUS_COMPLETE == overall_status ||
- status_rcd > overall_status) &&
- (status_rcd != GF_DEFRAG_STATUS_COMPLETE))
+ int rank[] = {
+ [GF_DEFRAG_STATUS_STARTED] = 1,
+ [GF_DEFRAG_STATUS_FAILED] = 2,
+ [GF_DEFRAG_STATUS_STOPPED] = 3,
+ [GF_DEFRAG_STATUS_COMPLETE] = 4,
+ [GF_DEFRAG_STATUS_NOT_STARTED] = 5
+ };
+ if (rank[status_rcd] <= rank[overall_status])
overall_status = status_rcd;
- XML_RET_CHECK_AND_GOTO (ret, out);
/* </node> */
ret = xmlTextWriterEndElement (writer);
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index add3b64f3c8..0bf7a335298 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2181,7 +2181,7 @@ glusterd_op_status_volume (dict_t *dict, char **op_errstr,
if (ret)
goto out;
- if (is_origin_glusterd ()) {
+ if (origin_glusterd) {
ret = 0;
if ((cmd & GF_CLI_STATUS_ALL)) {
ret = glusterd_get_all_volnames (rsp_dict);
@@ -2345,11 +2345,9 @@ glusterd_op_status_volume (dict_t *dict, char **op_errstr,
/* Active tasks */
/* Tasks are added only for normal volume status request for either a
- * single volume or all volumes, and only by the origin glusterd