diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2010-10-03 02:41:29 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-10-03 03:05:03 -0700 |
commit | 609a89ceace25a0a81d0a9cafde3a4d1afd1b916 (patch) | |
tree | 0205b67be6e1e2f33e9a0c9c1ca4ea0737ebff05 /rpc | |
parent | 53b8c7470f9e40c60c5eebd1fbad5c6d274f7ee5 (diff) |
mgmt/Glusterd: new command volume reset <volname>, volume set enhancements
- Write the reconfigured options in 'info' file to make it persistant
- Implementation of volume set <volname> history
- Implementation of volume reset <volname>
Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1159 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1159
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/rpc-lib/src/protocol-common.h | 2 | ||||
-rw-r--r-- | rpc/xdr/src/cli1-xdr.c | 32 | ||||
-rw-r--r-- | rpc/xdr/src/cli1-xdr.h | 27 | ||||
-rw-r--r-- | rpc/xdr/src/cli1.c | 30 | ||||
-rw-r--r-- | rpc/xdr/src/cli1.h | 12 | ||||
-rw-r--r-- | rpc/xdr/src/cli1.x | 15 |
6 files changed, 115 insertions, 3 deletions
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h index a84c1eb78..40283bf42 100644 --- a/rpc/rpc-lib/src/protocol-common.h +++ b/rpc/rpc-lib/src/protocol-common.h @@ -103,6 +103,7 @@ enum gf_mgmt_procnum_ { GD_MGMT_CLI_LOG_LOCATE, GD_MGMT_CLI_LOG_ROTATE, GD_MGMT_CLI_SYNC_VOLUME, + GD_MGMT_CLI_RESET_VOLUME, GD_MGMT_MAXVALUE, }; @@ -131,6 +132,7 @@ enum gf_cli_procnum { GF1_CLI_GETSPEC, GF1_CLI_PMAP_PORTBYBRICK, GF1_CLI_SYNC_VOLUME, + GF1_CLI_RESET_VOLUME, GF1_CLI_MAXVALUE, }; diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c index cdf7be28d..334cd26de 100644 --- a/rpc/xdr/src/cli1-xdr.c +++ b/rpc/xdr/src/cli1-xdr.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com> + Copyright (c) 2007-2010 Gluster, Inc. <http://www.gluster.com> This file is part of GlusterFS. GlusterFS is free software; you can redistribute it and/or modify @@ -93,7 +93,7 @@ xdr_gf1_cli_probe_req (XDR *xdrs, gf1_cli_probe_req *objp) bool_t xdr_gf1_cli_probe_rsp (XDR *xdrs, gf1_cli_probe_rsp *objp) { - register int32_t *buf; + register int32_t *buf; if (xdrs->x_op == XDR_ENCODE) { @@ -464,6 +464,32 @@ xdr_gf1_cli_replace_brick_rsp (XDR *xdrs, gf1_cli_replace_brick_rsp *objp) } bool_t +xdr_gf1_cli_reset_vol_req (XDR *xdrs, gf1_cli_reset_vol_req *objp) +{ + + if (!xdr_string (xdrs, &objp->volname, ~0)) + 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_gf1_cli_reset_vol_rsp (XDR *xdrs, gf1_cli_reset_vol_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->volname, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->op_errstr, ~0)) + return FALSE; + return TRUE; +} + +bool_t xdr_gf1_cli_set_vol_req (XDR *xdrs, gf1_cli_set_vol_req *objp) { @@ -484,6 +510,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_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; return TRUE; } diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h index 9988d54f9..7369ba866 100644 --- a/rpc/xdr/src/cli1-xdr.h +++ b/rpc/xdr/src/cli1-xdr.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com> + Copyright (c) 2007-2010 Gluster, Inc. <http://www.gluster.com> This file is part of GlusterFS. GlusterFS is free software; you can redistribute it and/or modify @@ -282,6 +282,23 @@ struct gf1_cli_replace_brick_rsp { }; typedef struct gf1_cli_replace_brick_rsp gf1_cli_replace_brick_rsp; +struct gf1_cli_reset_vol_req { + char *volname; + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gf1_cli_reset_vol_req gf1_cli_reset_vol_req; + +struct gf1_cli_reset_vol_rsp { + int op_ret; + int op_errno; + char *volname; + char *op_errstr; +}; +typedef struct gf1_cli_reset_vol_rsp gf1_cli_reset_vol_rsp; + struct gf1_cli_set_vol_req { char *volname; struct { @@ -295,6 +312,10 @@ struct gf1_cli_set_vol_rsp { int op_ret; int op_errno; char *volname; + struct { + u_int dict_len; + char *dict_val; + } dict; }; typedef struct gf1_cli_set_vol_rsp gf1_cli_set_vol_rsp; @@ -387,6 +408,8 @@ extern bool_t xdr_gf1_cli_remove_brick_req (XDR *, gf1_cli_remove_brick_req*); extern bool_t xdr_gf1_cli_remove_brick_rsp (XDR *, gf1_cli_remove_brick_rsp*); extern bool_t xdr_gf1_cli_replace_brick_req (XDR *, gf1_cli_replace_brick_req*); extern bool_t xdr_gf1_cli_replace_brick_rsp (XDR *, gf1_cli_replace_brick_rsp*); +extern bool_t xdr_gf1_cli_reset_vol_req (XDR *, gf1_cli_reset_vol_req*); +extern bool_t xdr_gf1_cli_reset_vol_rsp (XDR *, gf1_cli_reset_vol_rsp*); extern bool_t xdr_gf1_cli_set_vol_req (XDR *, gf1_cli_set_vol_req*); extern bool_t xdr_gf1_cli_set_vol_rsp (XDR *, gf1_cli_set_vol_rsp*); extern bool_t xdr_gf1_cli_log_filename_req (XDR *, gf1_cli_log_filename_req*); @@ -431,6 +454,8 @@ extern bool_t xdr_gf1_cli_remove_brick_req (); extern bool_t xdr_gf1_cli_remove_brick_rsp (); extern bool_t xdr_gf1_cli_replace_brick_req (); extern bool_t xdr_gf1_cli_replace_brick_rsp (); +extern bool_t xdr_gf1_cli_reset_vol_req (); +extern bool_t xdr_gf1_cli_reset_vol_rsp (); extern bool_t xdr_gf1_cli_set_vol_req (); extern bool_t xdr_gf1_cli_set_vol_rsp (); extern bool_t xdr_gf1_cli_log_filename_req (); diff --git a/rpc/xdr/src/cli1.c b/rpc/xdr/src/cli1.c index 22b74fd7d..41a97f983 100644 --- a/rpc/xdr/src/cli1.c +++ b/rpc/xdr/src/cli1.c @@ -408,6 +408,36 @@ gf_xdr_from_cli_replace_brick_req (struct iovec outmsg, void *req) } ssize_t +gf_xdr_serialize_cli_reset_vol_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gf1_cli_reset_vol_rsp); + +} + +ssize_t +gf_xdr_to_cli_reset_vol_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gf1_cli_reset_vol_req); +} + +ssize_t +gf_xdr_to_cli_reset_vol_rsp (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gf1_cli_reset_vol_rsp); +} + + +ssize_t +gf_xdr_from_cli_reset_vol_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gf1_cli_reset_vol_req); +} + +ssize_t gf_xdr_serialize_cli_set_vol_rsp (struct iovec outmsg, void *rsp) { return xdr_serialize_generic (outmsg, (void *)rsp, diff --git a/rpc/xdr/src/cli1.h b/rpc/xdr/src/cli1.h index ee2254001..8d9e1674a 100644 --- a/rpc/xdr/src/cli1.h +++ b/rpc/xdr/src/cli1.h @@ -174,6 +174,18 @@ ssize_t gf_xdr_from_cli_replace_brick_req (struct iovec outmsg, void *req); ssize_t +gf_xdr_serialize_cli_reset_vol_rsp (struct iovec outmsg, void *rsp); + +ssize_t +gf_xdr_to_cli_reset_vol_req (struct iovec inmsg, void *args); + +ssize_t +gf_xdr_to_cli_reset_vol_rsp (struct iovec inmsg, void *args); + +ssize_t +gf_xdr_from_cli_reset_vol_req (struct iovec outmsg, void *req); + +ssize_t gf_xdr_serialize_cli_set_vol_rsp (struct iovec outmsg, void *rsp); ssize_t diff --git a/rpc/xdr/src/cli1.x b/rpc/xdr/src/cli1.x index 31a996861..b43bc46d2 100644 --- a/rpc/xdr/src/cli1.x +++ b/rpc/xdr/src/cli1.x @@ -194,6 +194,20 @@ struct gf1_cli_get_vol_rsp { string status<>; } ; +struct gf1_cli_reset_vol_req { + string volname<>; + opaque dict<>; +} ; + + + struct gf1_cli_reset_vol_rsp { + int op_ret; + int op_errno; + string volname<>; + string op_errstr<>; +} ; + + struct gf1_cli_set_vol_req { string volname<>; @@ -205,6 +219,7 @@ struct gf1_cli_set_vol_req { int op_ret; int op_errno; string volname<>; + opaque dict<>; } ; struct gf1_cli_log_filename_req { |