diff options
| author | Kaushal M <kaushal@redhat.com> | 2012-05-21 11:59:34 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vijay@gluster.com> | 2012-05-23 00:04:04 -0700 | 
| commit | 8e7f28fa1ebc6d7efdc892856884a92191e47040 (patch) | |
| tree | 7a8e80d962acfc62006d24d574f054e2262011fc | |
| parent | 7a9a28742a7dffa8cc16866e9e3388f392e0e3b2 (diff) | |
glusterd: On-wire changes required for probe/detach errstr
This patch changes the on-wire structures for 'peer probe' and 'peer detach' to
include op_errstr. These changes have been backported from patches
feb99ca (glusterd, cli: Enable errstr for peer probe) and
3213a4e (glusterd,cli: Enable errstr for peer detach). The remaining changes
will be included later on.
Change-Id: I6e8e917f5ad928b80862d301c364cd4df56bb4c0
BUG: 816840
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/3387
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
| -rw-r--r-- | rpc/xdr/src/cli1-xdr.c | 8 | ||||
| -rw-r--r-- | rpc/xdr/src/cli1-xdr.h | 2 | ||||
| -rw-r--r-- | rpc/xdr/src/cli1-xdr.x | 2 | ||||
| -rw-r--r-- | rpc/xdr/src/glusterd1-xdr.c | 51 | ||||
| -rw-r--r-- | rpc/xdr/src/glusterd1-xdr.h | 1 | ||||
| -rw-r--r-- | rpc/xdr/src/glusterd1-xdr.x | 1 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 15 | 
7 files changed, 80 insertions, 0 deletions
diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c index 56562ee3d00..53e1807658a 100644 --- a/rpc/xdr/src/cli1-xdr.c +++ b/rpc/xdr/src/cli1-xdr.c @@ -252,6 +252,8 @@ xdr_gf1_cli_probe_rsp (XDR *xdrs, gf1_cli_probe_rsp *objp)  		}  		 if (!xdr_string (xdrs, &objp->hostname, ~0))  			 return FALSE; +		 if (!xdr_string (xdrs, &objp->op_errstr, ~0)) +			 return FALSE;  		return TRUE;  	} else if (xdrs->x_op == XDR_DECODE) {  		buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); @@ -270,6 +272,8 @@ xdr_gf1_cli_probe_rsp (XDR *xdrs, gf1_cli_probe_rsp *objp)  		}  		 if (!xdr_string (xdrs, &objp->hostname, ~0))  			 return FALSE; +		 if (!xdr_string (xdrs, &objp->op_errstr, ~0)) +			 return FALSE;  	 return TRUE;  	} @@ -281,6 +285,8 @@ xdr_gf1_cli_probe_rsp (XDR *xdrs, gf1_cli_probe_rsp *objp)  		 return FALSE;  	 if (!xdr_string (xdrs, &objp->hostname, ~0))  		 return FALSE; +	 if (!xdr_string (xdrs, &objp->op_errstr, ~0)) +		 return FALSE;  	return TRUE;  } @@ -311,6 +317,8 @@ xdr_gf1_cli_deprobe_rsp (XDR *xdrs, gf1_cli_deprobe_rsp *objp)  		 return FALSE;  	 if (!xdr_string (xdrs, &objp->hostname, ~0))  		 return FALSE; +	 if (!xdr_string (xdrs, &objp->op_errstr, ~0)) +		 return FALSE;  	return TRUE;  } diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h index 234f0f7f797..b30fd740ae2 100644 --- a/rpc/xdr/src/cli1-xdr.h +++ b/rpc/xdr/src/cli1-xdr.h @@ -200,6 +200,7 @@ struct gf1_cli_probe_rsp {  	int op_errno;  	int port;  	char *hostname; +	char *op_errstr;  };  typedef struct gf1_cli_probe_rsp gf1_cli_probe_rsp; @@ -214,6 +215,7 @@ struct gf1_cli_deprobe_rsp {  	int op_ret;  	int op_errno;  	char *hostname; +	char *op_errstr;  };  typedef struct gf1_cli_deprobe_rsp gf1_cli_deprobe_rsp; diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x index 61af3a14cbf..cb22080cce3 100644 --- a/rpc/xdr/src/cli1-xdr.x +++ b/rpc/xdr/src/cli1-xdr.x @@ -135,6 +135,7 @@ enum gf_cli_status_type {          int     op_errno;  	int	port;          string  hostname<>; +        string  op_errstr<>;  }  ;   struct gf1_cli_deprobe_req { @@ -147,6 +148,7 @@ enum gf_cli_status_type {          int     op_ret;          int     op_errno;          string  hostname<>; +        string  op_errstr<>;  }  ;  struct gf1_cli_peer_list_req { diff --git a/rpc/xdr/src/glusterd1-xdr.c b/rpc/xdr/src/glusterd1-xdr.c index a5438d23e3f..28ab49b6f73 100644 --- a/rpc/xdr/src/glusterd1-xdr.c +++ b/rpc/xdr/src/glusterd1-xdr.c @@ -66,6 +66,55 @@ xdr_gd1_mgmt_probe_rsp (XDR *xdrs, gd1_mgmt_probe_rsp *objp)  	register int32_t *buf;          buf = NULL; + +	if (xdrs->x_op == XDR_ENCODE) { +		 if (!xdr_vector (xdrs, (char *)objp->uuid, 16, +			sizeof (u_char), (xdrproc_t) xdr_u_char)) +			 return FALSE; +		 if (!xdr_string (xdrs, &objp->hostname, ~0)) +			 return FALSE; +		buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); +		if (buf == NULL) { +			 if (!xdr_int (xdrs, &objp->port)) +				 return FALSE; +			 if (!xdr_int (xdrs, &objp->op_ret)) +				 return FALSE; +			 if (!xdr_int (xdrs, &objp->op_errno)) +				 return FALSE; + +		} else { +		IXDR_PUT_LONG(buf, objp->port); +		IXDR_PUT_LONG(buf, objp->op_ret); +		IXDR_PUT_LONG(buf, objp->op_errno); +		} +		 if (!xdr_string (xdrs, &objp->op_errstr, ~0)) +			 return FALSE; +		return TRUE; +	} else if (xdrs->x_op == XDR_DECODE) { +		 if (!xdr_vector (xdrs, (char *)objp->uuid, 16, +			sizeof (u_char), (xdrproc_t) xdr_u_char)) +			 return FALSE; +		 if (!xdr_string (xdrs, &objp->hostname, ~0)) +			 return FALSE; +		buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); +		if (buf == NULL) { +			 if (!xdr_int (xdrs, &objp->port)) +				 return FALSE; +			 if (!xdr_int (xdrs, &objp->op_ret)) +				 return FALSE; +			 if (!xdr_int (xdrs, &objp->op_errno)) +				 return FALSE; + +		} else { +		objp->port = IXDR_GET_LONG(buf); +		objp->op_ret = IXDR_GET_LONG(buf); +		objp->op_errno = IXDR_GET_LONG(buf); +		} +		 if (!xdr_string (xdrs, &objp->op_errstr, ~0)) +			 return FALSE; +	 return TRUE; +	} +  	 if (!xdr_vector (xdrs, (char *)objp->uuid, 16,  		sizeof (u_char), (xdrproc_t) xdr_u_char))  		 return FALSE; @@ -77,6 +126,8 @@ xdr_gd1_mgmt_probe_rsp (XDR *xdrs, gd1_mgmt_probe_rsp *objp)  		 return FALSE;  	 if (!xdr_int (xdrs, &objp->op_errno))  		 return FALSE; +	 if (!xdr_string (xdrs, &objp->op_errstr, ~0)) +		 return FALSE;  	return TRUE;  } diff --git a/rpc/xdr/src/glusterd1-xdr.h b/rpc/xdr/src/glusterd1-xdr.h index 14c41baffba..89de04ebef2 100644 --- a/rpc/xdr/src/glusterd1-xdr.h +++ b/rpc/xdr/src/glusterd1-xdr.h @@ -62,6 +62,7 @@ struct gd1_mgmt_probe_rsp {  	int port;  	int op_ret;  	int op_errno; +	char *op_errstr;  };  typedef struct gd1_mgmt_probe_rsp gd1_mgmt_probe_rsp; diff --git a/rpc/xdr/src/glusterd1-xdr.x b/rpc/xdr/src/glusterd1-xdr.x index c30c71e021a..fc1bb58b4a8 100644 --- a/rpc/xdr/src/glusterd1-xdr.x +++ b/rpc/xdr/src/glusterd1-xdr.x @@ -16,6 +16,7 @@          int     port;          int     op_ret;          int     op_errno; +        string op_errstr<>;  }  ;  struct gd1_mgmt_friend_req { diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index d7ac4fd4f2c..0e3c211b3f9 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -1779,6 +1779,11 @@ glusterd_handle_probe_query (rpcsvc_request_t *req)          uuid_copy (rsp.uuid, conf->uuid);          rsp.hostname = probe_req.hostname; +        /* +         *TODO: Fix this temporary assignment when the full probe errstr +         *      patch is added +         */ +        rsp.op_errstr = "";          ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,                                       (xdrproc_t)xdr_gd1_mgmt_probe_rsp); @@ -2383,6 +2388,11 @@ glusterd_xfer_cli_probe_resp (rpcsvc_request_t *req, int32_t op_ret,          rsp.op_errno = op_errno;          rsp.hostname = hostname;          rsp.port = port; +        /* +         *TODO: Fix this temprary assignment when the full probe errstr +         *      patch is added +         */ +        rsp.op_errstr = "";          ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,                                       (xdrproc_t)xdr_gf1_cli_probe_rsp); @@ -2404,6 +2414,11 @@ glusterd_xfer_cli_deprobe_resp (rpcsvc_request_t *req, int32_t op_ret,          rsp.op_ret = op_ret;          rsp.op_errno = op_errno;          rsp.hostname = hostname; +        /* +         *TODO: Fix this temporary assignment when the full deprobe errstr +         *      patch is added +         */ +        rsp.op_errstr = "";          ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,                                       (xdrproc_t)xdr_gf1_cli_deprobe_rsp);  | 
