From 976b983d26a81c23affca5455f6667487cbbe7e5 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Fri, 6 Dec 2013 02:50:01 +0000 Subject: glusterd/snapshot: Fixing glusterd_do_quorum_action to start snap bricks for snap volumes Change-Id: I97f59fcf1e78ded35fd15996d587ecd043c7dc17 Signed-off-by: Avra Sengupta --- xlators/mgmt/glusterd/src/glusterd-utils.c | 36 ++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 545d8bc38..7c68947b8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -2761,8 +2761,10 @@ void glusterd_do_volume_quorum_action (xlator_t *this, glusterd_volinfo_t *volinfo, gf_boolean_t meets_quorum) { + int ret = -1; glusterd_brickinfo_t *brickinfo = NULL; glusterd_conf_t *conf = NULL; + glusterd_volinfo_t *parent_volinfo = NULL; conf = this->private; if (volinfo->status != GLUSTERD_STATUS_STARTED) @@ -2771,13 +2773,33 @@ glusterd_do_volume_quorum_action (xlator_t *this, glusterd_volinfo_t *volinfo, if (!glusterd_is_volume_in_server_quorum (volinfo)) meets_quorum = _gf_true; - list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) { - if (!glusterd_is_local_brick (this, volinfo, brickinfo)) - continue; - if (meets_quorum) - glusterd_brick_start (volinfo, brickinfo, _gf_false); - else - glusterd_brick_stop (volinfo, brickinfo, _gf_false); + if (volinfo->is_snap_volume == _gf_true) { + ret = glusterd_volinfo_find (volinfo->parent_volname, &parent_volinfo); + if (ret) { + gf_log (THIS->name, GF_LOG_ERROR, + "Unable to find parent volume %s for snap %s", + volinfo->parent_volname, volinfo->volname); + goto out; + } + list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) { + if (!glusterd_is_local_brick (this, volinfo, brickinfo)) + continue; + if (meets_quorum) + glusterd_snap_brick_start (parent_volinfo, volinfo, + brickinfo, _gf_false); + else + glusterd_snap_brick_stop (parent_volinfo, volinfo, + brickinfo, _gf_false); + } + } else { + list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) { + if (!glusterd_is_local_brick (this, volinfo, brickinfo)) + continue; + if (meets_quorum) + glusterd_brick_start (volinfo, brickinfo, _gf_false); + else + glusterd_brick_stop (volinfo, brickinfo, _gf_false); + } } out: return; -- cgit