diff options
author | Pranith K <pranithk@gluster.com> | 2011-03-27 08:51:29 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2011-03-27 22:17:33 -0700 |
commit | 2406e21dd2d63b4ab69d8179d69dae17f0e4a0d9 (patch) | |
tree | a9f58b2cbbb5b32ba36e95ce2d107a07dc7d9ce7 | |
parent | 48b0c02ba2b9c828b29ce236c838ab0e56ddab08 (diff) |
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 <pranithk@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1888 (volfile generation error ignored)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1888
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 17 |
1 files changed, 11 insertions, 6 deletions
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); |