diff options
author | Dan Lambright <dlambrig@redhat.com> | 2015-04-13 02:42:12 +0100 |
---|---|---|
committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2015-04-22 07:51:03 -0700 |
commit | 86b02afab780e559e82399b9e96381d8df594ed6 (patch) | |
tree | e59242b087191dfb6af7b302b18a59206a9cd17c /cli/src/cli-cmd-parser.c | |
parent | abbc525dd3cbe142753c5b44a2717c1ed6b26723 (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 'cli/src/cli-cmd-parser.c')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index a8e09a46631..a1648a9c527 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -1565,6 +1565,66 @@ out: return ret; } +int32_t +cli_cmd_volume_detach_tier_parse (const char **words, int wordcount, + dict_t **options) +{ + int ret = -1; + char *word = NULL; + dict_t *dict = NULL; + int32_t command = GF_OP_CMD_NONE; + int force = 0; + + if (!((wordcount == 4) || (wordcount == 5))) + goto out; + + dict = dict_new (); + if (!dict) + goto out; + + ret = dict_set_str (dict, "volname", (char *)words[2]); + if (ret) + goto out; + + if (wordcount == 5) { + word = (char *)words[4]; + if (!strcmp(word, "force")) + force = 1; + } + + word = (char *)words[3]; + + ret = -1; + + if (!strcmp(word, "start")) { + command = GF_OP_CMD_DETACH_START; + } else if (!strcmp(word, "commit")) { + if (force) + command = GF_OP_CMD_DETACH_COMMIT_FORCE; + else + command = GF_OP_CMD_DETACH_COMMIT; + } else if (!strcmp(word, "stop")) + command = GF_DEFRAG_CMD_STOP_DETACH_TIER; + else if (!strcmp(word, "status")) + command = GF_DEFRAG_CMD_STATUS; + else + goto out; + + ret = dict_set_int32 (dict, "command", command); + if (ret) + goto out; + + *options = dict; + ret = 0; +out: + if (ret) { + gf_log ("cli", GF_LOG_ERROR, "Unable to parse detach-tier CLI"); + if (dict) + dict_unref (dict); + } + + return ret; +} int32_t cli_cmd_volume_remove_brick_parse (const char **words, int wordcount, |