Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion orte/mca/plm/base/plm_base_launch_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -1528,7 +1529,7 @@ int orte_plm_base_setup_virtual_machine(orte_job_t *jdata)
bool one_filter = false;
int num_nodes;
bool default_hostfile_used;
char *hosts;
char *hosts = NULL;
bool singleton=false;
bool multi_sim = false;

Expand Down
3 changes: 2 additions & 1 deletion orte/mca/rmaps/base/rmaps_base_support_fns.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -147,7 +148,7 @@ int orte_rmaps_base_get_target_nodes(opal_list_t *allocated_nodes, orte_std_cntr
orte_job_t *daemons;
bool novm;
opal_list_t nodes;
char *hosts;
char *hosts = NULL;

/** set default answer */
*total_num_slots = 0;
Expand Down
18 changes: 18 additions & 0 deletions orte/mca/rmaps/rank_file/rmaps_rank_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
*
* $COPYRIGHT$
*
Expand All @@ -33,6 +34,9 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#include <string.h>

#include "opal/util/argv.h"
Expand Down Expand Up @@ -488,6 +492,20 @@ static int orte_rmaps_rank_file_parse(const char *rankfile)
goto unlock;
}
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 */
if (NULL == rfmap) {
orte_show_help("help-rmaps_rank_file.txt", "bad-syntax", true, rankfile);
Expand Down
51 changes: 49 additions & 2 deletions orte/mca/rmaps/seq/rmaps_seq.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -70,9 +71,11 @@ static void sn_des(seq_node_t *p)
{
if (NULL != p->hostname) {
free(p->hostname);
p->hostname = NULL;
}
if (NULL != p->cpuset) {
free(p->cpuset);
p->cpuset = NULL;
}
}
OBJ_CLASS_INSTANCE(seq_node_t,
Expand Down Expand Up @@ -101,7 +104,7 @@ static int orte_rmaps_seq_map(orte_job_t *jdata)
opal_list_t node_list, *seq_list, sq_list;
orte_proc_t *proc;
mca_base_component_t *c = &mca_rmaps_seq_component.base_version;
char *hosts, *sep, *eptr;
char *hosts = NULL, *sep, *eptr;
FILE *fp;
opal_hwloc_resource_type_t rtype;

Expand Down Expand Up @@ -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 */
OBJ_CONSTRUCT(&default_seq_list, opal_list_t);
if (NULL != orte_default_hostfile) {
char *hstname;
char *hstname = NULL;
/* open the file */
fp = fopen(orte_default_hostfile, "r");
if (NULL == fp) {
Expand All @@ -170,6 +173,11 @@ static int orte_rmaps_seq_map(orte_job_t *jdata)
/* blank line - ignore */
continue;
}
if( '#' == hstname[0] ) {
free(hstname);
/* Comment line - ignore */
continue;
}
sq = OBJ_NEW(seq_node_t);
if (NULL != (sep = strchr(hstname, ' '))) {
*sep = '\0';
Expand All @@ -182,6 +190,21 @@ static int orte_rmaps_seq_map(orte_job_t *jdata)
*(eptr+1) = 0;
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;
opal_list_append(&default_seq_list, &sq->super);
}
Expand Down Expand Up @@ -255,6 +278,16 @@ static int orte_rmaps_seq_map(orte_job_t *jdata)
goto error;
}
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);
if (NULL != (sep = strchr(hstname, ' '))) {
*sep = '\0';
Expand All @@ -267,6 +300,20 @@ static int orte_rmaps_seq_map(orte_job_t *jdata)
*(eptr+1) = 0;
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;
opal_list_append(&sq_list, &sq->super);
}
Expand Down
17 changes: 17 additions & 0 deletions orte/util/dash_host/dash_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -23,6 +24,9 @@
#include "orte_config.h"

#include <string.h>
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif

#include "orte/constants.h"
#include "orte/types.h"
Expand Down Expand Up @@ -207,6 +211,19 @@ int orte_util_add_dash_host_nodes(opal_list_t *nodes,
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 */
found = false;
OPAL_LIST_FOREACH(node, &adds, orte_node_t) {
Expand Down
31 changes: 31 additions & 0 deletions orte/util/hostfile/hostfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -27,6 +28,9 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -164,6 +168,19 @@ static int hostfile_parse_line(int token, opal_list_t* updates,
}
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
* to be excluded. Remove the ^ character so the nodename is
* usable, and put it on the exclude list
Expand Down Expand Up @@ -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_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? */
if (NULL == (node = hostfile_lookup(updates, node_name))) {
node = OBJ_NEW(orte_node_t);
Expand Down