Merge pull request #535 from rhc54/topic/rsh
Add the ability to pass args to the rsh/ssh command line
Этот коммит содержится в:
Коммит
79b9c50717
@ -13,6 +13,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011 IBM Corporation. All rights reserved.
|
||||
* Copyright (c) 2015 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -62,6 +63,9 @@ struct orte_plm_rsh_component_t {
|
||||
char *agent;
|
||||
bool assume_same_shell;
|
||||
bool pass_environ_mca_params;
|
||||
char *ssh_args;
|
||||
char *pass_path;
|
||||
char *pass_libpath;
|
||||
};
|
||||
typedef struct orte_plm_rsh_component_t orte_plm_rsh_component_t;
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011 IBM Corporation. All rights reserved.
|
||||
* Copyright (c) 2015 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -201,6 +202,29 @@ static int rsh_component_register(void)
|
||||
OPAL_INFO_LVL_9,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
&mca_plm_rsh_component.pass_environ_mca_params);
|
||||
mca_plm_rsh_component.ssh_args = NULL;
|
||||
(void) mca_base_component_var_register (c, "args",
|
||||
"Arguments to add to rsh/ssh",
|
||||
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
||||
OPAL_INFO_LVL_9,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
&mca_plm_rsh_component.ssh_args);
|
||||
|
||||
mca_plm_rsh_component.pass_path = NULL;
|
||||
(void) mca_base_component_var_register (c, "pass_path",
|
||||
"Prepend the specified path to the remote shell's path",
|
||||
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
||||
OPAL_INFO_LVL_9,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
&mca_plm_rsh_component.pass_path);
|
||||
|
||||
mca_plm_rsh_component.pass_libpath = NULL;
|
||||
(void) mca_base_component_var_register (c, "pass_libpath",
|
||||
"Prepend the specified library path to the remote shell's LD_LIBRARY_PATH",
|
||||
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
||||
OPAL_INFO_LVL_9,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
&mca_plm_rsh_component.pass_libpath);
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011 IBM Corporation. All rights reserved.
|
||||
* Copyright (c) 2014 Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -339,6 +339,7 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
int rc;
|
||||
int i, j;
|
||||
bool found;
|
||||
char *lib_base, *bin_base;
|
||||
|
||||
/* Figure out the basenames for the libdir and bindir. This
|
||||
requires some explanation:
|
||||
@ -372,6 +373,15 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
*/
|
||||
argv = opal_argv_copy(rsh_agent_argv);
|
||||
argc = opal_argv_count(rsh_agent_argv);
|
||||
/* if any ssh args were provided, now is the time to add them */
|
||||
if (NULL != mca_plm_rsh_component.ssh_args) {
|
||||
char **ssh_argv;
|
||||
ssh_argv = opal_argv_split(mca_plm_rsh_component.ssh_args, ' ');
|
||||
for (i=0; NULL != ssh_argv[i]; i++) {
|
||||
opal_argv_append(&argc, &argv, ssh_argv[i]);
|
||||
}
|
||||
opal_argv_free(ssh_argv);
|
||||
}
|
||||
*node_name_index1 = argc;
|
||||
opal_argv_append(&argc, &argv, "<template>");
|
||||
|
||||
@ -432,6 +442,22 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
}
|
||||
opal_argv_free(orted_argv); /* done with this */
|
||||
|
||||
/* if the user specified a path to pass, set it up now */
|
||||
value = opal_basename(opal_install_dirs.bindir);
|
||||
if (NULL != mca_plm_rsh_component.pass_path) {
|
||||
asprintf(&bin_base, "%s:%s/%s", mca_plm_rsh_component.pass_path, prefix_dir, value);
|
||||
} else {
|
||||
asprintf(&bin_base, "%s/%s", prefix_dir, value);
|
||||
}
|
||||
|
||||
/* if the user specified a library path to pass, set it up now */
|
||||
value = opal_basename(opal_install_dirs.libdir);
|
||||
if (NULL != mca_plm_rsh_component.pass_path) {
|
||||
asprintf(&lib_base, "%s:%s/%s", mca_plm_rsh_component.pass_libpath, prefix_dir, value);
|
||||
} else {
|
||||
asprintf(&lib_base, "%s/%s", prefix_dir, value);
|
||||
}
|
||||
|
||||
/* we now need to assemble the actual cmd that will be executed - this depends
|
||||
* upon whether or not a prefix directory is being used
|
||||
*/
|
||||
@ -442,9 +468,7 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
*/
|
||||
char *opal_prefix = getenv("OPAL_PREFIX");
|
||||
char* full_orted_cmd = NULL;
|
||||
char *lib_base, *bin_base;
|
||||
|
||||
bin_base = opal_basename(opal_install_dirs.bindir);
|
||||
|
||||
if (NULL != orted_cmd) {
|
||||
if (0 == strcmp(orted_cmd, "orted")) {
|
||||
@ -457,8 +481,6 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
free(orted_cmd);
|
||||
}
|
||||
|
||||
lib_base = opal_basename(opal_install_dirs.libdir);
|
||||
|
||||
if (ORTE_PLM_RSH_SHELL_SH == remote_shell ||
|
||||
ORTE_PLM_RSH_SHELL_KSH == remote_shell ||
|
||||
ORTE_PLM_RSH_SHELL_ZSH == remote_shell ||
|
||||
@ -468,16 +490,14 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
* we have to insert the orted_prefix in the right place
|
||||
*/
|
||||
(void)asprintf (&final_cmd,
|
||||
"%s%s%s PATH=%s/%s:$PATH ; export PATH ; "
|
||||
"LD_LIBRARY_PATH=%s/%s:$LD_LIBRARY_PATH ; export LD_LIBRARY_PATH ; "
|
||||
"DYLD_LIBRARY_PATH=%s/%s:$DYLD_LIBRARY_PATH ; export DYLD_LIBRARY_PATH ; "
|
||||
"%s%s%s PATH=%s:$PATH ; export PATH ; "
|
||||
"LD_LIBRARY_PATH=%s:$LD_LIBRARY_PATH ; export LD_LIBRARY_PATH ; "
|
||||
"DYLD_LIBRARY_PATH=%s:$DYLD_LIBRARY_PATH ; export DYLD_LIBRARY_PATH ; "
|
||||
"%s %s",
|
||||
(opal_prefix != NULL ? "OPAL_PREFIX=" : " "),
|
||||
(opal_prefix != NULL ? opal_prefix : " "),
|
||||
(opal_prefix != NULL ? " ; export OPAL_PREFIX;" : " "),
|
||||
prefix_dir, bin_base,
|
||||
prefix_dir, lib_base,
|
||||
prefix_dir, lib_base,
|
||||
bin_base, lib_base, lib_base,
|
||||
(orted_prefix != NULL ? orted_prefix : " "),
|
||||
(full_orted_cmd != NULL ? full_orted_cmd : " "));
|
||||
} else if (ORTE_PLM_RSH_SHELL_TCSH == remote_shell ||
|
||||
@ -495,28 +515,25 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
* we have to insert the orted_prefix in the right place
|
||||
*/
|
||||
(void)asprintf (&final_cmd,
|
||||
"%s%s%s set path = ( %s/%s $path ) ; "
|
||||
"%s%s%s set path = ( %s $path ) ; "
|
||||
"if ( $?LD_LIBRARY_PATH == 1 ) "
|
||||
"set OMPI_have_llp ; "
|
||||
"if ( $?LD_LIBRARY_PATH == 0 ) "
|
||||
"setenv LD_LIBRARY_PATH %s/%s ; "
|
||||
"setenv LD_LIBRARY_PATH %s ; "
|
||||
"if ( $?OMPI_have_llp == 1 ) "
|
||||
"setenv LD_LIBRARY_PATH %s/%s:$LD_LIBRARY_PATH ; "
|
||||
"setenv LD_LIBRARY_PATH %s:$LD_LIBRARY_PATH ; "
|
||||
"if ( $?DYLD_LIBRARY_PATH == 1 ) "
|
||||
"set OMPI_have_dllp ; "
|
||||
"if ( $?DYLD_LIBRARY_PATH == 0 ) "
|
||||
"setenv DYLD_LIBRARY_PATH %s/%s ; "
|
||||
"setenv DYLD_LIBRARY_PATH %s ; "
|
||||
"if ( $?OMPI_have_dllp == 1 ) "
|
||||
"setenv DYLD_LIBRARY_PATH %s/%s:$DYLD_LIBRARY_PATH ; "
|
||||
"setenv DYLD_LIBRARY_PATH %s:$DYLD_LIBRARY_PATH ; "
|
||||
"%s %s",
|
||||
(opal_prefix != NULL ? "setenv OPAL_PREFIX " : " "),
|
||||
(opal_prefix != NULL ? opal_prefix : " "),
|
||||
(opal_prefix != NULL ? " ;" : " "),
|
||||
prefix_dir, bin_base,
|
||||
prefix_dir, lib_base,
|
||||
prefix_dir, lib_base,
|
||||
prefix_dir, lib_base,
|
||||
prefix_dir, lib_base,
|
||||
bin_base, lib_base, lib_base,
|
||||
lib_base, lib_base,
|
||||
(orted_prefix != NULL ? orted_prefix : " "),
|
||||
(full_orted_cmd != NULL ? full_orted_cmd : " "));
|
||||
} else {
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user