summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-snapshot.c
diff options
context:
space:
mode:
authorSachin Pandit <spandit@redhat.com>2014-04-30 00:41:56 +0530
committerVijay Bellur <vbellur@redhat.com>2014-05-01 03:21:22 -0700
commit12f1fab930dc0f6f103bae03fab981409ed31b4e (patch)
treed4ff996a0b6a87bc77685986ed3d4c9f8c792e17 /xlators/mgmt/glusterd/src/glusterd-snapshot.c
parent9934033030d3afa039c0686f77a4c00fad270131 (diff)
glusterd/snapshot : Barrier code integration with snapshot codebase.
As we have new barrier translator in place, we are making use of that during snapshot phase. During snapshot create (pre-commit), we enable the barrier feature and after the commit we disable it. Change-Id: I94212b1c06b0d9b12255ee98313e2d8549b34b17 BUG: 1061685 Signed-off-by: Sachin Pandit <spandit@redhat.com> Reviewed-on: http://review.gluster.org/7561 Reviewed-by: Kaushal M <kaushal@redhat.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-snapshot.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 278d4d970df..8ef40d41a21 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -5043,6 +5043,7 @@ glusterd_snapshot_brickop (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
char *volname = NULL;
int32_t snap_command = 0;
xlator_t *this = NULL;
+ char *op_type = NULL;
this = THIS;
@@ -5059,6 +5060,44 @@ glusterd_snapshot_brickop (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
switch (snap_command) {
case GF_SNAP_OPTION_TYPE_CREATE:
+
+ /* op_type with tell us whether its pre-commit operation
+ * or post-commit
+ */
+ ret = dict_get_str (dict, "operation-type", &op_type);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to fetch "
+ "operation type");
+ goto out;
+ }
+
+ if (strcmp (op_type, "pre") == 0) {
+ /* BRICK OP PHASE for enabling barrier, Enable barrier
+ * if its a pre-commit operation
+ */
+ ret = glusterd_set_barrier_value (dict, "enable");
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ "set barrier value as enable in dict");
+ goto out;
+ }
+ } else if (strcmp (op_type, "post") == 0) {
+ /* BRICK OP PHASE for disabling barrier, Disable barrier
+ * if its a post-commit operation
+ */
+ ret = glusterd_set_barrier_value (dict, "disable");
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ "set barrier value as disable in "
+ "dict");
+ goto out;
+ }
+ } else {
+ ret = -1;
+ gf_log (this->name, GF_LOG_ERROR, "Invalid op_type");
+ goto out;
+ }
+
ret = dict_get_int64 (dict, "volcount", &vol_count);
if (ret)
goto out;