summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-07-09 03:14:13 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-12 06:39:36 -0700
commitce8cee660a5cda88ea58e362be01e50cbccfff27 (patch)
treea8e7b3346096c9f7774db83025653589f9be0722 /cli
parent9563c51ddeedee87a1d71defc20c0a7f06f24d23 (diff)
provide a port option for gluster command line
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli.c16
-rw-r--r--cli/src/cli.h3
2 files changed, 16 insertions, 3 deletions
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;
diff --git a/cli/src/cli.h b/cli/src/cli.h
index c532babf4..a53b6a9e1 100644
--- a/cli/src/cli.h
+++ b/cli/src/cli.h
@@ -34,6 +34,7 @@
enum argp_option_keys {
ARGP_DEBUG_KEY = 133,
+ ARGP_PORT_KEY = 'p',
};
struct cli_state;
@@ -89,6 +90,8 @@ struct cli_state {
/* autocompletion state */
char **matches;
char **matchesp;
+
+ int remote_port;
};