diff options
Diffstat (limited to 'cli')
| -rw-r--r-- | cli/src/cli-rpc-ops.c | 41 | ||||
| -rw-r--r-- | cli/src/cli-xml-output.c | 21 | ||||
| -rw-r--r-- | cli/src/cli.h | 1 | 
3 files changed, 44 insertions, 19 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 5a13ff1654e..4cb867442b5 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -66,6 +66,13 @@ char *cli_volume_backend[] = {"",                             "Volume Group",  }; +char *cli_vol_task_status_str[] = {"not started", +                                   "in progress", +                                   "stopped", +                                   "completed", +                                   "failed", +}; +  int32_t  gf_cli_get_volume (call_frame_t *frame, xlator_t *this,                        void *data); @@ -1401,24 +1408,7 @@ gf_cli_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov,                          gf_log (THIS->name, GF_LOG_TRACE,                                  "failed to get run-time"); -                switch (status_rcd) { -                case GF_DEFRAG_STATUS_NOT_STARTED: -                        status = "not started"; -                        break; -                case GF_DEFRAG_STATUS_STARTED: -                        status = "in progress"; -                        break; -                case GF_DEFRAG_STATUS_STOPPED: -                        status = "stopped"; -                        break; -                case GF_DEFRAG_STATUS_COMPLETE: -                        status = "completed"; -                        break; -                case GF_DEFRAG_STATUS_FAILED: -                        status = "failed"; -                        break; -                } - +                status = cli_vol_task_status_str[status_rcd];                  size_str = gf_uint64_2human_readable(size);                  cli_out ("%40s %16"PRIu64 " %13s" " %13"PRIu64 " %13"PRIu64                           " %14s %16.2f", node_uuid, files, size_str, lookup, @@ -5613,7 +5603,20 @@ cli_print_volume_tasks (dict_t *dict) {                  if (ret)                          return; -                cli_out ("%15s%40s%15d", op, task_id_str, status); +                /* +                   Replace brick only has two states - In progress and Complete +                   Ref: xlators/mgmt/glusterd/src/glusterd-replace-brick.c +                */ +                if (!strcmp (op, "Replace brick")) { +                    if (status) { +                        status = GF_DEFRAG_STATUS_COMPLETE; +                    } else { +                        status = GF_DEFRAG_STATUS_STARTED; +                    } +                } + +                cli_out ("%15s%40s%15s", op, task_id_str, +                         cli_vol_task_status_str[status]);          }  } diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index 543ea713d17..fded1c646a5 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -1436,6 +1436,21 @@ cli_xml_output_vol_status_tasks (cli_local_t *local, dict_t *dict) {                                                         "%d", status);                  XML_RET_CHECK_AND_GOTO (ret, out); +                if (!strcmp (task_type, "Replace brick")) { +                    if (status) { +                        status = GF_DEFRAG_STATUS_COMPLETE; +                    } else { +                        status = GF_DEFRAG_STATUS_STARTED; +                    } +                } + +                ret = xmlTextWriterWriteFormatElement (local->writer, +                                                       (xmlChar *)"statusStr", +                                                       "%s", +                                             cli_vol_task_status_str[status]); + +                XML_RET_CHECK_AND_GOTO (ret, out); +                  /* </task> */                  ret = xmlTextWriterEndElement (local->writer);                  XML_RET_CHECK_AND_GOTO (ret, out); @@ -2956,6 +2971,12 @@ cli_xml_output_vol_rebalance_status (xmlTextWriterPtr writer, dict_t *dict)                                                         "%d", status_rcd);                  XML_RET_CHECK_AND_GOTO (ret, out); +                ret = xmlTextWriterWriteFormatElement (writer, +                                                       (xmlChar *)"statusStr", +                                                       "%s", +                                         cli_vol_task_status_str[status_rcd]); +                XML_RET_CHECK_AND_GOTO (ret, out); +                  /* </node> */                  ret = xmlTextWriterEndElement (writer);                  XML_RET_CHECK_AND_GOTO (ret, out); diff --git a/cli/src/cli.h b/cli/src/cli.h index e0699b4293f..c2dd1ca5d50 100644 --- a/cli/src/cli.h +++ b/cli/src/cli.h @@ -66,6 +66,7 @@ struct cli_cmd;  extern char *cli_vol_type_str[];  extern char *cli_vol_status_str[]; +extern char *cli_vol_task_status_str[];  typedef int (cli_cmd_cbk_t)(struct cli_state *state,                              struct cli_cmd_word *word,  | 
