From 86b02afab780e559e82399b9e96381d8df594ed6 Mon Sep 17 00:00:00 2001 From: Dan Lambright Date: Mon, 13 Apr 2015 02:42:12 +0100 Subject: glusterd: support for tier volumes 'detach start' and 'detach commit' These commands work in a manner analagous to rebalancing when removing a brick. The existing migration daemon detects "detach start" and switches to moving data off the hot tier. While in this state all lookups are directed to the cold tier. gluster v detach-tier start gluster v detach-tier commit The status and stop cli commands shall be submitted separately. Change-Id: I24fda5cc3ba74f5fb8aa9a3234ad51f18b80a8a0 BUG: 1205540 Signed-off-by: Dan Lambright Signed-off-by: root Signed-off-by: Dan Lambright Reviewed-on: http://review.gluster.org/10108 Reviewed-by: Kaleb KEITHLEY Tested-by: NetBSD Build System --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 5bfdb0bb43e..c91fdbcea4f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -77,6 +77,11 @@ static struct cds_list_head gd_op_sm_queue; synclock_t gd_op_sm_lock; glusterd_op_info_t opinfo = {{0},}; +int +glusterd_bricks_select_rebalance_volume (dict_t *dict, char **op_errstr, + struct cds_list_head *selected); + + int32_t glusterd_txn_opinfo_dict_init () { @@ -5161,10 +5166,10 @@ glusterd_bricks_select_remove_brick (dict_t *dict, char **op_errstr, int32_t i = 1; char key[256] = {0,}; glusterd_pending_node_t *pending_node = NULL; + int32_t command = 0; int32_t force = 0; - ret = dict_get_str (dict, "volname", &volname); if (ret) { @@ -5185,6 +5190,15 @@ glusterd_bricks_select_remove_brick (dict_t *dict, char **op_errstr, goto out; } + ret = dict_get_int32 (dict, "command", &command); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to get command"); + goto out; + } + + if (command == GF_OP_CMD_DETACH_START) + return glusterd_bricks_select_rebalance_volume(dict, op_errstr, selected); + ret = dict_get_int32 (dict, "force", &force); if (ret) { gf_log (THIS->name, GF_LOG_INFO, "force flag is not set"); @@ -5863,7 +5877,7 @@ out: } -static int +int glusterd_bricks_select_rebalance_volume (dict_t *dict, char **op_errstr, struct cds_list_head *selected) { @@ -5900,7 +5914,7 @@ glusterd_bricks_select_rebalance_volume (dict_t *dict, char **op_errstr, } else { pending_node->node = volinfo; pending_node->type = GD_NODE_REBALANCE; - cds_list_add_tail (&pending_node->list, &opinfo.pending_bricks); + cds_list_add_tail (&pending_node->list, selected); pending_node = NULL; } -- cgit