diff options
author | Pranith K <pranithk@gluster.com> | 2010-10-29 03:39:56 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-10-29 03:42:19 -0700 |
commit | 9c29312628af743f16badb4bc820cbd31f2a9488 (patch) | |
tree | bcf25aa7bdd7f60be49370f6555e2eaa61572965 /rpc | |
parent | c1b80f0f590e2d7448b890b57e80f4a1b2e39a03 (diff) |
cli,mgmt/glusterd: fsm log implementation
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1966 (Unnecessarily verbose logs at the default log level)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1966
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/rpc-lib/src/protocol-common.h | 2 | ||||
-rw-r--r-- | rpc/xdr/src/cli1-xdr.c | 35 | ||||
-rw-r--r-- | rpc/xdr/src/cli1-xdr.h | 24 | ||||
-rw-r--r-- | rpc/xdr/src/cli1.c | 28 | ||||
-rw-r--r-- | rpc/xdr/src/cli1.h | 11 | ||||
-rw-r--r-- | rpc/xdr/src/cli1.x | 14 |
6 files changed, 106 insertions, 8 deletions
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h index bfd043e31..2fe70408e 100644 --- a/rpc/rpc-lib/src/protocol-common.h +++ b/rpc/rpc-lib/src/protocol-common.h @@ -104,6 +104,7 @@ enum gf_mgmt_procnum_ { GD_MGMT_CLI_LOG_ROTATE, GD_MGMT_CLI_SYNC_VOLUME, GD_MGMT_CLI_RESET_VOLUME, + GD_MGMT_CLI_FSM_LOG, GD_MGMT_MAXVALUE, }; @@ -133,6 +134,7 @@ enum gf_cli_procnum { GF1_CLI_PMAP_PORTBYBRICK, GF1_CLI_SYNC_VOLUME, GF1_CLI_RESET_VOLUME, + GF1_CLI_FSM_LOG, GF1_CLI_MAXVALUE, }; diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c index 713648ffa..2db0c7cc6 100644 --- a/rpc/xdr/src/cli1-xdr.c +++ b/rpc/xdr/src/cli1-xdr.c @@ -25,6 +25,7 @@ #include "cli1.h" #include "compat.h" + bool_t xdr_gf1_cluster_type (XDR *xdrs, gf1_cluster_type *objp) { @@ -316,9 +317,9 @@ xdr_gf1_cli_stop_vol_rsp (XDR *xdrs, gf1_cli_stop_vol_rsp *objp) return FALSE; if (!xdr_string (xdrs, &objp->volname, ~0)) return FALSE; - if (!xdr_string (xdrs, &objp->op_errstr, ~0)) - return FALSE; - return TRUE; + if (!xdr_string (xdrs, &objp->op_errstr, ~0)) + return FALSE; + return TRUE; } bool_t @@ -512,8 +513,8 @@ xdr_gf1_cli_set_vol_rsp (XDR *xdrs, gf1_cli_set_vol_rsp *objp) return FALSE; if (!xdr_string (xdrs, &objp->volname, ~0)) return FALSE; - if (!xdr_string (xdrs, &objp->op_errstr, ~0)) - return FALSE; + if (!xdr_string (xdrs, &objp->op_errstr, ~0)) + return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) return FALSE; return TRUE; @@ -618,3 +619,27 @@ xdr_gf1_cli_sync_volume_rsp (XDR *xdrs, gf1_cli_sync_volume_rsp *objp) return FALSE; return TRUE; } + +bool_t +xdr_gf1_cli_fsm_log_req (XDR *xdrs, gf1_cli_fsm_log_req *objp) +{ + + if (!xdr_string (xdrs, &objp->name, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf1_cli_fsm_log_rsp (XDR *xdrs, gf1_cli_fsm_log_rsp *objp) +{ + + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_string (xdrs, &objp->op_errstr, ~0)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->fsm_log.fsm_log_val, (u_int *) &objp->fsm_log.fsm_log_len, ~0)) + return FALSE; + return TRUE; +} diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h index 5bc3b03d2..38b5843fa 100644 --- a/rpc/xdr/src/cli1-xdr.h +++ b/rpc/xdr/src/cli1-xdr.h @@ -194,7 +194,7 @@ struct gf1_cli_stop_vol_rsp { int op_ret; int op_errno; char *volname; - char *op_errstr; + char *op_errstr; }; typedef struct gf1_cli_stop_vol_rsp gf1_cli_stop_vol_rsp; @@ -314,7 +314,7 @@ struct gf1_cli_set_vol_rsp { int op_ret; int op_errno; char *volname; - char *op_errstr; + char *op_errstr; struct { u_int dict_len; char *dict_val; @@ -376,6 +376,22 @@ struct gf1_cli_sync_volume_rsp { }; typedef struct gf1_cli_sync_volume_rsp gf1_cli_sync_volume_rsp; +struct gf1_cli_fsm_log_req { + char *name; +}; +typedef struct gf1_cli_fsm_log_req gf1_cli_fsm_log_req; + +struct gf1_cli_fsm_log_rsp { + int op_ret; + int op_errno; + char *op_errstr; + struct { + u_int fsm_log_len; + char *fsm_log_val; + } fsm_log; +}; +typedef struct gf1_cli_fsm_log_rsp gf1_cli_fsm_log_rsp; + /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) @@ -423,6 +439,8 @@ 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*); extern bool_t xdr_gf1_cli_sync_volume_rsp (XDR *, gf1_cli_sync_volume_rsp*); +extern bool_t xdr_gf1_cli_fsm_log_req (XDR *, gf1_cli_fsm_log_req*); +extern bool_t xdr_gf1_cli_fsm_log_rsp (XDR *, gf1_cli_fsm_log_rsp*); #else /* K&R C */ extern bool_t xdr_gf1_cluster_type (); @@ -469,6 +487,8 @@ extern bool_t xdr_gf1_cli_log_locate_rsp (); extern bool_t xdr_gf1_cli_log_rotate_req (); extern bool_t xdr_gf1_cli_log_rotate_rsp (); extern bool_t xdr_gf1_cli_sync_volume_rsp (); +extern bool_t xdr_gf1_cli_fsm_log_req (); +extern bool_t xdr_gf1_cli_fsm_log_rsp (); #endif /* K&R C */ diff --git a/rpc/xdr/src/cli1.c b/rpc/xdr/src/cli1.c index 41a97f983..14f383941 100644 --- a/rpc/xdr/src/cli1.c +++ b/rpc/xdr/src/cli1.c @@ -581,3 +581,31 @@ gf_xdr_from_cli_sync_volume_rsp (struct iovec outmsg, void *args) return xdr_serialize_generic (outmsg, (void *)args, (xdrproc_t)xdr_gf1_cli_sync_volume_rsp); } + +ssize_t +gf_xdr_to_cli_fsm_log_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gf1_cli_fsm_log_req); +} + +ssize_t +gf_xdr_from_cli_fsm_log_req (struct iovec outmsg, void *args) +{ + return xdr_serialize_generic (outmsg, (void *)args, + (xdrproc_t)xdr_gf1_cli_fsm_log_req); +} + +ssize_t +gf_xdr_to_cli_fsm_log_rsp (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gf1_cli_fsm_log_rsp); +} + +ssize_t +gf_xdr_from_cli_fsm_log_rsp (struct iovec outmsg, void *args) +{ + return xdr_serialize_generic (outmsg, (void *)args, + (xdrproc_t)xdr_gf1_cli_fsm_log_rsp); +} diff --git a/rpc/xdr/src/cli1.h b/rpc/xdr/src/cli1.h index 8d9e1674a..d0c43d802 100644 --- a/rpc/xdr/src/cli1.h +++ b/rpc/xdr/src/cli1.h @@ -258,4 +258,15 @@ gf_xdr_to_cli_sync_volume_rsp (struct iovec inmsg, void *args); ssize_t gf_xdr_from_cli_sync_volume_rsp (struct iovec outmsg, void *args); +ssize_t +gf_xdr_to_cli_fsm_log_req (struct iovec inmsg, void *args); + +ssize_t +gf_xdr_from_cli_fsm_log_req (struct iovec outmsg, void *args); + +ssize_t +gf_xdr_to_cli_fsm_log_rsp (struct iovec inmsg, void *args); + +ssize_t +gf_xdr_from_cli_fsm_log_rsp (struct iovec outmsg, void *args); #endif /* !_CLI1_H */ diff --git a/rpc/xdr/src/cli1.x b/rpc/xdr/src/cli1.x index d729548ed..0ac34aea1 100644 --- a/rpc/xdr/src/cli1.x +++ b/rpc/xdr/src/cli1.x @@ -10,7 +10,8 @@ GF_REPLACE_OP_COMMIT, GF_REPLACE_OP_PAUSE, GF_REPLACE_OP_ABORT, - GF_REPLACE_OP_STATUS + GF_REPLACE_OP_STATUS, + GF_REPLACE_OP_COMMIT_FORCE } ; enum gf1_cli_friends_list { @@ -269,3 +270,14 @@ struct gf1_cli_sync_volume_rsp { int op_errno; string op_errstr<>; }; + +struct gf1_cli_fsm_log_req { + string name<>; +}; + +struct gf1_cli_fsm_log_rsp { + int op_ret; + int op_errno; + string op_errstr<>; + opaque fsm_log<>; +}; |