summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2015-04-24 15:33:25 +0530
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-05-05 09:01:59 -0700
commit1306237c092ee8f927f16cae1b2b430a13e0a34f (patch)
tree8d0666f697fb1c692f655e3ffb1b9e26480856fa /cli
parent3bbca6b368782b99b80558841894942f802a44a2 (diff)
tiering: Send both attach-tier and tier-start together
After attaching tier, we have to start tier rebalance process. This patch is to trigger tier start along with attch-tier. Change-Id: I39380f95123f0087a82213ef263f9f33adcc5adc BUG: 1214222 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/10363 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-rpc-ops.c47
1 files changed, 44 insertions, 3 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 49c8761bbab..e45baa062a1 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -3894,9 +3894,17 @@ int32_t
gf_cli_attach_tier (call_frame_t *frame, xlator_t *this,
void *data)
{
- gf_cli_req req = {{0,} };
- int ret = 0;
- dict_t *dict = NULL;
+ gf_cli_req req = {{0,} };
+ int ret = 0;
+ dict_t *dict = NULL;
+ dict_t *newdict = NULL;
+ char *tierwords[] = {"volume", "rebalance", "",
+ "tier", "start", NULL};
+ const char **words = (const char **)tierwords;
+ int wordcount = 5;
+ char *volname = NULL;
+ cli_local_t *local = NULL;
+ cli_local_t *oldlocal = NULL;
if (!frame || !this || !data) {
ret = -1;
@@ -3912,6 +3920,39 @@ gf_cli_attach_tier (call_frame_t *frame, xlator_t *this,
(xdrproc_t) xdr_gf_cli_req, dict,
GLUSTER_CLI_ATTACH_TIER, this,
cli_rpc_prog, NULL);
+ if (ret)
+ goto out;
+ ret = dict_get_str (dict, "volname", &volname);
+ if (ret) {
+ gf_log ("cli", GF_LOG_ERROR, "Failed to get volume name");
+ goto notify_cli;
+ }
+
+ words[2] = volname;
+ ret = cli_cmd_volume_defrag_parse ((const char **)words,
+ wordcount, &newdict);
+ if (ret) {
+ gf_log ("cli", GF_LOG_ERROR, "Failed to parse tier start "
+ "command");
+ goto notify_cli;
+ }
+
+ gf_log ("cli", GF_LOG_DEBUG, "Sending tier start");
+
+ oldlocal = frame->local;
+ CLI_LOCAL_INIT (local, words, frame, newdict);
+ ret = gf_cli_defrag_volume (frame, this, newdict);
+ frame->local = oldlocal;
+ cli_local_wipe (local);
+
+notify_cli:
+ if (ret) {
+ cli_out ("Failed to run tier start. Please execute tier start "
+ "command explictly");
+ cli_out ("Usage : gluster volume rebalance <volname> tier "
+ "start");
+ }
+
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);