summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-rpc-ops.c
diff options
context:
space:
mode:
authorKaushal M <kaushal@gluster.com>2011-09-05 14:33:43 +0530
committerVijay Bellur <vijay@gluster.com>2011-09-27 06:45:10 -0700
commit45172a5415abc6b2f17eea74d51805ac85cc0072 (patch)
treee2576cf6cda22bd0f3109bc358c51fb419f3a390 /cli/src/cli-rpc-ops.c
parent16b7e3bf201686ca03f8c35c20295e05abe52df8 (diff)
cli : new volume statedump command
Changes: 1. Add a new 'volume statedump' command, that performs statedumps of all the bricks in the volume and saves them in a specified location. 2. Add new server option 'server.statedump-path'. 3. Remove multiple function definitions in glusterd.h Statedump Information: The 'volume statedump' command performs statedumps on all the bricks in a given volume. The syntax of the command is, gluster volume statedump <VOLNAME> [type]...... Types include, * all * mem * iobuf * callpool * priv * fd * inode Defaults to 'all' when no type is specified. The statedump files are created by default in /tmp directory of the server on which the bricks are present. This path can be changed by setting the 'server.statedump-path' option. The statedump files will be named as, <brick-name>.<pid of brick process>.dump Change-Id: I01c0e1a8aad490da818e086d89f292bd2ed06fd4 BUG: 1964 Reviewed-on: http://review.gluster.com/321 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amar@gluster.com>
Diffstat (limited to 'cli/src/cli-rpc-ops.c')
-rw-r--r--cli/src/cli-rpc-ops.c72
1 files changed, 71 insertions, 1 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index b58e0317363..1e77ae0ab71 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -4000,7 +4000,76 @@ out:
return ret;
}
+int32_t
+gf_cli3_1_statedump_volume_cbk (struct rpc_req *req, struct iovec *iov,
+ int count, void *myframe)
+{
+ gf1_cli_statedump_vol_rsp rsp = {0,};
+ int ret = -1;
+
+ if (-1 == req->rpc_status)
+ goto out;
+ ret = xdr_to_generic (*iov, &rsp,
+ (xdrproc_t)xdr_gf1_cli_statedump_vol_rsp);
+ if (ret < 0) {
+ gf_log (THIS->name, GF_LOG_ERROR, "XDR decoding failed");
+ goto out;
+ }
+ gf_log ("cli", GF_LOG_DEBUG, "Recieved response to statedump");
+ if (rsp.op_ret)
+ cli_out ("%s", rsp.op_errstr);
+ else
+ cli_out ("Volume statedump sucessful");
+
+ ret = rsp.op_ret;
+
+out:
+ cli_cmd_broadcast_response (ret);
+ return ret;
+}
+
+int32_t
+gf_cli3_1_statedump_volume (call_frame_t *frame, xlator_t *this,
+ void *data)
+{
+ gf1_cli_statedump_vol_req req = {0,};
+ dict_t *options = NULL;
+ char *volname = NULL;
+ char *option_str = NULL;
+ int option_cnt = 0;
+ int ret = -1;
+
+ if (!frame || !this || !data)
+ goto out;
+
+ options = data;
+
+ ret = dict_get_str (options, "volname", &volname);
+ if (ret)
+ goto out;
+ req.volname = volname;
+
+ ret = dict_get_str (options, "options", &option_str);
+ if (ret)
+ goto out;
+ req.options = option_str;
+
+ ret = dict_get_int32 (options, "option-cnt", &option_cnt);
+ if (ret)
+ goto out;
+ req.option_cnt = option_cnt;
+ ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
+ GLUSTER_CLI_STATEDUMP_VOLUME, NULL,
+ this, gf_cli3_1_statedump_volume_cbk,
+ (xdrproc_t)xdr_gf1_cli_statedump_vol_req);
+
+out:
+ if (options)
+ dict_destroy (options);
+ gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
+ return ret;
+}
struct rpc_clnt_procedure gluster_cli_actors[GLUSTER_CLI_MAXVALUE] = {
[GLUSTER_CLI_NULL] = {"NULL", NULL },
@@ -4036,7 +4105,8 @@ struct rpc_clnt_procedure gluster_cli_actors[GLUSTER_CLI_MAXVALUE] = {
[GLUSTER_CLI_STATUS_VOLUME] = {"STATUS_VOLUME", gf_cli3_1_status_volume},
[GLUSTER_CLI_MOUNT] = {"MOUNT", gf_cli3_1_mount},
[GLUSTER_CLI_UMOUNT] = {"UMOUNT", gf_cli3_1_umount},
- [GLUSTER_CLI_HEAL_VOLUME] = {"HEAL_VOLUME", gf_cli3_1_heal_volume}
+ [GLUSTER_CLI_HEAL_VOLUME] = {"HEAL_VOLUME", gf_cli3_1_heal_volume},
+ [GLUSTER_CLI_STATEDUMP_VOLUME] = {"STATEDUMP_VOLUME", gf_cli3_1_statedump_volume},
};
struct rpc_clnt_program cli_prog = {