diff options
| author | hari gowtham <hgowtham@redhat.com> | 2017-01-24 14:24:47 +0530 | 
|---|---|---|
| committer | Atin Mukherjee <amukherj@redhat.com> | 2017-02-07 01:36:27 -0500 | 
| commit | 563cafb5a5e742fc7fd2c175b332f0000c053040 (patch) | |
| tree | 3c9c5c18124083ec662e941fafa85e6a3cc45310 /cli/src/cli-cmd-parser.c | |
| parent | f2133923b8d8851943c5676b88c5ce67725eabe5 (diff) | |
CLI/TIER: removing old tier commands under rebalance
PROBLEM: gluster v rebalance <volname> tier start works even after
the switch of tier to service framework.
This lets the user have two tierd for the same volume.
FIX: checking for each process will make the new code hard
to maintain. So we are removing the support for old commands.
Change-Id: I5b0974b2dbb74f0bee8344b61c7f924300ad73f2
BUG: 1415590
Signed-off-by: hari gowtham <hgowtham@redhat.com>
Reviewed-on: https://review.gluster.org/16463
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: hari gowtham <hari.gowtham005@gmail.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: N Balachandran <nbalacha@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'cli/src/cli-cmd-parser.c')
| -rw-r--r-- | cli/src/cli-cmd-parser.c | 60 | 
1 files changed, 50 insertions, 10 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index d93af0e79d3..d234ad09c4e 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -3989,6 +3989,56 @@ out:  }  int +cli_cmd_volume_old_tier_parse (const char **words, int wordcount, +                             dict_t **options) +{ +        dict_t                 *dict = NULL; +        int                      ret = -1; +        char                *volname = NULL; +        gf_cli_defrag_type       cmd = 0; + +        GF_ASSERT (words); +        GF_ASSERT (options); + +        dict = dict_new (); +        if (!dict) +                goto out; + +        if (wordcount != 4) +                goto out; + +        if ((strcmp (words[1], "tier") == 0) && +            (strcmp (words[3], "start") == 0)) { +                cmd = GF_DEFRAG_CMD_START_TIER; +        } else +                goto out; + +        volname = (char *) words[2]; + +        ret = dict_set_str (dict, "volname", volname); + +        if (ret) { +                gf_log (THIS->name, GF_LOG_ERROR, "failed to set dict"); +                goto out; +        } + +        ret = dict_set_int32 (dict, "rebalance-command", (int32_t) cmd); + +        if (ret) { +                gf_log (THIS->name, GF_LOG_ERROR, "failed to set dict"); +                goto out; +        } + +        *options = dict; + +out: +        if (ret && dict) +                dict_unref (dict); + +        return ret; +} + +int  cli_cmd_volume_defrag_parse (const char **words, int wordcount,                               dict_t **options)  { @@ -4013,16 +4063,6 @@ cli_cmd_volume_defrag_parse (const char **words, int wordcount,                  if (strcmp (words[3], "start") && strcmp (words[3], "stop") &&                      strcmp (words[3], "status"))                              goto out; -        } else if ((strcmp (words[3], "tier") == 0) && -                   (strcmp (words[4], "start") == 0)) { -                volname = (char *) words[2]; -                cmd = GF_DEFRAG_CMD_START_TIER; -                goto done; -        } else if ((strcmp (words[3], "tier") == 0) && -               (strcmp (words[4], "status") == 0)) { -                volname = (char *) words[2]; -                cmd = GF_DEFRAG_CMD_STATUS_TIER; -                goto done;          } else {                  if (strcmp (words[3], "fix-layout") &&                      strcmp (words[3], "start"))  | 
