From ce8cee660a5cda88ea58e362be01e50cbccfff27 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 9 Jul 2010 03:14:13 +0000 Subject: provide a port option for gluster command line Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971 --- cli/src/cli.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'cli/src/cli.c') diff --git a/cli/src/cli.c b/cli/src/cli.c index 970db712f..f899fbb72 100644 --- a/cli/src/cli.c +++ b/cli/src/cli.c @@ -94,6 +94,8 @@ static struct argp_option gf_options[] = { {0, 0, 0, 0, "Basic options:"}, {"debug", ARGP_DEBUG_KEY, 0, 0, "Process runs in foreground and logs to console"}, + {"remote-port", ARGP_PORT_KEY, "PORT", 0, + "glusterd port to connect with"}, {0, } }; @@ -115,6 +117,9 @@ parse_opts (int key, char *arg, struct argp_state *argp_state) switch (key) { case ARGP_DEBUG_KEY: break; + case ARGP_PORT_KEY: + state->remote_port = strtol (arg, NULL, 0); + break; case ARGP_KEY_ARG: if (!state->argc) { argv = calloc (state->argc + 2, @@ -383,9 +388,8 @@ cli_rpc_init (struct cli_state *state) struct rpc_clnt_config rpc_cfg = {0,}; dict_t *options = NULL; int ret = -1; + int port = CLI_GLUSTERD_PORT; - rpc_cfg.remote_host = "localhost"; - rpc_cfg.remote_port = CLI_GLUSTERD_PORT; cli_rpc_prog = &cli3_1_prog; options = dict_new (); @@ -396,7 +400,13 @@ cli_rpc_init (struct cli_state *state) if (ret) goto out; - ret = dict_set_int32 (options, "remote-port", CLI_GLUSTERD_PORT); + if (state->remote_port) + port = state->remote_port; + + rpc_cfg.remote_host = "localhost"; + rpc_cfg.remote_port = port; + + ret = dict_set_int32 (options, "remote-port", port); if (ret) goto out; -- cgit