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
This commit is contained in:
parent
9563c51dde
commit
ce8cee660a
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user