orte: Expand the application of !orte_keep_fqdn_hostnames
* Expand the use of the `orte_keep_fqdn_hostnames` MCA parameter when it is set to false. * If that parameter is set to false (default) then short hostnames (e.g., `node01`) will match with the long hostnames (e.g., `node01.mycluster.org`). This allows a user (or resource manager) to mix the use of short and long hostnames. - Note that this mechanism does _not_ perform a DNS lookup, but instead strips off the FQDN by truncating the hostname string at the first `.` character (when not an IP address). - By default (`false`) the following is true: `node01 == node01.mycluster.org == node01.bogus.com` since we use `node01` as the hostname.
Этот коммит содержится в:
родитель
19b0f4db9f
Коммит
d26dd2c20e
@ -16,6 +16,7 @@
|
|||||||
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
|
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
|
||||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
|
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -1528,7 +1529,7 @@ int orte_plm_base_setup_virtual_machine(orte_job_t *jdata)
|
|||||||
bool one_filter = false;
|
bool one_filter = false;
|
||||||
int num_nodes;
|
int num_nodes;
|
||||||
bool default_hostfile_used;
|
bool default_hostfile_used;
|
||||||
char *hosts;
|
char *hosts = NULL;
|
||||||
bool singleton=false;
|
bool singleton=false;
|
||||||
bool multi_sim = false;
|
bool multi_sim = false;
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
|
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
||||||
|
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -147,7 +148,7 @@ int orte_rmaps_base_get_target_nodes(opal_list_t *allocated_nodes, orte_std_cntr
|
|||||||
orte_job_t *daemons;
|
orte_job_t *daemons;
|
||||||
bool novm;
|
bool novm;
|
||||||
opal_list_t nodes;
|
opal_list_t nodes;
|
||||||
char *hosts;
|
char *hosts = NULL;
|
||||||
|
|
||||||
/** set default answer */
|
/** set default answer */
|
||||||
*total_num_slots = 0;
|
*total_num_slots = 0;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
||||||
* Copyright (c) 2015 Research Organization for Information Science
|
* Copyright (c) 2015 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
|
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||||
*
|
*
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
@ -33,6 +34,9 @@
|
|||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif /* HAVE_UNISTD_H */
|
#endif /* HAVE_UNISTD_H */
|
||||||
|
#if HAVE_ARPA_INET_H
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "opal/util/argv.h"
|
#include "opal/util/argv.h"
|
||||||
@ -488,6 +492,20 @@ static int orte_rmaps_rank_file_parse(const char *rankfile)
|
|||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
opal_argv_free (argv);
|
opal_argv_free (argv);
|
||||||
|
|
||||||
|
// Strip off the FQDN if present
|
||||||
|
if( !orte_keep_fqdn_hostnames ) {
|
||||||
|
char *ptr;
|
||||||
|
struct in_addr buf;
|
||||||
|
/* if the nodename is an IP address, do not mess with it! */
|
||||||
|
if (0 == inet_pton(AF_INET, node_name, &buf) &&
|
||||||
|
0 == inet_pton(AF_INET6, node_name, &buf)) {
|
||||||
|
if (NULL != (ptr = strchr(node_name, '.'))) {
|
||||||
|
*ptr = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* check the rank item */
|
/* check the rank item */
|
||||||
if (NULL == rfmap) {
|
if (NULL == rfmap) {
|
||||||
orte_show_help("help-rmaps_rank_file.txt", "bad-syntax", true, rankfile);
|
orte_show_help("help-rmaps_rank_file.txt", "bad-syntax", true, rankfile);
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
||||||
* Copyright (c) 2015 Research Organization for Information Science
|
* Copyright (c) 2015 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
|
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -70,9 +71,11 @@ static void sn_des(seq_node_t *p)
|
|||||||
{
|
{
|
||||||
if (NULL != p->hostname) {
|
if (NULL != p->hostname) {
|
||||||
free(p->hostname);
|
free(p->hostname);
|
||||||
|
p->hostname = NULL;
|
||||||
}
|
}
|
||||||
if (NULL != p->cpuset) {
|
if (NULL != p->cpuset) {
|
||||||
free(p->cpuset);
|
free(p->cpuset);
|
||||||
|
p->cpuset = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OBJ_CLASS_INSTANCE(seq_node_t,
|
OBJ_CLASS_INSTANCE(seq_node_t,
|
||||||
@ -101,7 +104,7 @@ static int orte_rmaps_seq_map(orte_job_t *jdata)
|
|||||||
opal_list_t node_list, *seq_list, sq_list;
|
opal_list_t node_list, *seq_list, sq_list;
|
||||||
orte_proc_t *proc;
|
orte_proc_t *proc;
|
||||||
mca_base_component_t *c = &mca_rmaps_seq_component.base_version;
|
mca_base_component_t *c = &mca_rmaps_seq_component.base_version;
|
||||||
char *hosts, *sep, *eptr;
|
char *hosts = NULL, *sep, *eptr;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
opal_hwloc_resource_type_t rtype;
|
opal_hwloc_resource_type_t rtype;
|
||||||
|
|
||||||
@ -156,7 +159,7 @@ static int orte_rmaps_seq_map(orte_job_t *jdata)
|
|||||||
/* if there is a default hostfile, go and get its ordered list of nodes */
|
/* if there is a default hostfile, go and get its ordered list of nodes */
|
||||||
OBJ_CONSTRUCT(&default_seq_list, opal_list_t);
|
OBJ_CONSTRUCT(&default_seq_list, opal_list_t);
|
||||||
if (NULL != orte_default_hostfile) {
|
if (NULL != orte_default_hostfile) {
|
||||||
char *hstname;
|
char *hstname = NULL;
|
||||||
/* open the file */
|
/* open the file */
|
||||||
fp = fopen(orte_default_hostfile, "r");
|
fp = fopen(orte_default_hostfile, "r");
|
||||||
if (NULL == fp) {
|
if (NULL == fp) {
|
||||||
@ -170,6 +173,11 @@ static int orte_rmaps_seq_map(orte_job_t *jdata)
|
|||||||
/* blank line - ignore */
|
/* blank line - ignore */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if( '#' == hstname[0] ) {
|
||||||
|
free(hstname);
|
||||||
|
/* Comment line - ignore */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
sq = OBJ_NEW(seq_node_t);
|
sq = OBJ_NEW(seq_node_t);
|
||||||
if (NULL != (sep = strchr(hstname, ' '))) {
|
if (NULL != (sep = strchr(hstname, ' '))) {
|
||||||
*sep = '\0';
|
*sep = '\0';
|
||||||
@ -182,6 +190,21 @@ static int orte_rmaps_seq_map(orte_job_t *jdata)
|
|||||||
*(eptr+1) = 0;
|
*(eptr+1) = 0;
|
||||||
sq->cpuset = strdup(sep);
|
sq->cpuset = strdup(sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Strip off the FQDN if present
|
||||||
|
if( !orte_keep_fqdn_hostnames ) {
|
||||||
|
char *ptr;
|
||||||
|
struct in_addr buf;
|
||||||
|
|
||||||
|
/* if the nodename is an IP address, do not mess with it! */
|
||||||
|
if (0 == inet_pton(AF_INET, hstname, &buf) &&
|
||||||
|
0 == inet_pton(AF_INET6, hstname, &buf)) {
|
||||||
|
if (NULL != (ptr = strchr(hstname, '.'))) {
|
||||||
|
*ptr = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sq->hostname = hstname;
|
sq->hostname = hstname;
|
||||||
opal_list_append(&default_seq_list, &sq->super);
|
opal_list_append(&default_seq_list, &sq->super);
|
||||||
}
|
}
|
||||||
@ -255,6 +278,16 @@ static int orte_rmaps_seq_map(orte_job_t *jdata)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
while (NULL != (hstname = orte_getline(fp))) {
|
while (NULL != (hstname = orte_getline(fp))) {
|
||||||
|
if (0 == strlen(hstname)) {
|
||||||
|
free(hstname);
|
||||||
|
/* blank line - ignore */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if( '#' == hstname[0] ) {
|
||||||
|
free(hstname);
|
||||||
|
/* Comment line - ignore */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
sq = OBJ_NEW(seq_node_t);
|
sq = OBJ_NEW(seq_node_t);
|
||||||
if (NULL != (sep = strchr(hstname, ' '))) {
|
if (NULL != (sep = strchr(hstname, ' '))) {
|
||||||
*sep = '\0';
|
*sep = '\0';
|
||||||
@ -267,6 +300,20 @@ static int orte_rmaps_seq_map(orte_job_t *jdata)
|
|||||||
*(eptr+1) = 0;
|
*(eptr+1) = 0;
|
||||||
sq->cpuset = strdup(sep);
|
sq->cpuset = strdup(sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Strip off the FQDN if present
|
||||||
|
if( !orte_keep_fqdn_hostnames ) {
|
||||||
|
char *ptr;
|
||||||
|
struct in_addr buf;
|
||||||
|
/* if the nodename is an IP address, do not mess with it! */
|
||||||
|
if (0 == inet_pton(AF_INET, hstname, &buf) &&
|
||||||
|
0 == inet_pton(AF_INET6, hstname, &buf)) {
|
||||||
|
if (NULL != (ptr = strchr(hstname, '.'))) {
|
||||||
|
(*ptr) = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sq->hostname = hstname;
|
sq->hostname = hstname;
|
||||||
opal_list_append(&sq_list, &sq->super);
|
opal_list_append(&sq_list, &sq->super);
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
||||||
* Copyright (c) 2015 Research Organization for Information Science
|
* Copyright (c) 2015 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
|
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -23,6 +24,9 @@
|
|||||||
#include "orte_config.h"
|
#include "orte_config.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#if HAVE_ARPA_INET_H
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "orte/constants.h"
|
#include "orte/constants.h"
|
||||||
#include "orte/types.h"
|
#include "orte/types.h"
|
||||||
@ -207,6 +211,19 @@ int orte_util_add_dash_host_nodes(opal_list_t *nodes,
|
|||||||
ndname = mini_map[i];
|
ndname = mini_map[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Strip off the FQDN if present
|
||||||
|
if( !orte_keep_fqdn_hostnames ) {
|
||||||
|
char *ptr;
|
||||||
|
struct in_addr buf;
|
||||||
|
/* if the nodename is an IP address, do not mess with it! */
|
||||||
|
if (0 == inet_pton(AF_INET, ndname, &buf) &&
|
||||||
|
0 == inet_pton(AF_INET6, ndname, &buf)) {
|
||||||
|
if (NULL != (ptr = strchr(ndname, '.'))) {
|
||||||
|
*ptr = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* see if the node is already on the list */
|
/* see if the node is already on the list */
|
||||||
found = false;
|
found = false;
|
||||||
OPAL_LIST_FOREACH(node, &adds, orte_node_t) {
|
OPAL_LIST_FOREACH(node, &adds, orte_node_t) {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved.
|
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved.
|
||||||
* Copyright (c) 2015 Research Organization for Information Science
|
* Copyright (c) 2015 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
|
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -27,6 +28,9 @@
|
|||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if HAVE_ARPA_INET_H
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -164,6 +168,19 @@ static int hostfile_parse_line(int token, opal_list_t* updates,
|
|||||||
}
|
}
|
||||||
opal_argv_free (argv);
|
opal_argv_free (argv);
|
||||||
|
|
||||||
|
// Strip off the FQDN if present
|
||||||
|
if( !orte_keep_fqdn_hostnames ) {
|
||||||
|
char *ptr;
|
||||||
|
struct in_addr buf;
|
||||||
|
/* if the nodename is an IP address, do not mess with it! */
|
||||||
|
if (0 == inet_pton(AF_INET, node_name, &buf) &&
|
||||||
|
0 == inet_pton(AF_INET6, node_name, &buf)) {
|
||||||
|
if (NULL != (ptr = strchr(node_name, '.'))) {
|
||||||
|
*ptr = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* if the first letter of the name is '^', then this is a node
|
/* if the first letter of the name is '^', then this is a node
|
||||||
* to be excluded. Remove the ^ character so the nodename is
|
* to be excluded. Remove the ^ character so the nodename is
|
||||||
* usable, and put it on the exclude list
|
* usable, and put it on the exclude list
|
||||||
@ -270,6 +287,20 @@ static int hostfile_parse_line(int token, opal_list_t* updates,
|
|||||||
opal_output(0, "WARNING: Unhandled user@host-combination\n"); /* XXX */
|
opal_output(0, "WARNING: Unhandled user@host-combination\n"); /* XXX */
|
||||||
}
|
}
|
||||||
opal_argv_free (argv);
|
opal_argv_free (argv);
|
||||||
|
|
||||||
|
// Strip off the FQDN if present
|
||||||
|
if( !orte_keep_fqdn_hostnames ) {
|
||||||
|
char *ptr;
|
||||||
|
struct in_addr buf;
|
||||||
|
/* if the nodename is an IP address, do not mess with it! */
|
||||||
|
if (0 == inet_pton(AF_INET, node_name, &buf) &&
|
||||||
|
0 == inet_pton(AF_INET6, node_name, &buf)) {
|
||||||
|
if (NULL != (ptr = strchr(node_name, '.'))) {
|
||||||
|
*ptr = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Do we need to make a new node object? */
|
/* Do we need to make a new node object? */
|
||||||
if (NULL == (node = hostfile_lookup(updates, node_name))) {
|
if (NULL == (node = hostfile_lookup(updates, node_name))) {
|
||||||
node = OBJ_NEW(orte_node_t);
|
node = OBJ_NEW(orte_node_t);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user