diff options
| author | Kotresh HR <khiremat@redhat.com> | 2015-11-02 18:52:03 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2015-11-23 11:22:28 -0800 | 
| commit | c7b293beba0c327ad20a5c8b3e5635be80672f63 (patch) | |
| tree | 24c30737873b9c746cd77a6b47168bad37297f8d /xlators | |
| parent | 2cd331dc3080f3a66edb12fa6cbab75c69b0147f (diff) | |
glusterd/geo-rep: Adding ssh-port option for geo-rep create
Geo-replication uses default ssh port 22 for setup.
i.e., to distribute ssh keys to slaves. In container
environments, custom port number might be used.
Hence to support custom port number for ssh, option
is provided in geo-rep create command to take the
same.
Change-Id: I0fb61959b1c085342b8e4c21ac4e076fba5462f1
BUG: 1283060
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/12504
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
 (cherry picked from commit 5bb3c521431cc27b2826acd889bffb2f90ae7f73)
Reviewed-on: http://review.gluster.org/12652
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 37 | 
1 files changed, 33 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index 8006a4de821..5a61c685a95 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -2310,7 +2310,8 @@ out:  static int  glusterd_verify_slave (char *volname, char *slave_url, char *slave_vol, -                       char **op_errstr, gf_boolean_t *is_force_blocker) +                       int ssh_port, char **op_errstr, +                       gf_boolean_t *is_force_blocker)  {          int32_t          ret                     = -1;          runner_t         runner                  = {0,}; @@ -2362,7 +2363,12 @@ glusterd_verify_slave (char *volname, char *slave_url, char *slave_vol,          runner_argprintf (&runner, "%s", slave_user);          runner_argprintf (&runner, "%s", slave_ip);          runner_argprintf (&runner, "%s", slave_vol); +        runner_argprintf (&runner, "%d", ssh_port);          runner_argprintf (&runner, "%s", log_file_path); +        gf_msg_debug (this->name, 0, "gverify Args = %s %s %s %s %s %s %s", +                      runner.argv[0], runner.argv[1], runner.argv[2], +                      runner.argv[3], runner.argv[4], runner.argv[5], +                      runner.argv[6]);          runner_redir (&runner, STDOUT_FILENO, RUN_PIPE);          synclock_unlock (&priv->big_lock);          ret = runner_run (&runner); @@ -2503,6 +2509,7 @@ glusterd_op_stage_gsync_create (dict_t *dict, char **op_errstr)          char                uuid_str [64]             = "";          int                 ret                       = -1;          int                 is_pem_push               = -1; +        int                 ssh_port                  = 22;          gf_boolean_t        is_force                  = -1;          gf_boolean_t        is_no_verify              = -1;          gf_boolean_t        is_force_blocker          = -1; @@ -2596,6 +2603,16 @@ glusterd_op_stage_gsync_create (dict_t *dict, char **op_errstr)                           down_peerstr = NULL;                  } +                ret = dict_get_int32 (dict, "ssh_port", &ssh_port); +                if (ret < 0 && ret != -ENOENT) { +                        snprintf (errmsg, sizeof (errmsg), +                                  "Fetching ssh_port failed while " +                                  "handling "GEOREP" options"); +                        gf_msg (this->name, GF_LOG_ERROR, 0, +                                GD_MSG_DICT_GET_FAILED, "%s", errmsg); +                        goto out; +                } +                  is_no_verify = dict_get_str_boolean (dict, "no_verify", _gf_false);                  if (!is_no_verify) { @@ -2604,7 +2621,8 @@ glusterd_op_stage_gsync_create (dict_t *dict, char **op_errstr)                          * and if it has enough memory and bypass in case of force if                          * the error is not a force blocker */                          ret = glusterd_verify_slave (volname, slave_url, slave_vol, -                                                     op_errstr, &is_force_blocker); +                                                     ssh_port, op_errstr, +                                                     &is_force_blocker);                          if (ret) {                                  if (is_force && !is_force_blocker) {                                          gf_msg (this->name, GF_LOG_INFO, 0, @@ -5605,6 +5623,7 @@ glusterd_op_gsync_create (dict_t *dict, char **op_errstr, dict_t *rsp_dict)          char               *slave                     = NULL;          int32_t             ret                       = -1;          int32_t             is_pem_push               = -1; +        int32_t             ssh_port                  = 22;          gf_boolean_t        is_force                  = -1;          glusterd_conf_t    *conf                      = NULL;          glusterd_volinfo_t *volinfo                   = NULL; @@ -5684,6 +5703,15 @@ glusterd_op_gsync_create (dict_t *dict, char **op_errstr, dict_t *rsp_dict)                  goto out;          } +        ret = dict_get_int32 (dict, "ssh_port", &ssh_port); +        if (ret < 0 && ret != -ENOENT) { +                snprintf (errmsg, sizeof (errmsg), "Fetching ssh_port failed"); +                gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, +                        "%s", errmsg); +                ret = -1; +                goto out; +        } +          is_force = dict_get_str_boolean (dict, "force", _gf_false);          uuid_utoa_r (MY_UUID, uuid_str); @@ -5698,8 +5726,9 @@ glusterd_op_gsync_create (dict_t *dict, char **op_errstr, dict_t *rsp_dict)                  snprintf(hooks_args, sizeof(hooks_args),                           "is_push_pem=%d,pub_file=%s,slave_user=%s,slave_ip=%s," -                         "slave_vol=%s", is_pem_push, common_pem_file, -                         slave_user, slave_ip, slave_vol); +                         "slave_vol=%s,ssh_port=%d", is_pem_push, +                         common_pem_file, slave_user, slave_ip, slave_vol, +                         ssh_port);          } else                  snprintf(hooks_args, sizeof(hooks_args),                           "This argument will stop the hooks script");  | 
