diff options
-rw-r--r-- | tests/bugs/glusterd/bug-1177132-quorum-validation.t | 18 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 14 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/bugs/glusterd/bug-1177132-quorum-validation.t b/tests/bugs/glusterd/bug-1177132-quorum-validation.t index 57aec5ccf57..f18b5a178d3 100644 --- a/tests/bugs/glusterd/bug-1177132-quorum-validation.t +++ b/tests/bugs/glusterd/bug-1177132-quorum-validation.t @@ -58,6 +58,24 @@ TEST $CLI_1 volume remove-brick $V0 $H2:$B2/${V0}2 start TEST $CLI_1 volume set $V0 barrier enable TEST $CLI_1 volume remove-brick $V0 $H2:$B2/${V0}2 stop +## Stop the volume +TEST $CLI_1 volume stop $V0 + +## Bring down 2nd glusterd +TEST kill_glusterd 2 + +## Now quorum is not meet. Starting volume on 1st node should not success +TEST ! $CLI_1 volume start $V0 + +## Bring back 2nd glusterd +TEST $glusterd_2 + +# After 2nd glusterd come back, there will be 2 nodes in a clusater +EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count; + +## Now quorum is meet. Starting volume on 1st node should be success. +TEST $CLI_1 volume start $V0 + # Now re-execute the same profile command and this time it should succeed TEST $CLI_1 volume profile $V0 start diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index f02ac80ccb0..567b1acc58a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -29,6 +29,7 @@ #include "glusterd-shd-svc.h" #include "glusterd-snapd-svc.h" #include "glusterd-mgmt.h" +#include "glusterd-server-quorum.h" #include <stdint.h> #include <sys/socket.h> @@ -1472,6 +1473,18 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, volname); goto out; } + + if (priv->op_version > GD_OP_VERSION_3_7_5) { + ret = glusterd_validate_quorum (this, GD_OP_START_VOLUME, dict, + op_errstr); + if (ret) { + gf_msg (this->name, GF_LOG_CRITICAL, 0, + GD_MSG_SERVER_QUORUM_NOT_MET, + "Server quorum not met. Rejecting operation."); + goto out; + } + } + /* This is an incremental approach to have all the volinfo objects ref * count. The first attempt is made in volume start transaction to * ensure it doesn't race with import volume where stale volume is @@ -2511,6 +2524,7 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr) volname); goto out; } + /* This is an incremental approach to have all the volinfo objects ref * count. The first attempt is made in volume start transaction to * ensure it doesn't race with import volume where stale volume is |