diff options
author | Amar Tumballi <amar@gluster.com> | 2011-06-23 01:51:47 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-06-23 21:31:04 -0700 |
commit | f948a24e51e447642c35bff881057f306768a5e0 (patch) | |
tree | 6ba2c5ef2889fea65aebd44b23797ca446c47a2b /xlators/mgmt/glusterd/src/glusterd-op-sm.c | |
parent | 89452c4db44966bb80601c73c3b835d002af9fd5 (diff) |
bring in strict check on export directory being re-used for different volume
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 3065 (make sure the export directories are not re-used as part of another volume)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3065
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 47f2c73c9eb..5760a4466aa 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -290,6 +290,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr) xlator_t *this = NULL; glusterd_conf_t *priv = NULL; char msg[2048] = {0}; + uuid_t volume_uuid; + char *volume_uuid_str; this = THIS; if (!this) { @@ -329,6 +331,16 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr) gf_log ("", GF_LOG_ERROR, "Unable to get count"); goto out; } + ret = dict_get_str (dict, "volume-id", &volume_uuid_str); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to get volume id"); + goto out; + } + ret = uuid_parse (volume_uuid_str, volume_uuid); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to parse volume id"); + goto out; + } ret = dict_get_str (dict, "bricks", &bricks); if (ret) { @@ -378,6 +390,7 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr) if (!uuid_compare (brick_info->uuid, priv->uuid)) { ret = glusterd_brick_create_path (brick_info->hostname, brick_info->path, + volume_uuid, 0777, op_errstr); if (ret) goto out; @@ -473,6 +486,7 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr) if (!uuid_compare (brickinfo->uuid, priv->uuid)) { ret = glusterd_brick_create_path (brickinfo->hostname, brickinfo->path, + volinfo->volume_id, 0777, op_errstr); if (ret) goto out; @@ -739,6 +753,7 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr) if (!uuid_compare (brickinfo->uuid, priv->uuid)) { ret = glusterd_brick_create_path (brickinfo->hostname, brickinfo->path, + volinfo->volume_id, 0777, op_errstr); if (ret) goto out; @@ -1059,7 +1074,9 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr, goto out; } if (!glusterd_is_local_addr (host)) { - ret = glusterd_brick_create_path (host, path, 0777, op_errstr); + ret = glusterd_brick_create_path (host, path, + volinfo->volume_id, 0777, + op_errstr); if (ret) goto out; } else { @@ -1231,7 +1248,8 @@ glusterd_op_stage_log_filename (dict_t *dict, char **op_errstr) goto out; } - ret = glusterd_brick_create_path (hostname, path, 0777, op_errstr); + ret = glusterd_brick_create_path (hostname, path, volinfo->volume_id, + 0777, op_errstr); if (ret) goto out; out: |