diff options
| author | Csaba Henk <csaba@gluster.com> | 2010-09-15 08:11:16 +0000 | 
|---|---|---|
| committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-16 23:07:32 -0700 | 
| commit | d787bca47fc038facb34221ee9855934f7230ef4 (patch) | |
| tree | 77d027ea62d863009effbf32859c3c78dfd9d07f /cli | |
| parent | 63ec13f022ae99c1664fbdbc9e6623903ba843af (diff) | |
cli: add "--remote-host=<hostname>" option
Signed-off-by: Csaba Henk <csaba@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1570 (geosync related changes)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570
Diffstat (limited to 'cli')
| -rw-r--r-- | cli/src/cli.c | 21 | ||||
| -rw-r--r-- | cli/src/cli.h | 1 | 
2 files changed, 16 insertions, 6 deletions
diff --git a/cli/src/cli.c b/cli/src/cli.c index 4e25417f9ba..8730211bff9 100644 --- a/cli/src/cli.c +++ b/cli/src/cli.c @@ -340,6 +340,12 @@ cli_opt_parse (char *opt, struct cli_state *state)                  return -1;          } +        oarg = strtail (opt, "remote-host="); +        if (oarg) { +                state->remote_host = oarg; +                return 0; +        } +          return -1;  } @@ -391,6 +397,9 @@ cli_state_init (struct cli_state *state)          struct cli_cmd_tree  *tree = NULL;          int                   ret = 0; + +        state->remote_host = "localhost"; +          tree = &state->tree;          tree->state = state; @@ -439,14 +448,14 @@ cli_rpc_init (struct cli_state *state)          if (!options)                  goto out; -        ret = dict_set_str (options, "remote-host", "localhost"); +        ret = dict_set_str (options, "remote-host", state->remote_host);          if (ret)                  goto out;          if (state->remote_port)                  port = state->remote_port; -        rpc_cfg.remote_host = "localhost"; +        rpc_cfg.remote_host = state->remote_host;          rpc_cfg.remote_port = port;          ret = dict_set_int32 (options, "remote-port", port); @@ -516,10 +525,6 @@ main (int argc, char *argv[])          if (ret)                  goto out; -        global_rpc = cli_rpc_init (&state); -        if (!global_rpc) -                goto out; -          state.ctx = ctx;          global_state = &state; @@ -527,6 +532,10 @@ main (int argc, char *argv[])          if (ret)                  goto out; +        global_rpc = cli_rpc_init (&state); +        if (!global_rpc) +                goto out; +          ret = logging_init (ctx);          if (ret)                  goto out; diff --git a/cli/src/cli.h b/cli/src/cli.h index 62aa02079da..091114fcaca 100644 --- a/cli/src/cli.h +++ b/cli/src/cli.h @@ -97,6 +97,7 @@ struct cli_state {          char                **matches;          char                **matchesp; +        char                 *remote_host;          int                   remote_port;          int                   mode;  };  | 
