diff options
author | Kotresh HR <khiremat@redhat.com> | 2014-11-26 12:35:23 +0530 |
---|---|---|
committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2015-04-09 11:36:04 +0000 |
commit | 55ec6f27dd6be71224bb3b0da24c4258596db024 (patch) | |
tree | fca74158e301cec1ea3408f9fc04c93d9c4e0cb5 | |
parent | 3d03c4bf9b46fcbb26bdc1e06fb96099c1894871 (diff) |
cli: Allow options prefixed with '--' for geo-rep config cmds
Geo-replications allows users to send rsync_options from
cli but while parsing, options prefixed with '--' are
treated as unrecognized apart from a few options. Because
of this rsync_options can't be set through cli. This
patch allows such options if it's a geo-rep config command.
e.g.
gluster vol geo-rep master fedora1::slave config rsync-options \
"--bwlimit=1.5m"
Change-Id: I4b4f10c0efd3f3a362ece65e697d5ce1498f84ac
BUG: 1168108
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/9198
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
-rw-r--r-- | cli/src/cli.c | 16 | ||||
-rw-r--r-- | cli/src/cli.h | 4 |
2 files changed, 15 insertions, 5 deletions
diff --git a/cli/src/cli.c b/cli/src/cli.c index 9b1ed87c1e7..511b45b54ef 100644 --- a/cli/src/cli.c +++ b/cli/src/cli.c @@ -396,10 +396,11 @@ cli_opt_parse (char *opt, struct cli_state *state) int parse_cmdline (int argc, char *argv[], struct cli_state *state) { - int ret = 0; - int i = 0; - int j = 0; - char *opt = NULL; + int ret = 0; + int i = 0; + int j = 0; + char *opt = NULL; + gf_boolean_t geo_rep_config = _gf_false; state->argc=argc-1; state->argv=&argv[1]; @@ -409,9 +410,14 @@ parse_cmdline (int argc, char *argv[], struct cli_state *state) state->ctx->secure_mgmt = 1; } + if (state->argc >= GEO_REP_CMD_CONFIG_INDEX && + strtail (state->argv[GEO_REP_CMD_INDEX], "geo") && + strtail (state->argv[GEO_REP_CMD_CONFIG_INDEX], "co")) + geo_rep_config = _gf_true; + for (i = 0; i < state->argc; i++) { opt = strtail (state->argv[i], "--"); - if (opt) { + if (opt && !geo_rep_config) { ret = cli_opt_parse (opt, state); if (ret == -1) { cli_out ("unrecognized option --%s", opt); diff --git a/cli/src/cli.h b/cli/src/cli.h index 60bbcb9f620..2648d25ee9c 100644 --- a/cli/src/cli.h +++ b/cli/src/cli.h @@ -38,6 +38,10 @@ #define CLI_TAB_LENGTH 8 #define CLI_BRICK_STATUS_LINE_LEN 78 +/* Geo-rep command positional arguments' index */ +#define GEO_REP_CMD_INDEX 1 +#define GEO_REP_CMD_CONFIG_INDEX 4 + enum argp_option_keys { ARGP_DEBUG_KEY = 133, ARGP_PORT_KEY = 'p', |