summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c57
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h1
2 files changed, 58 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index a802149212e..6df894ca740 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -3475,6 +3475,53 @@ rb_kill_destination_brick (glusterd_volinfo_t *volinfo,
}
static int
+rb_do_operation_commit (glusterd_volinfo_t *volinfo,
+ glusterd_brickinfo_t *src_brickinfo,
+ glusterd_brickinfo_t *dst_brickinfo)
+{
+ int ret = -1;
+ int cmd_ret = -1;
+
+ gf_log ("", GF_LOG_DEBUG,
+ "replace-brick sending commit xattr");
+
+ ret = rb_spawn_maintenance_client (volinfo, src_brickinfo);
+ if (ret) {
+ gf_log ("", GF_LOG_DEBUG,
+ "Could not spawn maintenance "
+ "client");
+ goto out;
+ }
+
+ gf_log ("", GF_LOG_DEBUG,
+ "mounted the replace brick client");
+
+ cmd_ret = rb_send_xattr_command (volinfo, src_brickinfo,
+ dst_brickinfo, RB_PUMP_COMMIT_CMD,
+ "jargon");
+ if (cmd_ret) {
+ gf_log ("", GF_LOG_DEBUG,
+ "Failed to send command to pump");
+ }
+
+ ret = rb_destroy_maintenance_client (volinfo, src_brickinfo);
+ if (ret) {
+ gf_log ("", GF_LOG_DEBUG,
+ "Failed to destroy maintenance "
+ "client");
+ goto out;
+ }
+
+ gf_log ("", GF_LOG_DEBUG,
+ "unmounted the replace brick client");
+
+ ret = 0;
+
+out:
+ return cmd_ret || ret;
+}
+
+static int
rb_do_operation_abort (glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *src_brickinfo,
glusterd_brickinfo_t *dst_brickinfo)
@@ -3894,6 +3941,16 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict)
case GF_REPLACE_OP_COMMIT:
case GF_REPLACE_OP_COMMIT_FORCE:
{
+ ctx = glusterd_op_get_ctx (GD_OP_REPLACE_BRICK);
+ if (ctx) {
+ ret = rb_do_operation_commit (volinfo, src_brickinfo, dst_brickinfo);
+ if (ret) {
+ gf_log ("", GF_LOG_ERROR,
+ "Commit operation failed");
+ goto out;
+ }
+ }
+
ret = dict_set_int32 (volinfo->dict, "enable-pump", 0);
gf_log ("", GF_LOG_DEBUG,
"Received commit - will be adding dst brick and "
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 2ddd830f847..b1027c1714c 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -245,6 +245,7 @@ enum glusterd_vol_comp_status_ {
/*All definitions related to replace brick */
#define RB_PUMP_START_CMD "trusted.glusterfs.pump.start"
#define RB_PUMP_PAUSE_CMD "trusted.glusterfs.pump.pause"
+#define RB_PUMP_COMMIT_CMD "trusted.glusterfs.pump.commit"
#define RB_PUMP_ABORT_CMD "trusted.glusterfs.pump.abort"
#define RB_PUMP_STATUS_CMD "trusted.glusterfs.pump.status"
#define RB_CLIENT_MOUNTPOINT "rb_mount"