From 2406e21dd2d63b4ab69d8179d69dae17f0e4a0d9 Mon Sep 17 00:00:00 2001 From: Pranith K Date: Sun, 27 Mar 2011 08:51:29 +0000 Subject: mgmt/glusterd: Add the new volume only after all ops succeed - Print errors to the user when any of the op fails in create volume - Add the volume to the list only after all the ops succeed Signed-off-by: Pranith Kumar K Signed-off-by: Vijay Bellur BUG: 1888 (volfile generation error ignored) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1888 --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index ca8f5546a28..462671ae7ee 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -2234,22 +2234,27 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) brick = strtok_r (NULL, " \n", &saveptr); i++; } - list_add_tail (&volinfo->vol_list, &priv->volumes); - volinfo->defrag_status = 0; ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT); - - if (ret) + if (ret) { + *op_errstr = gf_strdup ("Failed to store the Volume information"); goto out; + } ret = glusterd_create_volfiles_and_notify_services (volinfo); - if (ret) + if (ret) { + *op_errstr = gf_strdup ("Failed to create volume files"); goto out; + } ret = glusterd_volume_compute_cksum (volinfo); - if (ret) + if (ret) { + *op_errstr = gf_strdup ("Failed to compute checksum of volume"); goto out; + } + volinfo->defrag_status = 0; + list_add_tail (&volinfo->vol_list, &priv->volumes); out: if (free_ptr) GF_FREE(free_ptr); -- cgit