diff options
| author | Pranith Kumar K <pranithk@gluster.com> | 2010-09-02 05:24:48 +0000 | 
|---|---|---|
| committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-02 05:17:11 -0700 | 
| commit | 3e5c243396b6acf1a76d66d80c798466dc5caa55 (patch) | |
| tree | 6d6a6afa9c35f534db71a6804652c1fa2aeb7948 /xlators/mgmt/glusterd/src/glusterd-op-sm.c | |
| parent | 060380d460caa74b30eb6c0dedc8e25c64030acf (diff) | |
cli, mgmt/glusterd: Added replace brick cli response
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1322 (Replace brick should show status of paused and abort states)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1322
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 33 | 
1 files changed, 31 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index b5cd26b8f6e..b1793937450 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -1887,6 +1887,7 @@ rb_do_operation_status (glusterd_volinfo_t *volinfo,  {          const char *status       = NULL;          char       *status_reply = NULL; +        dict_t     *ctx          = NULL;          int ret = -1;          if (!glusterd_is_local_addr (src_brickinfo->hostname)) { @@ -1912,6 +1913,13 @@ rb_do_operation_status (glusterd_volinfo_t *volinfo,                  gf_log ("", GF_LOG_DEBUG,                          "pump status is %s", status); +                ctx = glusterd_op_get_ctx (GD_OP_REPLACE_BRICK); +                if (!ctx) { +                        gf_log ("", GF_LOG_ERROR, +                                "Operation Context is not present"); +                        ret = -1; +                        goto out; +                }                  status_reply = gf_strdup (status);                  if (!status_reply) {                          gf_log ("", GF_LOG_ERROR, @@ -1920,11 +1928,11 @@ rb_do_operation_status (glusterd_volinfo_t *volinfo,                          goto out;                  } -                ret = dict_set_dynstr (dict, "status-reply", +                ret = dict_set_dynstr (ctx, "status-reply",                                         status_reply);                  if (ret) {                          gf_log ("", GF_LOG_DEBUG, -                                "failed to set pump status in dict"); +                                "failed to set pump status in ctx");                          goto out;                  } @@ -2813,6 +2821,7 @@ glusterd_op_send_cli_response (int32_t op, int32_t op_ret,          int32_t         ret = -1;          gd_serialize_t  sfunc = NULL;          void            *cli_rsp = NULL; +        dict_t          *ctx = NULL;          switch (op) {                  case GD_MGMT_CLI_CREATE_VOLUME: @@ -2895,6 +2904,26 @@ glusterd_op_send_cli_response (int32_t op, int32_t op_ret,                                  break;                          } +                case GD_MGMT_CLI_REPLACE_BRICK: +                        { +                                gf1_cli_replace_brick_rsp rsp = {0,}; +                                ctx = glusterd_op_get_ctx (GD_OP_REPLACE_BRICK); +                                if (!ctx) { +                                        gf_log ("", GF_LOG_ERROR, +                                                "Operation Context is not present"); +                                        ret = -1; +                                        goto out; +                                } +                                if (dict_get_str (ctx, "status-reply", &rsp.status)) +                                        rsp.status = ""; +                                rsp.op_ret = op_ret; +                                rsp.op_errno = op_errno; +                                rsp.volname = ""; +                                cli_rsp = &rsp; +                                sfunc = gf_xdr_serialize_cli_replace_brick_rsp; +                                break; +                        } +                  case GD_MGMT_CLI_LOG_FILENAME:                          {                                  gf1_cli_log_filename_rsp rsp = {0,};  | 
