diff options
author | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2010-08-31 08:57:19 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-08-31 10:49:41 -0700 |
commit | d1a277785af5d9d0e38d0576d2a9c69e27a232df (patch) | |
tree | 974bdb553a73c44def789c6bab155b060ac97d25 | |
parent | 6530488a49ed0c9395b091c42b148091075a9d86 (diff) |
check if the export directory is present only on the correct host
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1489 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1489
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 3f819515a3f..c78c19fdef1 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -306,9 +306,25 @@ glusterd_op_stage_create_volume (gd1_mgmt_stage_op_req *req) char *brick = NULL; char *tmpptr = NULL; char cmd_str[1024]; + xlator_t *this = NULL; + glusterd_conf_t *priv = NULL; GF_ASSERT (req); + this = THIS; + if (!this) { + gf_log ("glusterd", GF_LOG_ERROR, + "this is NULL"); + goto out; + } + + priv = this->private; + if (!priv) { + gf_log ("glusterd", GF_LOG_ERROR, + "priv is NULL"); + goto out; + } + dict = dict_new (); if (!dict) goto out; @@ -359,14 +375,23 @@ glusterd_op_stage_create_volume (gd1_mgmt_stage_op_req *req) if (ret) goto out; snprintf (cmd_str, 1024, "%s", brick_info->path); - ret = stat (cmd_str, &st_buf); - if (ret == -1) { - gf_log ("glusterd", GF_LOG_ERROR, "Volname %s, brick" - ":%s path %s not present", volname, - brick, brick_info->path); + ret = glusterd_resolve_brick (brick_info); + if (ret) { + gf_log ("glusterd", GF_LOG_ERROR, + "cannot resolve brick"); goto out; } - brick_list = tmpptr; + + if (!uuid_compare (brick_info->uuid, priv->uuid)) { + ret = stat (cmd_str, &st_buf); + if (ret == -1) { + gf_log ("glusterd", GF_LOG_ERROR, "Volname %s, brick" + ":%s path %s not present", volname, + brick, brick_info->path); + goto out; + } + brick_list = tmpptr; + } } out: gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); |