summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2013-02-12 17:26:35 +0530
committerAnand Avati <avati@redhat.com>2013-04-09 17:39:30 -0700
commitc9800f0986a10bbde9121239590e3cb25b94c5f8 (patch)
treeee6045c86cae871472131c96fef90003e395575f /xlators/mgmt/glusterd/src/glusterd-volume-ops.c
parentf364d542aaf272c14b1d6ef7c9ac805db0fdb45c (diff)
glusterd: changes in 'volume create' behaviour
This patch incorporates all the changes suggested on the behaviour of 'volume create' command in http://review.gluster.org/#change,4214 (comment #14, to be precise). Change-Id: Iaac524a59738b177415595b18aa8a136090d3d25 BUG: 948729 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/4740 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index bc5f8f2a749..fd4e0268a57 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -134,6 +134,11 @@ glusterd_handle_create_volume (rpcsvc_request_t *req)
goto out;
}
+ if (!dict_get (dict, "force")) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to get 'force' flag");
+ goto out;
+ }
+
uuid_generate (volume_id);
free_ptr = gf_strdup (uuid_utoa (volume_id));
ret = dict_set_dynstr (dict, "volume-id", free_ptr);
@@ -610,6 +615,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr)
#ifdef HAVE_BD_XLATOR
char *dev_type = NULL;
#endif
+ gf_boolean_t is_force = _gf_false;
+
this = THIS;
GF_ASSERT (this);
priv = this->private;
@@ -663,6 +670,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr)
goto out;
}
+ is_force = dict_get_str_boolean (dict, "force", _gf_false);
+
if (bricks) {
brick_list = gf_strdup (bricks);
if (!brick_list) {
@@ -715,10 +724,9 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr)
} else
#endif
if (!uuid_compare (brick_info->uuid, MY_UUID)) {
- ret = glusterd_brick_create_path (brick_info->hostname,
- brick_info->path,
- volume_uuid,
- op_errstr);
+ ret = glusterd_validate_and_create_brickpath (brick_info,
+ volume_uuid, op_errstr,
+ is_force);
if (ret)
goto out;
brick_list = tmpptr;