summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
diff options
context:
space:
mode:
authorPranith K <pranithk@gluster.com>2011-03-07 07:23:51 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-03-07 08:01:22 -0800
commit7ef59472f10a69c90d94b73e97bca385c6b4b29e (patch)
treeb3d41e327f769e7256492a66edbfa7da5d5164c8 /xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
parentf3dc620caaa7068ff12323a0001075140624733c (diff)
mgmt/glusterd: preserve delete volume payload structure for backward compatibility
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2494 ([glusterfs-3.1.3qa4]: replace brick and delete volume fails) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2494
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-rpc-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index fe97183c4af..e7134c990b7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -1298,6 +1298,7 @@ glusterd3_1_stage_op (call_frame_t *frame, xlator_t *this,
glusterd_conf_t *priv = NULL;
call_frame_t *dummy_frame = NULL;
dict_t *dict = NULL;
+ gf_boolean_t is_alloc = _gf_true;
if (!this) {
goto out;
@@ -1315,15 +1316,23 @@ glusterd3_1_stage_op (call_frame_t *frame, xlator_t *this,
//peerinfo should not be in payload
dict_del (dict, "peerinfo");
- ret = dict_allocate_and_serialize (dict, &req.buf.buf_val,
- (size_t *)&req.buf.buf_len);
-
- if (ret)
- goto out;
-
glusterd_get_uuid (&req.uuid);
req.op = glusterd_op_get_op ();
+ if (GD_OP_DELETE_VOLUME == req.op) {
+ ret = dict_get_str (dict, "volname", &req.buf.buf_val);
+ if (ret)
+ goto out;
+ req.buf.buf_len = strlen (req.buf.buf_val);
+ is_alloc = _gf_false;
+ } else {
+ ret = dict_allocate_and_serialize (dict, &req.buf.buf_val,
+ (size_t *)&req.buf.buf_len);
+
+ if (ret)
+ goto out;
+ }
+
dummy_frame = create_frame (this, this->ctx->pool);
if (!dummy_frame)
goto out;
@@ -1335,7 +1344,7 @@ glusterd3_1_stage_op (call_frame_t *frame, xlator_t *this,
this, glusterd3_1_stage_op_cbk);
out:
- if (req.buf.buf_val)
+ if ((_gf_true == is_alloc) && req.buf.buf_val)
GF_FREE (req.buf.buf_val);
gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);
@@ -1352,6 +1361,7 @@ glusterd3_1_commit_op (call_frame_t *frame, xlator_t *this,
glusterd_conf_t *priv = NULL;
call_frame_t *dummy_frame = NULL;
dict_t *dict = NULL;
+ gf_boolean_t is_alloc = _gf_true;
if (!this) {
goto out;
@@ -1371,11 +1381,19 @@ glusterd3_1_commit_op (call_frame_t *frame, xlator_t *this,
glusterd_get_uuid (&req.uuid);
req.op = glusterd_op_get_op ();
- ret = dict_allocate_and_serialize (dict, &req.buf.buf_val,
- (size_t *)&req.buf.buf_len);
+ if (GD_OP_DELETE_VOLUME == req.op) {
+ ret = dict_get_str (dict, "volname", &req.buf.buf_val);
+ if (ret)
+ goto out;
+ req.buf.buf_len = strlen (req.buf.buf_val);
+ is_alloc = _gf_false;
+ } else {
+ ret = dict_allocate_and_serialize (dict, &req.buf.buf_val,
+ (size_t *)&req.buf.buf_len);
- if (ret)
- goto out;
+ if (ret)
+ goto out;
+ }
dummy_frame = create_frame (this, this->ctx->pool);
if (!dummy_frame)
@@ -1388,7 +1406,7 @@ glusterd3_1_commit_op (call_frame_t *frame, xlator_t *this,
this, glusterd3_1_commit_op_cbk);
out:
- if (req.buf.buf_val)
+ if ((_gf_true == is_alloc) && req.buf.buf_val)
GF_FREE (req.buf.buf_val);
gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);