summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2015-01-21 08:25:23 +0000
committerKaushal M <kaushal@redhat.com>2015-01-28 23:19:06 -0800
commit4493bfd8421116b5f45638b2f839874921f73fb3 (patch)
treea010c27bb2c0f28686cbd08a41394a6500abf20e /xlators/mgmt
parent32c3d4e7a611f64a1f4eebe5711bcb112b94151f (diff)
glusterd/snapshot: Fail snap create even if one brick is down.
In a n-way replication, where n>=3 fail snapshot, even if one brick is down. Also check for glusterd quorum, irrespective of the force option Modified testcase tests/bugs/snapshot/bug-1090042.t because it tested the successful creation of snapshot with force command. Change-Id: I72666f8f1484bd1766b9d6799c20766e4547f6c5 BUG: 1184344 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/9470 Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaushal M <kaushal@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
index 703e5eac66f..d3ad906705c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
@@ -2404,9 +2404,14 @@ glusterd_volume_quorum_calculate (glusterd_volinfo_t *volinfo, dict_t *dict,
goto out;
}
- if (!snap_force && down_count) {
+ /* In a n-way replication where n >= 3 we should not take a snapshot
+ * if even one brick is down, irrespective of the quorum being met.
+ * TODO: Remove this restriction once n-way replication is
+ * supported with snapshot.
+ */
+ if (down_count) {
snprintf (err_str, sizeof (err_str), "One or more bricks may "
- "be down. Use the force option ");
+ "be down.");
gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
*op_errstr = gf_strdup (err_str);
goto out;
@@ -2601,25 +2606,20 @@ glusterd_snap_quorum_check_for_create (dict_t *dict, gf_boolean_t snap_volume,
ret = dict_get_int32 (dict, "flags", &force);
if (!ret && (force & GF_CLI_FLAG_OP_FORCE))
snap_force = 1;
- if (!snap_force) {
- /* Do a quorum check of glusterds also. Because,
- the missed snapshot information will be saved
- by glusterd and if glusterds are not in
- quorum, then better fail the snapshot
- */
- if (!does_gd_meet_server_quorum (this, peers_list, _gf_true)) {
- snprintf (err_str, sizeof (err_str),
- "glusterds are not in quorum");
- gf_log (this->name, GF_LOG_WARNING, "%s",
- err_str);
- *op_errstr = gf_strdup (err_str);
- ret = -1;
- goto out;
- }
- gf_log (this->name, GF_LOG_DEBUG, "glusterds are in "
- "quorum");
- }
+ /* Do a quorum check of glusterds also. Because, the missed snapshot
+ * information will be saved by glusterd and if glusterds are not in
+ * quorum, then better fail the snapshot
+ */
+ if (!does_gd_meet_server_quorum (this, peers_list, _gf_true)) {
+ snprintf (err_str, sizeof (err_str),
+ "glusterds are not in quorum");
+ gf_log (this->name, GF_LOG_WARNING, "%s", err_str);
+ *op_errstr = gf_strdup (err_str);
+ ret = -1;
+ goto out;
+ } else
+ gf_log (this->name, GF_LOG_DEBUG, "glusterds are in quorum");
ret = dict_get_int64 (dict, "volcount", &volcount);
if (ret) {