summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Bellur <vijay@gluster.com>2010-10-30 12:11:36 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-10-30 21:23:18 -0700
commit961d5fb6025f4901d63be8cfc8062bd8e2093021 (patch)
tree92a17083475cb3e958875c563f2f51a523ad083a
parent586000144be8919a234939ad43b04394d5f2636e (diff)
mgmt/glusterd: Honor log filename set during add-brick
Signed-off-by: Vijay Bellur <vijay@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2042 (No volume log files found in the specified directory for the newly added bricks) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2042
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c18
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c8
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h1
3 files changed, 21 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 93f6fc18851..b20f6bd6eba 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -3559,9 +3559,20 @@ glusterd_op_log_filename (gd1_mgmt_stage_op_req *req)
if (ret)
goto out;
- if (!strchr (brick, ':'))
+ ret = glusterd_volinfo_find (volname, &volinfo);
+ if (ret)
+ goto out;
+
+ if (!strchr (brick, ':')) {
brick = NULL;
- else {
+ ret = stat (path, &stbuf);
+ if (ret || !S_ISDIR (stbuf.st_mode)) {
+ ret = -1;
+ gf_log ("", GF_LOG_ERROR, "not a directory");
+ goto out;
+ }
+ volinfo->logdir = gf_strdup (path);
+ } else {
ret = glusterd_brickinfo_from_brick (brick, &tmpbrkinfo);
if (ret) {
gf_log ("glusterd", GF_LOG_ERROR,
@@ -3570,9 +3581,6 @@ glusterd_op_log_filename (gd1_mgmt_stage_op_req *req)
}
}
- ret = glusterd_volinfo_find (volname, &volinfo);
- if (ret)
- goto out;
ret = -1;
list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index cffd9dbd458..d5209f48d72 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -574,6 +574,8 @@ glusterd_volinfo_delete (glusterd_volinfo_t *volinfo)
if (ret)
goto out;
dict_unref (volinfo->dict);
+ if (volinfo->logdir)
+ GF_FREE (volinfo->logdir);
GF_FREE (volinfo);
ret = 0;
@@ -971,7 +973,11 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo,
snprintf (volfile, PATH_MAX, "%s.%s.%s", volinfo->volname,
brickinfo->hostname, exp_path);
- if (!brickinfo->logfile) {
+ if (!brickinfo->logfile && volinfo->logdir) {
+ snprintf (logfile, PATH_MAX, "%s/%s.log", volinfo->logdir,
+ exp_path);
+ brickinfo->logfile = gf_strdup (logfile);
+ } else if (!brickinfo->logfile) {
snprintf (logfile, PATH_MAX, "%s/logs/bricks/%s.log",
priv->workdir, exp_path);
brickinfo->logfile = gf_strdup (logfile);
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 11774a3e9d0..185d36225fd 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -192,6 +192,7 @@ struct glusterd_volinfo_ {
dict_t *dict;
uuid_t volume_id;
+ char *logdir;
};
typedef struct glusterd_volinfo_ glusterd_volinfo_t;