summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorPavan Sondur <pavan@gluster.com>2010-09-10 07:32:29 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-10 06:14:02 -0700
commit6858155d8b0681f9caea5295a2de63252ff9631c (patch)
tree73b98f8c318cfa4a22c3b71960a4004a1c81bd2a /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parent5bec5e4fd6b0cae5e7a5e4d0a72090f4d613b94e (diff)
mgmt/glusterd: add a dict to glusterd commit response.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1582 (replace-brick data missing added brick) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1582
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index a70df3ed364..7a063f64bc3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2028,6 +2028,7 @@ glusterd_op_replace_brick (gd1_mgmt_stage_op_req *req)
{
int ret = 0;
dict_t *dict = NULL;
+ dict_t *ctx = NULL;
gf1_cli_replace_op replace_op;
glusterd_volinfo_t *volinfo = NULL;
char *volname = NULL;
@@ -2106,6 +2107,30 @@ glusterd_op_replace_brick (gd1_mgmt_stage_op_req *req)
goto out;
}
+ /* Set src-brick's port number to be used in the maintainance mount
+ * after all commit acks are received.
+ */
+ if (!glusterd_is_local_addr (src_brickinfo->hostname)) {
+ gf_log ("", GF_LOG_NORMAL,
+ "adding src-brick port no");
+
+ ctx = glusterd_op_get_ctx (GD_OP_REPLACE_BRICK);
+ if (!ctx) {
+ gf_log ("", GF_LOG_ERROR,
+ "Operation Context is not present");
+ ret = -1;
+ goto out;
+ }
+
+ ret = dict_set_int32 (ctx, "src-brick-port",
+ src_brickinfo->port);
+ if (ret) {
+ gf_log ("", GF_LOG_DEBUG,
+ "Could not set src-brick port no");
+ goto out;
+ }
+ }
+
switch (replace_op) {
case GF_REPLACE_OP_START:
{
@@ -2892,6 +2917,7 @@ glusterd_op_ac_rcvd_commit_op_acc (glusterd_op_sm_event_t *event, void *ctx)
{
glusterd_volinfo_t *volinfo = NULL;
int32_t op = 0;
+ int32_t src_port = 0;
dict_t *dict = NULL;
char *src_brick = NULL;
char *dst_brick = NULL;
@@ -2961,6 +2987,14 @@ glusterd_op_ac_rcvd_commit_op_acc (glusterd_op_sm_event_t *event, void *ctx)
goto out;
}
+ ret = dict_get_int32 (dict, "src-brick-port", &src_port);
+ if (ret) {
+ gf_log ("", GF_LOG_ERROR, "Unable to get src-brick port");
+ goto out;
+ }
+
+ src_brickinfo->port = src_port;
+
switch (op) {
case GF_REPLACE_OP_START:
ret = rb_do_operation_start (volinfo, src_brickinfo, dst_brickinfo);