Skip to content
Snippets Groups Projects
Commit 94c998e3 authored by Moe Jette's avatar Moe Jette
Browse files

Load bluegene.conf and federation.conf based upon SLURM_CONF env

    var (if set).
parent 4073d99a
No related branches found
No related tags found
No related merge requests found
This file describes changes in recent versions of SLURM. It primarily This file describes changes in recent versions of SLURM. It primarily
documents those changes that are of interest to users and admins. documents those changes that are of interest to users and admins.
* Changes in SLURM 0.5.0-pre6
=============================
-- Load bluegene.conf and federation.conf based upon SLURM_CONF env
var (if set).
* Changes in SLURM 0.5.0-pre5 * Changes in SLURM 0.5.0-pre5
============================= =============================
-- Modify slurmctld node hashing function to reduce collisions. -- Modify slurmctld node hashing function to reduce collisions.
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#define _DEBUG 0 #define _DEBUG 0
char* bgl_conf = BLUEGENE_CONFIG_FILE; char* bgl_conf = NULL;
/* Global variables */ /* Global variables */
rm_BGL_t *bgl; rm_BGL_t *bgl;
...@@ -670,7 +670,7 @@ extern int create_static_partitions(List part_list) ...@@ -670,7 +670,7 @@ extern int create_static_partitions(List part_list)
#endif #endif
/* Here we are adding a partition that in for the entire machine /* Here we are adding a partition that in for the entire machine
just incase it isn't in the bluegene.conf file. just in case it isn't in the bluegene.conf file.
*/ */
reset_pa_system(); reset_pa_system();
...@@ -1173,6 +1173,28 @@ static int _delete_old_partitions(void) ...@@ -1173,6 +1173,28 @@ static int _delete_old_partitions(void)
return SLURM_SUCCESS; return SLURM_SUCCESS;
} }
static char *_get_bgl_conf(void)
{
char *val = getenv("SLURM_CONF");
char *rc;
int i;
if (!val)
return xstrdup(BLUEGENE_CONFIG_FILE);
/* Replace file name on end of path */
i = strlen(val) - strlen("slurm.conf") + strlen("bluegene.conf") + 1;
rc = xmalloc(i);
strcpy(rc, val);
val = strrchr(rc, (int)'/');
if (val) /* absolute path */
val++;
else /* not absolute path */
val = rc;
strcpy(val, "bluegene.conf");
return rc;
}
/* /*
* Read and process the bluegene.conf configuration file so to interpret what * Read and process the bluegene.conf configuration file so to interpret what
* partitions are static/dynamic, torus/mesh, etc. * partitions are static/dynamic, torus/mesh, etc.
...@@ -1190,7 +1212,7 @@ extern int read_bgl_conf(void) ...@@ -1190,7 +1212,7 @@ extern int read_bgl_conf(void)
/* check if config file has changed */ /* check if config file has changed */
if (!bgl_conf) if (!bgl_conf)
fatal("bluegene.conf file not defined"); bgl_conf = _get_bgl_conf();
if (stat(bgl_conf, &config_stat) < 0) if (stat(bgl_conf, &config_stat) < 0)
fatal("can't stat bluegene.conf file %s: %m", bgl_conf); fatal("can't stat bluegene.conf file %s: %m", bgl_conf);
if (last_config_update) { if (last_config_update) {
...@@ -1222,6 +1244,7 @@ extern int read_bgl_conf(void) ...@@ -1222,6 +1244,7 @@ extern int read_bgl_conf(void)
error("_read_bgl_config line %d, of input file %s " error("_read_bgl_config line %d, of input file %s "
"too long", line_num, bgl_conf); "too long", line_num, bgl_conf);
fclose(bgl_spec_file); fclose(bgl_spec_file);
xfree(bgl_conf);
return E2BIG; return E2BIG;
} }
...@@ -1251,6 +1274,7 @@ extern int read_bgl_conf(void) ...@@ -1251,6 +1274,7 @@ extern int read_bgl_conf(void)
report_leftover(in_line, line_num); report_leftover(in_line, line_num);
} }
fclose(bgl_spec_file); fclose(bgl_spec_file);
xfree(bgl_conf);
if (!bluegene_blrts) if (!bluegene_blrts)
fatal("BlrtsImage not configured in bluegene.conf"); fatal("BlrtsImage not configured in bluegene.conf");
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
#define ZERO 48 #define ZERO 48
#define BUFSIZE 4096 #define BUFSIZE 4096
char* fed_conf = FEDERATION_CONFIG_FILE; char* fed_conf = NULL;
/* /*
* Data structures specific to Federation * Data structures specific to Federation
...@@ -398,6 +398,28 @@ static int _set_up_adapter(fed_adapter_t *fed_adapter, char *adapter_name) ...@@ -398,6 +398,28 @@ static int _set_up_adapter(fed_adapter_t *fed_adapter, char *adapter_name)
return SLURM_SUCCESS; return SLURM_SUCCESS;
} }
static char *_get_fed_conf(void)
{
char *val = getenv("SLURM_CONF");
char *rc;
int i;
if (!val)
return xstrdup(FEDERATION_CONFIG_FILE);
/* Replace file name on end of path */
i = strlen(val) - strlen("slurm.conf") + strlen("federation.conf") + 1;
rc = xmalloc(i);
strcpy(rc, val);
val = strrchr(rc, (int)'/');
if (val) /* absolute path */
val++;
else /* not absolute path */
val = rc;
strcpy(val, "federation.conf");
return rc;
}
static int _parse_fed_file(hostlist_t *adapter_list) static int _parse_fed_file(hostlist_t *adapter_list)
{ {
FILE *fed_spec_file; /* pointer to input data file */ FILE *fed_spec_file; /* pointer to input data file */
...@@ -409,7 +431,7 @@ static int _parse_fed_file(hostlist_t *adapter_list) ...@@ -409,7 +431,7 @@ static int _parse_fed_file(hostlist_t *adapter_list)
debug("Reading the federation.conf file"); debug("Reading the federation.conf file");
if (!fed_conf) if (!fed_conf)
fatal("federation.conf file not defined"); fed_conf = _get_fed_conf();
fed_spec_file = fopen(fed_conf, "r"); fed_spec_file = fopen(fed_conf, "r");
if (fed_spec_file == NULL) if (fed_spec_file == NULL)
fatal("_get_adapters error opening file %s, %m", fatal("_get_adapters error opening file %s, %m",
...@@ -423,6 +445,7 @@ static int _parse_fed_file(hostlist_t *adapter_list) ...@@ -423,6 +445,7 @@ static int _parse_fed_file(hostlist_t *adapter_list)
error("_get_adapters line %d, of input file %s " error("_get_adapters line %d, of input file %s "
"too long", line_num, fed_conf); "too long", line_num, fed_conf);
fclose(fed_spec_file); fclose(fed_spec_file);
xfree(fed_conf);
return E2BIG; return E2BIG;
} }
...@@ -444,6 +467,7 @@ static int _parse_fed_file(hostlist_t *adapter_list) ...@@ -444,6 +467,7 @@ static int _parse_fed_file(hostlist_t *adapter_list)
report_leftover(in_line, line_num); report_leftover(in_line, line_num);
} }
fclose(fed_spec_file); fclose(fed_spec_file);
xfree(fed_conf);
return SLURM_SUCCESS; return SLURM_SUCCESS;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment