summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavan Sondur <pavan@gluster.com>2010-07-26 07:07:24 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-27 01:20:08 -0700
commitf803fae036177c3b9d9513f5b6300d426366eb62 (patch)
tree7d68e521e64fccddfd1188a6ef33de31125dd5c0
parent667b2496c3f29e24ed359a05b0f44df0d1894969 (diff)
cli: Fixes related to get brick-replace to work.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1187 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1187
-rw-r--r--cli/src/cli3_1-cops.c25
-rw-r--r--rpc/xdr/src/cli1-xdr.c50
-rw-r--r--rpc/xdr/src/cli1-xdr.h17
-rw-r--r--rpc/xdr/src/cli1.x6
4 files changed, 60 insertions, 38 deletions
diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c
index d76485734ef..6ebe6ddbe40 100644
--- a/cli/src/cli3_1-cops.c
+++ b/cli/src/cli3_1-cops.c
@@ -1176,8 +1176,6 @@ gf_cli3_1_replace_brick (call_frame_t *frame, xlator_t *this,
gf1_cli_replace_brick_req req = {0,};
int ret = 0;
dict_t *dict = NULL;
- char *src_brick = NULL;
- char *dst_brick = NULL;
if (!frame || !this || !data) {
ret = -1;
@@ -1197,21 +1195,6 @@ gf_cli3_1_replace_brick (call_frame_t *frame, xlator_t *this,
goto out;
if (GF_REPLACE_OP_START == req.op) {
- ret = dict_get_str (dict, "src-brick", &src_brick);
-
- if (ret)
- goto out;
-
- req.src_brick.src_brick_len = strlen (src_brick);
- req.src_brick.src_brick_val = src_brick;
-
- ret = dict_get_str (dict, "src-brick", &dst_brick);
-
- if (ret)
- goto out;
-
- req.dst_brick.dst_brick_len = strlen (dst_brick);
- req.dst_brick.dst_brick_val = dst_brick;
}
ret = cli_submit_request (&req, frame, cli_rpc_prog,
@@ -1222,12 +1205,12 @@ gf_cli3_1_replace_brick (call_frame_t *frame, xlator_t *this,
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
- if (req.src_brick.src_brick_val) {
- GF_FREE (req.src_brick.src_brick_val);
+ if (req.bricks.bricks_val) {
+ GF_FREE (req.bricks.bricks_val);
}
- if (req.dst_brick.dst_brick_val) {
- GF_FREE (req.dst_brick.dst_brick_val);
+ if (req.bricks.bricks_val) {
+ GF_FREE (req.bricks.bricks_val);
}
return ret;
diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c
index 0ffdf5bfe58..32e42c21ce4 100644
--- a/rpc/xdr/src/cli1-xdr.c
+++ b/rpc/xdr/src/cli1-xdr.c
@@ -56,14 +56,54 @@ bool_t
xdr_gf1_cli_probe_rsp (XDR *xdrs, gf1_cli_probe_rsp *objp)
{
+ register int32_t *buf;
+
+ if (xdrs->x_op == XDR_ENCODE) {
+ buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT);
+ if (buf == NULL) {
+ if (!xdr_int (xdrs, &objp->op_ret))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->op_errno))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->port))
+ return FALSE;
+
+ } else {
+ IXDR_PUT_LONG(buf, objp->op_ret);
+ IXDR_PUT_LONG(buf, objp->op_errno);
+ IXDR_PUT_LONG(buf, objp->port);
+ }
+ if (!xdr_string (xdrs, &objp->hostname, ~0))
+ return FALSE;
+ return TRUE;
+ } else if (xdrs->x_op == XDR_DECODE) {
+ buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT);
+ if (buf == NULL) {
+ if (!xdr_int (xdrs, &objp->op_ret))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->op_errno))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->port))
+ return FALSE;
+
+ } else {
+ objp->op_ret = IXDR_GET_LONG(buf);
+ objp->op_errno = IXDR_GET_LONG(buf);
+ objp->port = IXDR_GET_LONG(buf);
+ }
+ if (!xdr_string (xdrs, &objp->hostname, ~0))
+ return FALSE;
+ return TRUE;
+ }
+
if (!xdr_int (xdrs, &objp->op_ret))
return FALSE;
if (!xdr_int (xdrs, &objp->op_errno))
return FALSE;
- if (!xdr_string (xdrs, &objp->hostname, ~0))
- return FALSE;
if (!xdr_int (xdrs, &objp->port))
return FALSE;
+ if (!xdr_string (xdrs, &objp->hostname, ~0))
+ return FALSE;
return TRUE;
}
@@ -274,6 +314,8 @@ xdr_gf1_cli_defrag_vol_rsp (XDR *xdrs, gf1_cli_defrag_vol_rsp *objp)
return FALSE;
if (!xdr_int (xdrs, &objp->op_errno))
return FALSE;
+ if (!xdr_string (xdrs, &objp->volname, ~0))
+ return FALSE;
return TRUE;
}
@@ -341,9 +383,7 @@ xdr_gf1_cli_replace_brick_req (XDR *xdrs, gf1_cli_replace_brick_req *objp)
return FALSE;
if (!xdr_gf1_cli_replace_op (xdrs, &objp->op))
return FALSE;
- if (!xdr_bytes (xdrs, (char **)&objp->src_brick.src_brick_val, (u_int *) &objp->src_brick.src_brick_len, ~0))
- return FALSE;
- if (!xdr_bytes (xdrs, (char **)&objp->dst_brick.dst_brick_val, (u_int *) &objp->dst_brick.dst_brick_len, ~0))
+ if (!xdr_bytes (xdrs, (char **)&objp->bricks.bricks_val, (u_int *) &objp->bricks.bricks_len, ~0))
return FALSE;
return TRUE;
}
diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h
index 50a26760adf..51fce3e9296 100644
--- a/rpc/xdr/src/cli1-xdr.h
+++ b/rpc/xdr/src/cli1-xdr.h
@@ -43,21 +43,21 @@ typedef enum gf1_cli_get_volume gf1_cli_get_volume;
struct gf1_cli_probe_req {
char *hostname;
- int port;
+ int port;
};
typedef struct gf1_cli_probe_req gf1_cli_probe_req;
struct gf1_cli_probe_rsp {
int op_ret;
int op_errno;
+ int port;
char *hostname;
- int port;
};
typedef struct gf1_cli_probe_rsp gf1_cli_probe_rsp;
struct gf1_cli_deprobe_req {
char *hostname;
- int port;
+ int port;
};
typedef struct gf1_cli_deprobe_req gf1_cli_deprobe_req;
@@ -181,6 +181,7 @@ typedef struct gf1_cli_defrag_vol_req gf1_cli_defrag_vol_req;
struct gf1_cli_defrag_vol_rsp {
int op_ret;
int op_errno;
+ char *volname;
};
typedef struct gf1_cli_defrag_vol_rsp gf1_cli_defrag_vol_rsp;
@@ -224,13 +225,9 @@ struct gf1_cli_replace_brick_req {
char *volname;
gf1_cli_replace_op op;
struct {
- u_int src_brick_len;
- char *src_brick_val;
- } src_brick;
- struct {
- u_int dst_brick_len;
- char *dst_brick_val;
- } dst_brick;
+ u_int bricks_len;
+ char *bricks_val;
+ } bricks;
};
typedef struct gf1_cli_replace_brick_req gf1_cli_replace_brick_req;
diff --git a/rpc/xdr/src/cli1.x b/rpc/xdr/src/cli1.x
index 41f43a4855b..8f0dfc3c045 100644
--- a/rpc/xdr/src/cli1.x
+++ b/rpc/xdr/src/cli1.x
@@ -23,16 +23,19 @@ enum gf1_cli_get_volume {
struct gf1_cli_probe_req {
string hostname<>;
+ int port;
} ;
struct gf1_cli_probe_rsp {
int op_ret;
int op_errno;
+ int port;
string hostname<>;
} ;
struct gf1_cli_deprobe_req {
string hostname<>;
+ int port;
} ;
struct gf1_cli_deprobe_rsp {
@@ -160,8 +163,7 @@ struct gf1_cli_get_vol_rsp {
struct gf1_cli_replace_brick_req {
string volname<>;
gf1_cli_replace_op op;
- opaque src_brick<>;
- opaque dst_brick<>;
+ opaque bricks<>;
} ;
struct gf1_cli_replace_brick_rsp {