summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorDan Lambright <dlambrig@redhat.com>2015-04-13 02:42:12 +0100
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-04-22 07:51:03 -0700
commit86b02afab780e559e82399b9e96381d8df594ed6 (patch)
treee59242b087191dfb6af7b302b18a59206a9cd17c /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parentabbc525dd3cbe142753c5b44a2717c1ed6b26723 (diff)
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 <vol> start gluster v detach-tier <vol> commit The status and stop cli commands shall be submitted separately. Change-Id: I24fda5cc3ba74f5fb8aa9a3234ad51f18b80a8a0 BUG: 1205540 Signed-off-by: Dan Lambright <dlambrig@redhat.com> Signed-off-by: root <root@localhost.localdomain> Signed-off-by: Dan Lambright <dlambrig@redhat.com> Reviewed-on: http://review.gluster.org/10108 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: NetBSD Build System
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c20
1 files changed, 17 insertions, 3 deletions
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;
}