summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src/server.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 /xlators/protocol/server/src/server.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 'xlators/protocol/server/src/server.c')
-rw-r--r--xlators/protocol/server/src/server.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index ec91ba7c2..3b1f46ad3 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -508,7 +508,7 @@ reconfigure (xlator_t *this, dict_t *options)
gf_boolean_t trace;
data_t *data;
int ret = 0;
-
+ char *statedump_path = NULL;
conf = this->private;
if (!conf) {
@@ -536,6 +536,27 @@ reconfigure (xlator_t *this, dict_t *options)
" to %d", conf->trace);
}
+
+ /*ret = dict_get_str (options, "statedump-path", &statedump_path);
+ if (!ret) {
+ gf_path_strip_trailing_slashes (statedump_path);
+ if (this->ctx->statedump_path)
+ GF_FREE (this->ctx->statedump_path);
+ this->ctx->statedump_path = gf_strdup (statedump_path);
+ }*/
+ GF_OPTION_RECONF ("statedump-path", statedump_path,
+ options, path, out);
+ if (!statedump_path) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Error while reconfiguring statedump path");
+ ret = -1;
+ goto out;
+ }
+ gf_path_strip_trailing_slashes (statedump_path);
+ if (this->ctx->statedump_path)
+ GF_FREE (this->ctx->statedump_path);
+ this->ctx->statedump_path = gf_strdup (statedump_path);
+
if (!conf->auth_modules)
conf->auth_modules = dict_new ();
@@ -582,7 +603,7 @@ init (xlator_t *this)
int32_t ret = -1;
server_conf_t *conf = NULL;
rpcsvc_listener_t *listener = NULL;
-
+ char *statedump_path = NULL;
GF_VALIDATE_OR_GOTO ("init", this, out);
if (this->children == NULL) {
@@ -614,6 +635,22 @@ init (xlator_t *this)
if (ret)
conf->conf_dir = CONFDIR;
+ /*ret = dict_get_str (this->options, "statedump-path", &statedump_path);
+ if (!ret) {
+ gf_path_strip_trailing_slashes (statedump_path);
+ this->ctx->statedump_path = statedump_path;
+ }*/
+ GF_OPTION_INIT ("statedump-path", statedump_path, path, out);
+ if (statedump_path) {
+ gf_path_strip_trailing_slashes (statedump_path);
+ this->ctx->statedump_path = gf_strdup (statedump_path);
+ } else {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Error setting statedump path");
+ ret = -1;
+ goto out;
+ }
+
/* Authentication modules */
conf->auth_modules = dict_new ();
GF_VALIDATE_OR_GOTO(this->name, conf->auth_modules, out);
@@ -818,5 +855,9 @@ struct volume_options options[] = {
{ .key = {"rpc-auth-allow-insecure"},
.type = GF_OPTION_TYPE_BOOL,
},
+ { .key = {"statedump-path"},
+ .type = GF_OPTION_TYPE_PATH,
+ .default_value = "/tmp"
+ },
{ .key = {NULL} },
};