diff options
| author | Mohammed Rafi KC <rkavunga@redhat.com> | 2015-04-24 15:33:25 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2015-05-09 21:51:36 -0700 | 
| commit | 58ef6a233f43bc644be55d2b5510b12718a6835e (patch) | |
| tree | 3e551bb061d0d1d79a5cf0dd574c6611ae133bcc /cli/src | |
| parent | f19c019cef4abfdb065d72c088fabf7d3d7805ff (diff) | |
tiering: Send both attach-tier and tier-start together
        Back port of http://review.gluster.org/10363
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>
Change-Id: Ia27e97a9dc0772f3f56b991ce4019281ab7bf1b5
BUG: 1219848
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Reviewed-on: http://review.gluster.org/10711
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'cli/src')
| -rw-r--r-- | cli/src/cli-rpc-ops.c | 47 | 
1 files changed, 44 insertions, 3 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 933dbbd3542..a6315e28e43 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -4265,9 +4265,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; @@ -4283,6 +4291,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);  | 
