summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2013-12-06 02:50:01 +0000
committerAvra Sengupta <asengupt@redhat.com>2013-12-17 00:16:21 +0000
commit976b983d26a81c23affca5455f6667487cbbe7e5 (patch)
treed90572fd204fb766c93232427e724064e2602ce9 /xlators/mgmt/glusterd/src/glusterd-utils.c
parenteed0caca2d35ece6a8eba977937f31599d6d9021 (diff)
glusterd/snapshot: Fixing glusterd_do_quorum_action to start snap bricks for snap volumes
Change-Id: I97f59fcf1e78ded35fd15996d587ecd043c7dc17 Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c36
1 files changed, 29 insertions, 7 deletions
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;