summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-snapshot.c
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2015-11-02 17:49:44 +0530
committerVijay Bellur <vbellur@redhat.com>2015-12-02 07:36:07 -0800
commitcb7da0ffba147173bc9e6cd05f0a88a2c1ac9cdc (patch)
treef1aa467fc61fd926c1bc4206aad01e088d46fdd3 /xlators/mgmt/glusterd/src/glusterd-snapshot.c
parentf6142e97c6219d2c1c482a414690020ed1275bdb (diff)
snapshot: Fix quorum check for clone
snapshot clone was not performing quorum check and was just relying on glusterd server quorum. Wrote glusterd_snap_quorum_check_for_clone(), to perform the same. Also moved common quorum check code from glusterd_snap_quorum_check_for_create(), to glusterd_snap_common_quorum_chk_clone_create() to be shared by both Change-Id: Ib78c709186841780876de8ef7d7c9243b7f67995 BUG: 1276023 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/12490 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-snapshot.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 15699b0e9c0..be2f09fc3a4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -6291,6 +6291,7 @@ glusterd_take_brick_snapshot_task (void *opaque)
{
int ret = 0;
snap_create_args_t *snap_args = NULL;
+ char *clonename = NULL;
char key[PATH_MAX] = "";
GF_ASSERT (opaque);
@@ -6298,6 +6299,16 @@ glusterd_take_brick_snapshot_task (void *opaque)
snap_args = (snap_create_args_t*) opaque;
THIS = snap_args->this;
+ /* Try and fetch clonename. If present set status with clonename *
+ * else do so as snap-vol */
+ ret = dict_get_str (snap_args->dict, "clonename", &clonename);
+ if (ret) {
+ snprintf (key, sizeof (key), "snap-vol%d.brick%d.status",
+ snap_args->volcount, snap_args->brickorder);
+ } else
+ snprintf (key, sizeof (key), "clone%d.brick%d.status",
+ snap_args->volcount, snap_args->brickorder);
+
ret = glusterd_take_brick_snapshot (snap_args->dict,
snap_args->snap_vol,
snap_args->brickinfo,
@@ -6313,8 +6324,6 @@ glusterd_take_brick_snapshot_task (void *opaque)
snap_args->snap_vol->volname);
}
- snprintf (key, sizeof (key), "snap-vol%d.brick%d.status",
- snap_args->volcount, snap_args->brickorder);
if (dict_set_int32 (snap_args->rsp_dict, key, (ret)?0:1)) {
gf_msg (THIS->name, GF_LOG_ERROR, 0,
GD_MSG_DICT_SET_FAILED, "failed to "