diff options
author | Kaushal M <kaushal@redhat.com> | 2012-09-03 15:58:26 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-10-30 10:18:58 -0700 |
commit | d7cc779da48e484d0edb7bfbd903f941d0ccca32 (patch) | |
tree | 1d4cc1e5e3772b35a3861538d10da6229ffc77f8 /rpc | |
parent | 5c272f4d1c4ae67a3cf5a6af17518c82f520c1de (diff) |
glusterd: op-version handshake implementation
Brings in a new rpc program MGMT_HANDSHAKE, which implements the op-version
handshake. This is required for bringing in the op-version feature as described
in http://www.gluster.org/community/documentation/index.php/Features/Opversion
Change-Id: I4333fd2714dbbd3a2a3fca5862cbb3c56615529e
BUG: 814534
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/3688
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/rpc-lib/src/protocol-common.h | 13 | ||||
-rw-r--r-- | rpc/xdr/src/glusterfs3-xdr.c | 78 | ||||
-rw-r--r-- | rpc/xdr/src/glusterfs3-xdr.h | 66 | ||||
-rw-r--r-- | rpc/xdr/src/glusterfs3-xdr.x | 32 |
4 files changed, 129 insertions, 60 deletions
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h index 603bda5826c..899844cd44c 100644 --- a/rpc/rpc-lib/src/protocol-common.h +++ b/rpc/rpc-lib/src/protocol-common.h @@ -185,6 +185,13 @@ enum glusterd_brick_procnum { GLUSTERD_BRICK_MAXVALUE, }; +enum glusterd_mgmt_hndsk_procnum { + GD_MGMT_HNDSK_NULL, + GD_MGMT_HNDSK_VERSIONS, + GD_MGMT_HNDSK_VERSIONS_ACK, + GD_MGMT_HNDSK_MAXVALUE, +}; + typedef enum { GF_AFR_OP_INVALID, GF_AFR_OP_HEAL_INDEX, @@ -196,7 +203,7 @@ typedef enum { } gf_xl_afr_op_t ; #define GLUSTER_HNDSK_PROGRAM 14398633 /* Completely random */ -#define GLUSTER_HNDSK_VERSION 2 /* 0.0.1 */ +#define GLUSTER_HNDSK_VERSION 2 /* 0.0.2 */ #define GLUSTER_PMAP_PROGRAM 34123456 #define GLUSTER_PMAP_VERSION 1 @@ -221,4 +228,8 @@ typedef enum { #define GD_BRICK_PROGRAM 4867634 /*Completely random*/ #define GD_BRICK_VERSION 2 +/* OP-VERSION handshake */ +#define GD_MGMT_HNDSK_PROGRAM 1239873 /* Completely random */ +#define GD_MGMT_HNDSK_VERSION 1 + #endif /* !_PROTOCOL_COMMON_H */ diff --git a/rpc/xdr/src/glusterfs3-xdr.c b/rpc/xdr/src/glusterfs3-xdr.c index 9d55f89c2fe..a502b2ea16c 100644 --- a/rpc/xdr/src/glusterfs3-xdr.c +++ b/rpc/xdr/src/glusterfs3-xdr.c @@ -1213,32 +1213,6 @@ xdr_gfs3_readdirp_req (XDR *xdrs, gfs3_readdirp_req *objp) } bool_t -xdr_gf_setvolume_req (XDR *xdrs, gf_setvolume_req *objp) -{ - register int32_t *buf; - buf = NULL; - - if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) - return FALSE; - return TRUE; -} - -bool_t -xdr_gf_setvolume_rsp (XDR *xdrs, gf_setvolume_rsp *objp) -{ - register int32_t *buf; - buf = NULL; - - if (!xdr_int (xdrs, &objp->op_ret)) - return FALSE; - if (!xdr_int (xdrs, &objp->op_errno)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) - return FALSE; - return TRUE; -} - -bool_t xdr_gfs3_access_req (XDR *xdrs, gfs3_access_req *objp) { register int32_t *buf; @@ -1612,6 +1586,32 @@ xdr_gfs3_rchecksum_rsp (XDR *xdrs, gfs3_rchecksum_rsp *objp) } bool_t +xdr_gf_setvolume_req (XDR *xdrs, gf_setvolume_req *objp) +{ + register int32_t *buf; + buf = NULL; + + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_setvolume_rsp (XDR *xdrs, gf_setvolume_rsp *objp) +{ + register int32_t *buf; + buf = NULL; + + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t xdr_gf_getspec_req (XDR *xdrs, gf_getspec_req *objp) { register int32_t *buf; @@ -1644,6 +1644,32 @@ xdr_gf_getspec_rsp (XDR *xdrs, gf_getspec_rsp *objp) } bool_t +xdr_gf_mgmt_hndsk_req (XDR *xdrs, gf_mgmt_hndsk_req *objp) +{ + register int32_t *buf; + buf = NULL; + + if (!xdr_bytes (xdrs, (char **)&objp->hndsk.hndsk_val, (u_int *) &objp->hndsk.hndsk_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_mgmt_hndsk_rsp (XDR *xdrs, gf_mgmt_hndsk_rsp *objp) +{ + register int32_t *buf; + buf = NULL; + + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->hndsk.hndsk_val, (u_int *) &objp->hndsk.hndsk_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t xdr_gf_log_req (XDR *xdrs, gf_log_req *objp) { register int32_t *buf; diff --git a/rpc/xdr/src/glusterfs3-xdr.h b/rpc/xdr/src/glusterfs3-xdr.h index a68d1a6784e..0268d1a144a 100644 --- a/rpc/xdr/src/glusterfs3-xdr.h +++ b/rpc/xdr/src/glusterfs3-xdr.h @@ -731,24 +731,6 @@ struct gfs3_readdirp_req { }; typedef struct gfs3_readdirp_req gfs3_readdirp_req; -struct gf_setvolume_req { - struct { - u_int dict_len; - char *dict_val; - } dict; -}; -typedef struct gf_setvolume_req gf_setvolume_req; - -struct gf_setvolume_rsp { - int op_ret; - int op_errno; - struct { - u_int dict_len; - char *dict_val; - } dict; -}; -typedef struct gf_setvolume_rsp gf_setvolume_rsp; - struct gfs3_access_req { char gfid[16]; u_int mask; @@ -931,6 +913,24 @@ struct gfs3_rchecksum_rsp { }; typedef struct gfs3_rchecksum_rsp gfs3_rchecksum_rsp; +struct gf_setvolume_req { + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gf_setvolume_req gf_setvolume_req; + +struct gf_setvolume_rsp { + int op_ret; + int op_errno; + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gf_setvolume_rsp gf_setvolume_rsp; + struct gf_getspec_req { u_int flags; char *key; @@ -952,6 +952,24 @@ struct gf_getspec_rsp { }; typedef struct gf_getspec_rsp gf_getspec_rsp; +struct gf_mgmt_hndsk_req { + struct { + u_int hndsk_len; + char *hndsk_val; + } hndsk; +}; +typedef struct gf_mgmt_hndsk_req gf_mgmt_hndsk_req; + +struct gf_mgmt_hndsk_rsp { + int op_ret; + int op_errno; + struct { + u_int hndsk_len; + char *hndsk_val; + } hndsk; +}; +typedef struct gf_mgmt_hndsk_rsp gf_mgmt_hndsk_rsp; + struct gf_log_req { struct { u_int msg_len; @@ -1151,8 +1169,6 @@ extern bool_t xdr_gfs3_opendir_rsp (XDR *, gfs3_opendir_rsp*); extern bool_t xdr_gfs3_fsyncdir_req (XDR *, gfs3_fsyncdir_req*); extern bool_t xdr_gfs3_readdir_req (XDR *, gfs3_readdir_req*); extern bool_t xdr_gfs3_readdirp_req (XDR *, gfs3_readdirp_req*); -extern bool_t xdr_gf_setvolume_req (XDR *, gf_setvolume_req*); -extern bool_t xdr_gf_setvolume_rsp (XDR *, gf_setvolume_rsp*); extern bool_t xdr_gfs3_access_req (XDR *, gfs3_access_req*); extern bool_t xdr_gfs3_create_req (XDR *, gfs3_create_req*); extern bool_t xdr_gfs3_create_rsp (XDR *, gfs3_create_rsp*); @@ -1168,8 +1184,12 @@ extern bool_t xdr_gfs3_fsetattr_req (XDR *, gfs3_fsetattr_req*); extern bool_t xdr_gfs3_fsetattr_rsp (XDR *, gfs3_fsetattr_rsp*); extern bool_t xdr_gfs3_rchecksum_req (XDR *, gfs3_rchecksum_req*); extern bool_t xdr_gfs3_rchecksum_rsp (XDR *, gfs3_rchecksum_rsp*); +extern bool_t xdr_gf_setvolume_req (XDR *, gf_setvolume_req*); +extern bool_t xdr_gf_setvolume_rsp (XDR *, gf_setvolume_rsp*); extern bool_t xdr_gf_getspec_req (XDR *, gf_getspec_req*); extern bool_t xdr_gf_getspec_rsp (XDR *, gf_getspec_rsp*); +extern bool_t xdr_gf_mgmt_hndsk_req (XDR *, gf_mgmt_hndsk_req*); +extern bool_t xdr_gf_mgmt_hndsk_rsp (XDR *, gf_mgmt_hndsk_rsp*); extern bool_t xdr_gf_log_req (XDR *, gf_log_req*); extern bool_t xdr_gf_notify_req (XDR *, gf_notify_req*); extern bool_t xdr_gf_notify_rsp (XDR *, gf_notify_rsp*); @@ -1243,8 +1263,6 @@ extern bool_t xdr_gfs3_opendir_rsp (); extern bool_t xdr_gfs3_fsyncdir_req (); extern bool_t xdr_gfs3_readdir_req (); extern bool_t xdr_gfs3_readdirp_req (); -extern bool_t xdr_gf_setvolume_req (); -extern bool_t xdr_gf_setvolume_rsp (); extern bool_t xdr_gfs3_access_req (); extern bool_t xdr_gfs3_create_req (); extern bool_t xdr_gfs3_create_rsp (); @@ -1260,8 +1278,12 @@ extern bool_t xdr_gfs3_fsetattr_req (); extern bool_t xdr_gfs3_fsetattr_rsp (); extern bool_t xdr_gfs3_rchecksum_req (); extern bool_t xdr_gfs3_rchecksum_rsp (); +extern bool_t xdr_gf_setvolume_req (); +extern bool_t xdr_gf_setvolume_rsp (); extern bool_t xdr_gf_getspec_req (); extern bool_t xdr_gf_getspec_rsp (); +extern bool_t xdr_gf_mgmt_hndsk_req (); +extern bool_t xdr_gf_mgmt_hndsk_rsp (); extern bool_t xdr_gf_log_req (); extern bool_t xdr_gf_notify_req (); extern bool_t xdr_gf_notify_rsp (); diff --git a/rpc/xdr/src/glusterfs3-xdr.x b/rpc/xdr/src/glusterfs3-xdr.x index ad261423d2e..063f302d933 100644 --- a/rpc/xdr/src/glusterfs3-xdr.x +++ b/rpc/xdr/src/glusterfs3-xdr.x @@ -460,15 +460,6 @@ struct gfs3_finodelk_req { } ; - struct gf_setvolume_req { - opaque dict<>; -} ; - struct gf_setvolume_rsp { - int op_ret; - int op_errno; - opaque dict<>; -} ; - struct gfs3_access_req { opaque gfid[16]; unsigned int mask; @@ -590,6 +581,16 @@ struct gfs3_fstat_req { } ; + struct gf_setvolume_req { + opaque dict<>; +} ; + struct gf_setvolume_rsp { + int op_ret; + int op_errno; + opaque dict<>; +} ; + + struct gf_getspec_req { unsigned int flags; string key<>; @@ -602,10 +603,19 @@ struct gfs3_fstat_req { opaque xdata<>; /* Extra data */ } ; + struct gf_mgmt_hndsk_req { + opaque hndsk<>; +} ; + + struct gf_mgmt_hndsk_rsp { + int op_ret; + int op_errno; + opaque hndsk<>; +} ; struct gf_log_req { - opaque msg<>; -}; + opaque msg<>; +} ; struct gf_notify_req { unsigned int flags; |