summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/src/cli3_1-cops.c9
-rw-r--r--rpc/xdr/src/cli1-xdr.c11
-rw-r--r--rpc/xdr/src/cli1-xdr.h17
-rw-r--r--rpc/xdr/src/cli1.x1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c33
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c1
6 files changed, 50 insertions, 22 deletions
diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c
index e7be898..5bf0e36 100644
--- a/cli/src/cli3_1-cops.c
+++ b/cli/src/cli3_1-cops.c
@@ -785,14 +785,7 @@ gf_cli3_1_replace_brick_cbk (struct rpc_req *req, struct iovec *iov,
case GF_REPLACE_OP_STATUS:
- ret = dict_get_str (dict, "status-reply",
- &status_reply);
- if (ret) {
- gf_log ("", GF_LOG_DEBUG,
- "dict_get failed on status reply");
- goto out;
- }
-
+ status_reply = rsp.status;
if (rsp.op_ret || ret)
rb_operation_str = "replace-brick status unknown";
else
diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c
index 22c00f2..dd225f3 100644
--- a/rpc/xdr/src/cli1-xdr.c
+++ b/rpc/xdr/src/cli1-xdr.c
@@ -443,6 +443,8 @@ xdr_gf1_cli_replace_brick_rsp (XDR *xdrs, gf1_cli_replace_brick_rsp *objp)
return FALSE;
if (!xdr_string (xdrs, &objp->volname, ~0))
return FALSE;
+ if (!xdr_string (xdrs, &objp->status, ~0))
+ return FALSE;
return TRUE;
}
@@ -470,10 +472,10 @@ xdr_gf1_cli_set_vol_rsp (XDR *xdrs, gf1_cli_set_vol_rsp *objp)
return TRUE;
}
-
bool_t
xdr_gf1_cli_log_filename_req (XDR *xdrs, gf1_cli_log_filename_req *objp)
{
+
if (!xdr_string (xdrs, &objp->volname, ~0))
return FALSE;
if (!xdr_string (xdrs, &objp->brick, ~0))
@@ -486,6 +488,7 @@ xdr_gf1_cli_log_filename_req (XDR *xdrs, gf1_cli_log_filename_req *objp)
bool_t
xdr_gf1_cli_log_filename_rsp (XDR *xdrs, gf1_cli_log_filename_rsp *objp)
{
+
if (!xdr_int (xdrs, &objp->op_ret))
return FALSE;
if (!xdr_int (xdrs, &objp->op_errno))
@@ -495,10 +498,10 @@ xdr_gf1_cli_log_filename_rsp (XDR *xdrs, gf1_cli_log_filename_rsp *objp)
return TRUE;
}
-
bool_t
xdr_gf1_cli_log_locate_req (XDR *xdrs, gf1_cli_log_locate_req *objp)
{
+
if (!xdr_string (xdrs, &objp->volname, ~0))
return FALSE;
if (!xdr_string (xdrs, &objp->brick, ~0))
@@ -509,6 +512,7 @@ xdr_gf1_cli_log_locate_req (XDR *xdrs, gf1_cli_log_locate_req *objp)
bool_t
xdr_gf1_cli_log_locate_rsp (XDR *xdrs, gf1_cli_log_locate_rsp *objp)
{
+
if (!xdr_int (xdrs, &objp->op_ret))
return FALSE;
if (!xdr_int (xdrs, &objp->op_errno))
@@ -518,10 +522,10 @@ xdr_gf1_cli_log_locate_rsp (XDR *xdrs, gf1_cli_log_locate_rsp *objp)
return TRUE;
}
-
bool_t
xdr_gf1_cli_log_rotate_req (XDR *xdrs, gf1_cli_log_rotate_req *objp)
{
+
if (!xdr_string (xdrs, &objp->volname, ~0))
return FALSE;
if (!xdr_string (xdrs, &objp->brick, ~0))
@@ -532,6 +536,7 @@ xdr_gf1_cli_log_rotate_req (XDR *xdrs, gf1_cli_log_rotate_req *objp)
bool_t
xdr_gf1_cli_log_rotate_rsp (XDR *xdrs, gf1_cli_log_rotate_rsp *objp)
{
+
if (!xdr_int (xdrs, &objp->op_ret))
return FALSE;
if (!xdr_int (xdrs, &objp->op_errno))
diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h
index e725e52..2219b05 100644
--- a/rpc/xdr/src/cli1-xdr.h
+++ b/rpc/xdr/src/cli1-xdr.h
@@ -270,6 +270,7 @@ struct gf1_cli_replace_brick_rsp {
int op_ret;
int op_errno;
char *volname;
+ char *status;
};
typedef struct gf1_cli_replace_brick_rsp gf1_cli_replace_brick_rsp;
@@ -291,45 +292,44 @@ typedef struct gf1_cli_set_vol_rsp gf1_cli_set_vol_rsp;
struct gf1_cli_log_filename_req {
char *volname;
- char *brick;
- char *path;
+ char *brick;
+ char *path;
};
typedef struct gf1_cli_log_filename_req gf1_cli_log_filename_req;
struct gf1_cli_log_filename_rsp {
int op_ret;
int op_errno;
- char *errstr;
+ char *errstr;
};
typedef struct gf1_cli_log_filename_rsp gf1_cli_log_filename_rsp;
struct gf1_cli_log_locate_req {
char *volname;
- char *brick;
+ char *brick;
};
typedef struct gf1_cli_log_locate_req gf1_cli_log_locate_req;
struct gf1_cli_log_locate_rsp {
int op_ret;
int op_errno;
- char *path;
+ char *path;
};
typedef struct gf1_cli_log_locate_rsp gf1_cli_log_locate_rsp;
struct gf1_cli_log_rotate_req {
char *volname;
- char *brick;
+ char *brick;
};
typedef struct gf1_cli_log_rotate_req gf1_cli_log_rotate_req;
struct gf1_cli_log_rotate_rsp {
int op_ret;
int op_errno;
- char *errstr;
+ char *errstr;
};
typedef struct gf1_cli_log_rotate_rsp gf1_cli_log_rotate_rsp;
-
/* the xdr functions */
#if defined(__STDC__) || defined(__cplusplus)
@@ -373,7 +373,6 @@ extern bool_t xdr_gf1_cli_log_locate_rsp (XDR *, gf1_cli_log_locate_rsp*);
extern bool_t xdr_gf1_cli_log_rotate_req (XDR *, gf1_cli_log_rotate_req*);
extern bool_t xdr_gf1_cli_log_rotate_rsp (XDR *, gf1_cli_log_rotate_rsp*);
-
#else /* K&R C */
extern bool_t xdr_gf1_cluster_type ();
extern bool_t xdr_gf1_cli_replace_op ();
diff --git a/rpc/xdr/src/cli1.x b/rpc/xdr/src/cli1.x
index 359a774..0ffe327 100644
--- a/rpc/xdr/src/cli1.x
+++ b/rpc/xdr/src/cli1.x
@@ -184,6 +184,7 @@ struct gf1_cli_get_vol_rsp {
int op_ret;
int op_errno;
string volname<>;
+ string status<>;
} ;
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index b5cd26b..b179393 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,};
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 1c456af..6bcbf8c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -964,6 +964,7 @@ glusterd_is_cli_op_req (int32_t op)
case GD_MGMT_CLI_DEFRAG_VOLUME:
case GD_MGMT_CLI_ADD_BRICK:
case GD_MGMT_CLI_REMOVE_BRICK:
+ case GD_MGMT_CLI_REPLACE_BRICK:
case GD_MGMT_CLI_LOG_FILENAME:
case GD_MGMT_CLI_LOG_LOCATE:
case GD_MGMT_CLI_LOG_ROTATE: