From b01e8c10637875ad98e241bf3297197abe762040 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 17 Mar 2015 06:26:26 -0700 Subject: [PATCH] Include the FQDN version and non-stripped version of the hostname in our list of aliases as these (plus localhost) are the most common aliases we see. --- orte/util/proc_info.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/orte/util/proc_info.c b/orte/util/proc_info.c index 3c44ae2655..ce9260c2a0 100644 --- a/orte/util/proc_info.c +++ b/orte/util/proc_info.c @@ -171,6 +171,9 @@ int orte_proc_info(void) /* get the nodename */ gethostname(hostname, ORTE_MAX_HOSTNAME_SIZE); + /* add this to our list of aliases */ + opal_argv_append_nosize(&orte_process_info.aliases, hostname); + if (!orte_keep_fqdn_hostnames) { /* if the nodename is an IP address, do not mess with it! */ if (0 == inet_pton(AF_INET, hostname, &buf) && @@ -178,6 +181,8 @@ int orte_proc_info(void) /* not an IP address, so remove any domain info */ if (NULL != (ptr = strchr(hostname, '.'))) { *ptr = '\0'; + /* add this to our list of aliases */ + opal_argv_append_nosize(&orte_process_info.aliases, hostname); } } } @@ -209,6 +214,8 @@ int orte_proc_info(void) } else { orte_process_info.nodename = strdup(&hostname[idx]); } + /* add this to our list of aliases */ + opal_argv_append_nosize(&orte_process_info.aliases, orte_process_info.nodename); match = true; break; } @@ -222,6 +229,9 @@ int orte_proc_info(void) orte_process_info.nodename = strdup(hostname); } + /* add "localhost" to our list of aliases */ + opal_argv_append_nosize(&orte_process_info.aliases, "localhost"); + /* get the number of nodes in the job */ orte_process_info.num_nodes = 1; (void) mca_base_var_register ("orte", "orte", NULL, "num_nodes", @@ -333,17 +343,6 @@ bool orte_ifislocal(const char *hostname) { int i; - /* see if this matches our known hostname */ - if (NULL != orte_process_info.nodename && - 0 == strcmp(hostname, orte_process_info.nodename)) { - return true; - } - - /* see if it matches the generic "localhost" */ - if (0 == strcmp(hostname, "localhost")) { - return true; - } - /* see if it matches any of our known aliases */ if (NULL != orte_process_info.aliases) { for (i=0; NULL != orte_process_info.aliases[i]; i++) {