2
2
* read_config.c - read the overall slurm configuration file
3
3
*****************************************************************************
4
4
* Copyright (C) 2002-2007 The Regents of the University of California.
5
* Copyright (C) 2008 Lawrence Livermore National Security.
5
* Copyright (C) 2008-2009 Lawrence Livermore National Security.
6
6
* Portions Copyright (C) 2008 Vijay Ramasubramanian.
7
7
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
8
8
* Written by Morris Jette <jette1@llnl.gov>.
9
* CODE-OCEC-09-009. All rights reserved.
11
11
* This file is part of SLURM, a resource management program.
12
* For details, see <http://www.llnl.gov/linux/slurm/>.
12
* For details, see <https://computing.llnl.gov/linux/slurm/>.
13
* Please also read the included file: DISCLAIMER.
14
15
* SLURM is free software; you can redistribute it and/or modify it under
15
16
* the terms of the GNU General Public License as published by the Free
106
108
static names_ll_t *host_to_node_hashtbl[NAME_HASH_LEN] = {NULL};
107
109
static names_ll_t *node_to_host_hashtbl[NAME_HASH_LEN] = {NULL};
109
static int parse_nodename(void **dest, slurm_parser_enum_t type,
110
const char *key, const char *value,
111
const char *line, char **leftover);
112
static void destroy_nodename(void *ptr);
113
static int parse_partitionname(void **dest, slurm_parser_enum_t type,
114
const char *key, const char *value,
115
const char *line, char **leftover);
116
static void destroy_partitionname(void *ptr);
117
static int parse_downnodes(void **dest, slurm_parser_enum_t type,
118
const char *key, const char *value,
119
const char *line, char **leftover);
120
static void destroy_downnodes(void *ptr);
121
static int defunct_option(void **dest, slurm_parser_enum_t type,
122
const char *key, const char *value,
123
const char *line, char **leftover);
124
static void validate_and_set_defaults(slurm_ctl_conf_t *conf,
125
s_p_hashtbl_t *hashtbl);
111
static int _parse_nodename(void **dest, slurm_parser_enum_t type,
112
const char *key, const char *value,
113
const char *line, char **leftover);
114
static void _destroy_nodename(void *ptr);
115
static bool _is_valid_dir(char *file_name);
116
static int _parse_partitionname(void **dest, slurm_parser_enum_t type,
117
const char *key, const char *value,
118
const char *line, char **leftover);
119
static void _destroy_partitionname(void *ptr);
120
static int _parse_downnodes(void **dest, slurm_parser_enum_t type,
121
const char *key, const char *value,
122
const char *line, char **leftover);
123
static void _destroy_downnodes(void *ptr);
124
static int _defunct_option(void **dest, slurm_parser_enum_t type,
125
const char *key, const char *value,
126
const char *line, char **leftover);
127
static void _validate_and_set_defaults(slurm_ctl_conf_t *conf,
128
s_p_hashtbl_t *hashtbl);
127
130
s_p_options_t slurm_conf_options[] = {
128
131
{"AccountingStorageEnforce", S_P_STRING},
129
132
{"AccountingStorageHost", S_P_STRING},
133
{"AccountingStorageBackupHost", S_P_STRING},
130
134
{"AccountingStorageLoc", S_P_STRING},
131
135
{"AccountingStoragePass", S_P_STRING},
132
136
{"AccountingStoragePort", S_P_UINT32},
139
143
{"CheckpointType", S_P_STRING},
140
144
{"CacheGroups", S_P_UINT16},
141
145
{"ClusterName", S_P_STRING},
146
{"CompleteWait", S_P_UINT16},
142
147
{"ControlAddr", S_P_STRING},
143
148
{"ControlMachine", S_P_STRING},
144
149
{"CryptoType", S_P_STRING},
150
{"DebugFlags", S_P_STRING},
145
151
{"DefaultStorageHost", S_P_STRING},
146
152
{"DefaultStorageLoc", S_P_STRING},
147
153
{"DefaultStoragePass", S_P_STRING},
150
156
{"DefaultStorageUser", S_P_STRING},
151
157
{"DefMemPerCPU", S_P_UINT32},
152
158
{"DefMemPerNode", S_P_UINT32},
153
{"DefMemPerTask", S_P_UINT32}, /* defunct */
154
159
{"DisableRootJobs", S_P_BOOLEAN},
155
160
{"EnforcePartLimits", S_P_BOOLEAN},
156
161
{"Epilog", S_P_STRING},
157
162
{"EpilogMsgTime", S_P_UINT32},
163
{"EPilogSlurmctld", S_P_STRING},
158
164
{"FastSchedule", S_P_UINT16},
159
165
{"FirstJobId", S_P_UINT32},
160
166
{"GetEnvTimeout", S_P_UINT16},
161
{"HashBase", S_P_LONG, defunct_option},
162
{"HeartbeatInterval", S_P_LONG, defunct_option},
167
{"HashBase", S_P_LONG, _defunct_option},
168
{"HeartbeatInterval", S_P_LONG, _defunct_option},
163
169
{"HealthCheckInterval", S_P_UINT16},
164
170
{"HealthCheckProgram", S_P_STRING},
165
171
{"InactiveLimit", S_P_UINT16},
166
172
{"JobAcctGatherType", S_P_STRING},
167
{"JobAcctFrequency", S_P_UINT16, defunct_option},
173
{"JobAcctFrequency", S_P_UINT16, _defunct_option},
168
174
{"JobAcctGatherFrequency", S_P_UINT16},
169
175
{"JobAcctLogFile", S_P_STRING},
170
176
{"JobAcctType", S_P_STRING},
177
{"JobCheckpointDir", S_P_STRING},
171
178
{"JobCompHost", S_P_STRING},
172
179
{"JobCompLoc", S_P_STRING},
173
180
{"JobCompPass", S_P_STRING},
178
185
{"JobCredentialPublicCertificate", S_P_STRING},
179
186
{"JobFileAppend", S_P_UINT16},
180
187
{"JobRequeue", S_P_UINT16},
181
{"KillTree", S_P_UINT16, defunct_option},
188
{"KillTree", S_P_UINT16, _defunct_option},
189
{"KillOnBadExit", S_P_UINT16},
182
190
{"KillWait", S_P_UINT16},
183
191
{"Licenses", S_P_STRING},
184
192
{"MailProg", S_P_STRING},
188
196
{"MaxMemPerTask", S_P_UINT32}, /* defunct */
189
197
{"MessageTimeout", S_P_UINT16},
190
198
{"MinJobAge", S_P_UINT16},
191
{"MpichGmDirectSupport", S_P_LONG, defunct_option},
199
{"MpichGmDirectSupport", S_P_LONG, _defunct_option},
192
200
{"MpiDefault", S_P_STRING},
201
{"MpiParams", S_P_STRING},
202
{"OverTimeLimit", S_P_UINT16},
193
203
{"PluginDir", S_P_STRING},
194
204
{"PlugStackConfig", S_P_STRING},
205
{"PriorityDecayHalfLife", S_P_STRING},
206
{"PriorityFavorSmall", S_P_BOOLEAN},
207
{"PriorityMaxAge", S_P_STRING},
208
{"PriorityUsageResetPeriod", S_P_STRING},
209
{"PriorityType", S_P_STRING},
210
{"PriorityWeightAge", S_P_UINT32},
211
{"PriorityWeightFairshare", S_P_UINT32},
212
{"PriorityWeightJobSize", S_P_UINT32},
213
{"PriorityWeightPartition", S_P_UINT32},
214
{"PriorityWeightQOS", S_P_UINT32},
195
215
{"PrivateData", S_P_STRING},
196
216
{"ProctrackType", S_P_STRING},
197
217
{"Prolog", S_P_STRING},
218
{"PrologSlurmctld", S_P_STRING},
198
219
{"PropagatePrioProcess", S_P_UINT16},
199
220
{"PropagateResourceLimitsExcept", S_P_STRING},
200
221
{"PropagateResourceLimits", S_P_STRING},
201
222
{"ResumeProgram", S_P_STRING},
202
223
{"ResumeRate", S_P_UINT16},
224
{"ResumeTimeout", S_P_UINT16},
225
{"ResvOverRun", S_P_UINT16},
203
226
{"ReturnToService", S_P_UINT16},
204
227
{"SallocDefaultCommand", S_P_STRING},
205
{"SchedulerAuth", S_P_STRING, defunct_option},
228
{"SchedulerAuth", S_P_STRING, _defunct_option},
206
229
{"SchedulerParameters", S_P_STRING},
207
230
{"SchedulerPort", S_P_UINT16},
208
231
{"SchedulerRootFilter", S_P_UINT16},
211
234
{"SelectType", S_P_STRING},
212
235
{"SelectTypeParameters", S_P_STRING},
213
236
{"SlurmUser", S_P_STRING},
237
{"SlurmdUser", S_P_STRING},
214
238
{"SlurmctldDebug", S_P_UINT16},
215
239
{"SlurmctldLogFile", S_P_STRING},
216
240
{"SlurmctldPidFile", S_P_STRING},
223
247
{"SlurmdSpoolDir", S_P_STRING},
224
248
{"SlurmdTimeout", S_P_UINT16},
225
249
{"SrunEpilog", S_P_STRING},
250
{"SrunIOTimeout", S_P_UINT16},
226
251
{"SrunProlog", S_P_STRING},
227
252
{"StateSaveLocation", S_P_STRING},
228
253
{"SuspendExcNodes", S_P_STRING},
230
255
{"SuspendProgram", S_P_STRING},
231
256
{"SuspendRate", S_P_UINT16},
232
257
{"SuspendTime", S_P_LONG},
258
{"SuspendTimeout", S_P_UINT16},
233
259
{"SwitchType", S_P_STRING},
234
260
{"TaskEpilog", S_P_STRING},
235
261
{"TaskProlog", S_P_STRING},
236
262
{"TaskPlugin", S_P_STRING},
237
263
{"TaskPluginParam", S_P_STRING},
238
264
{"TmpFS", S_P_STRING},
265
{"TopologyPlugin", S_P_STRING},
239
266
{"TrackWCKey", S_P_BOOLEAN},
240
267
{"TreeWidth", S_P_UINT16},
241
268
{"UnkillableStepProgram", S_P_STRING},
243
270
{"UsePAM", S_P_BOOLEAN},
244
271
{"WaitTime", S_P_UINT16},
246
{"NodeName", S_P_ARRAY, parse_nodename, destroy_nodename},
247
{"PartitionName", S_P_ARRAY, parse_partitionname,
248
destroy_partitionname},
249
{"DownNodes", S_P_ARRAY, parse_downnodes, destroy_downnodes},
273
{"NodeName", S_P_ARRAY, _parse_nodename, _destroy_nodename},
274
{"PartitionName", S_P_ARRAY, _parse_partitionname,
275
_destroy_partitionname},
276
{"DownNodes", S_P_ARRAY, _parse_downnodes, _destroy_downnodes},
255
static int defunct_option(void **dest, slurm_parser_enum_t type,
281
static bool _is_valid_dir(char *file_name)
285
if (stat(file_name, &buf) || !S_ISDIR(buf.st_mode))
290
static int _defunct_option(void **dest, slurm_parser_enum_t type,
256
291
const char *key, const char *value,
257
292
const char *line, char **leftover)
263
static int parse_nodename(void **dest, slurm_parser_enum_t type,
264
const char *key, const char *value,
265
const char *line, char **leftover)
299
/* Used to get the general name of the machine, used primarily
300
* for bluegene systems. Not in general use because some systems
301
* have multiple prefix's such as foo[1-1000],bar[1-1000].
303
/* Caller must be holding slurm_conf_lock() */
304
static void _set_node_prefix(const char *nodenames)
309
xassert(nodenames != NULL);
310
for (i = 1; nodenames[i] != '\0'; i++) {
311
if((nodenames[i-1] == '[')
312
|| (nodenames[i-1] <= '9'
313
&& nodenames[i-1] >= '0'))
316
xfree(conf_ptr->node_prefix);
317
if(nodenames[i] == '\0')
318
conf_ptr->node_prefix = xstrdup(nodenames);
320
tmp = xmalloc(sizeof(char)*i+1);
322
snprintf(tmp, i, "%s", nodenames);
323
conf_ptr->node_prefix = tmp;
326
debug3("Prefix is %s %s %d", conf_ptr->node_prefix, nodenames, i);
331
static int _parse_nodename(void **dest, slurm_parser_enum_t type,
332
const char *key, const char *value,
333
const char *line, char **leftover)
267
335
s_p_hashtbl_t *tbl, *dflt;
268
336
slurm_conf_node_t *n;
269
338
static s_p_options_t _nodename_options[] = {
270
339
{"CoresPerSocket", S_P_UINT16},
271
340
{"Feature", S_P_STRING},
490
578
p->allow_groups = NULL; /* NULL means allow all */
581
if (!s_p_get_string(&p->allow_alloc_nodes, "AllocNodes", tbl)) {
582
s_p_get_string(&p->allow_alloc_nodes, "AllocNodes",
584
if (p->allow_alloc_nodes &&
585
(strcasecmp(p->allow_alloc_nodes, "ALL") == 0)) {
586
/* NULL means to allow all submit notes */
587
xfree(p->allow_alloc_nodes);
493
591
if (!s_p_get_boolean(&p->default_flag, "Default", tbl)
494
592
&& !s_p_get_boolean(&p->default_flag, "Default", dflt))
495
593
p->default_flag = false;
619
if (!s_p_get_string(&tmp, "DefaultTime", tbl) &&
620
!s_p_get_string(&tmp, "DefaultTime", dflt))
621
p->default_time = NO_VAL;
623
int default_time = time_str2mins(tmp);
624
if ((default_time < 0) && (default_time != INFINITE)) {
625
error("Bad value \"%s\" for DefaultTime", tmp);
626
_destroy_partitionname(p);
627
s_p_hashtbl_destroy(tbl);
631
p->default_time = default_time;
521
635
if (!s_p_get_uint32(&p->max_nodes, "MaxNodes", tbl)
522
636
&& !s_p_get_uint32(&p->max_nodes, "MaxNodes", dflt))
523
637
p->max_nodes = INFINITE;
1078
* slurm_conf_get_nodeaddr - Return the NodeAddr for given NodeHostname
1080
* NOTE: Call xfree() to release returned value's memory.
1081
* NOTE: Caller must NOT be holding slurm_conf_lock().
1083
extern char *slurm_conf_get_nodeaddr(const char *node_hostname)
1089
_init_slurmd_nodehash();
1090
idx = _get_hash_idx(node_hostname);
1092
p = host_to_node_hashtbl[idx];
1094
if (strcmp(p->hostname, node_hostname) == 0) {
1096
if (p->address != NULL)
1097
nodeaddr = xstrdup(p->address);
1100
slurm_conf_unlock();
1103
p = p->next_hostname;
1105
slurm_conf_unlock();
953
1111
* slurm_conf_get_aliased_nodename - Return the NodeName for the
954
1112
* complete hostname string returned by gethostname if there is
955
1113
* such a match, otherwise iterate through any aliases returned
1225
1390
ctl_conf_ptr->cache_groups = 0;
1226
1391
xfree (ctl_conf_ptr->checkpoint_type);
1227
1392
xfree (ctl_conf_ptr->cluster_name);
1393
ctl_conf_ptr->complete_wait = (uint16_t) NO_VAL;
1228
1394
xfree (ctl_conf_ptr->control_addr);
1229
1395
xfree (ctl_conf_ptr->control_machine);
1230
1396
xfree (ctl_conf_ptr->crypto_type);
1231
1397
ctl_conf_ptr->def_mem_per_task = 0;
1398
ctl_conf_ptr->debug_flags = 0;
1232
1399
ctl_conf_ptr->disable_root_jobs = 0;
1233
1400
ctl_conf_ptr->enforce_part_limits = 0;
1234
1401
xfree (ctl_conf_ptr->epilog);
1300
1475
xfree (ctl_conf_ptr->suspend_program);
1301
1476
ctl_conf_ptr->suspend_rate = (uint16_t) NO_VAL;
1302
1477
ctl_conf_ptr->suspend_time = (uint16_t) NO_VAL;
1478
ctl_conf_ptr->suspend_timeout = 0;
1303
1479
xfree (ctl_conf_ptr->switch_type);
1304
1480
xfree (ctl_conf_ptr->task_epilog);
1305
1481
xfree (ctl_conf_ptr->task_plugin);
1306
1482
ctl_conf_ptr->task_plugin_param = 0;
1307
1483
xfree (ctl_conf_ptr->task_prolog);
1308
1484
xfree (ctl_conf_ptr->tmp_fs);
1485
xfree (ctl_conf_ptr->topology_plugin);
1309
1486
ctl_conf_ptr->tree_width = (uint16_t) NO_VAL;
1310
1487
xfree (ctl_conf_ptr->unkillable_program);
1311
1488
ctl_conf_ptr->unkillable_timeout = (uint16_t) NO_VAL;
1312
1489
ctl_conf_ptr->use_pam = 0;
1313
1490
ctl_conf_ptr->wait_time = (uint16_t) NO_VAL;
1491
ctl_conf_ptr->kill_on_bad_exit = 0;
1315
1493
_free_name_hashtbl();
1316
1494
_init_name_hashtbl();
1541
1718
s_p_get_string(&conf->cluster_name, "ClusterName", hashtbl);
1720
if (!s_p_get_uint16(&conf->complete_wait, "CompleteWait", hashtbl))
1721
conf->complete_wait = DEFAULT_COMPLETE_WAIT;
1543
1723
if (!s_p_get_string(&conf->control_machine, "ControlMachine", hashtbl))
1544
fatal ("validate_and_set_defaults: "
1724
fatal ("_validate_and_set_defaults: "
1545
1725
"ControlMachine not specified.");
1546
1726
else if (strcasecmp("localhost", conf->control_machine) == 0) {
1547
1727
xfree (conf->control_machine);
1565
1745
s_p_get_string(&default_storage_host, "DefaultStorageHost", hashtbl);
1566
1746
s_p_get_string(&default_storage_user, "DefaultStorageUser", hashtbl);
1567
1747
s_p_get_string(&default_storage_pass, "DefaultStoragePass", hashtbl);
1568
s_p_get_string(&default_storage_loc, "DefaultStorageLoc", hashtbl);
1748
s_p_get_string(&default_storage_loc, "DefaultStorageLoc", hashtbl);
1569
1749
s_p_get_uint32(&default_storage_port, "DefaultStoragePort", hashtbl);
1570
1750
s_p_get_string(&conf->job_credential_private_key,
1571
1751
"JobCredentialPrivateKey", hashtbl);
1595
1775
"JobCredentialPublicCertificate be set");
1598
if ((s_p_get_uint32(&conf->def_mem_per_task,
1599
"DefMemPerCPU", hashtbl)) ||
1600
(s_p_get_uint32(&conf->def_mem_per_task, "DefMemPerTask", hashtbl)))
1778
if (s_p_get_uint32(&conf->def_mem_per_task, "DefMemPerCPU", hashtbl))
1601
1779
conf->def_mem_per_task |= MEM_PER_CPU;
1602
else if (!s_p_get_uint32(&conf->def_mem_per_task,
1603
"DefMemPerNode", hashtbl))
1780
else if (!s_p_get_uint32(&conf->def_mem_per_task, "DefMemPerNode",
1604
1782
conf->def_mem_per_task = DEFAULT_MEM_PER_CPU;
1784
if (s_p_get_string(&temp_str, "DebugFlags", hashtbl)) {
1785
conf->debug_flags = debug_str2flags(temp_str);
1786
if (conf->debug_flags == NO_VAL)
1787
fatal("DebugFlags invalid: %s", temp_str);
1789
} else /* Default: no DebugFlags */
1790
conf->debug_flags = 0;
1606
1792
if (!s_p_get_boolean((bool *) &conf->disable_root_jobs,
1607
1793
"DisableRootJobs", hashtbl))
1608
1794
conf->disable_root_jobs = DEFAULT_DISABLE_ROOT_JOBS;
1690
1884
if (!s_p_get_string(&conf->job_comp_host, "JobCompHost",
1692
1886
if(default_storage_host)
1693
conf->job_comp_host =
1694
xstrdup(default_storage_host);
1887
conf->job_comp_host = xstrdup(default_storage_host);
1696
1889
conf->job_comp_host = xstrdup(DEFAULT_STORAGE_HOST);
1698
1891
if (!s_p_get_string(&conf->job_comp_user, "JobCompUser",
1700
1893
if(default_storage_user)
1701
conf->job_comp_user =
1702
xstrdup(default_storage_user);
1894
conf->job_comp_user = xstrdup(default_storage_user);
1704
1896
conf->job_comp_user = xstrdup(DEFAULT_STORAGE_USER);
1706
1898
if (!s_p_get_string(&conf->job_comp_pass, "JobCompPass",
1708
1900
if(default_storage_pass)
1709
conf->job_comp_pass =
1710
xstrdup(default_storage_pass);
1901
conf->job_comp_pass = xstrdup(default_storage_pass);
1712
1903
if (!s_p_get_uint32(&conf->job_comp_port, "JobCompPort",
1714
1905
if(default_storage_port)
1715
1906
conf->job_comp_port = default_storage_port;
1907
else if(!strcmp(conf->job_comp_type, "job_comp/mysql"))
1908
conf->job_comp_port = DEFAULT_MYSQL_PORT;
1909
else if(!strcmp(conf->job_comp_type, "job_comp/pgsql"))
1910
conf->job_comp_port = DEFAULT_PGSQL_PORT;
1717
1912
conf->job_comp_port = DEFAULT_STORAGE_PORT;
1719
1915
if (!s_p_get_uint16(&conf->job_file_append, "JobFileAppend", hashtbl))
1720
1916
conf->job_file_append = 0;
1727
1923
if (!s_p_get_uint16(&conf->get_env_timeout, "GetEnvTimeout", hashtbl))
1728
1924
conf->get_env_timeout = DEFAULT_GET_ENV_TIMEOUT;
1730
s_p_get_uint16(&conf->health_check_interval,
1731
"HealthCheckInterval", hashtbl);
1732
s_p_get_string(&conf->health_check_program,
1733
"HealthCheckProgram", hashtbl);
1926
s_p_get_uint16(&conf->health_check_interval, "HealthCheckInterval",
1928
s_p_get_string(&conf->health_check_program, "HealthCheckProgram",
1931
if (!s_p_get_uint16(&conf->kill_on_bad_exit, "KillOnBadExit", hashtbl))
1932
conf->kill_on_bad_exit = DEFAULT_KILL_ON_BAD_EXIT;
1735
1934
if (!s_p_get_uint16(&conf->kill_wait, "KillWait", hashtbl))
1736
1935
conf->kill_wait = DEFAULT_KILL_WAIT;
1743
1942
if (!s_p_get_uint16(&conf->max_job_cnt, "MaxJobCount", hashtbl))
1744
1943
conf->max_job_cnt = DEFAULT_MAX_JOB_COUNT;
1746
if ((s_p_get_uint32(&conf->max_mem_per_task,
1945
if ((s_p_get_uint32(&conf->max_mem_per_task,
1747
1946
"MaxMemPerCPU", hashtbl)) ||
1748
(s_p_get_uint32(&conf->max_mem_per_task, "MaxMemPerTask", hashtbl)))
1947
(s_p_get_uint32(&conf->max_mem_per_task,
1948
"MaxMemPerTask", hashtbl))) {
1749
1949
conf->max_mem_per_task |= MEM_PER_CPU;
1750
else if (!s_p_get_uint32(&conf->max_mem_per_task,
1751
"MaxMemPerNode", hashtbl))
1950
} else if (!s_p_get_uint32(&conf->max_mem_per_task,
1951
"MaxMemPerNode", hashtbl)) {
1752
1952
conf->max_mem_per_task = DEFAULT_MAX_MEM_PER_CPU;
1754
1955
if (!s_p_get_uint16(&conf->msg_timeout, "MessageTimeout", hashtbl))
1755
1956
conf->msg_timeout = DEFAULT_MSG_TIMEOUT;
1825
2032
if(default_storage_loc)
1826
2033
conf->accounting_storage_loc =
1827
2034
xstrdup(default_storage_loc);
2035
else if(!strcmp(conf->accounting_storage_type,
2036
"accounting_storage/mysql")
2037
|| !strcmp(conf->accounting_storage_type,
2038
"accounting_storage/pgsql"))
2039
conf->accounting_storage_loc =
2040
xstrdup(DEFAULT_ACCOUNTING_DB);
1829
2042
conf->accounting_storage_loc =
1830
2043
xstrdup(DEFAULT_STORAGE_LOC);
1833
2045
if (!s_p_get_string(&conf->accounting_storage_user,
1834
2046
"AccountingStorageUser", hashtbl)) {
1835
2047
if(default_storage_user)
1849
2061
"AccountingStoragePort", hashtbl)) {
1850
2062
if(default_storage_port)
1851
2063
conf->accounting_storage_port = default_storage_port;
2064
else if(!strcmp(conf->accounting_storage_type,
2065
"accounting_storage/slurmdbd"))
2066
conf->accounting_storage_port = SLURMDBD_PORT;
2067
else if(!strcmp(conf->accounting_storage_type,
2068
"accounting_storage/mysql"))
2069
conf->accounting_storage_port = DEFAULT_MYSQL_PORT;
2070
else if(!strcmp(conf->accounting_storage_type,
2071
"accounting_storage/pgsql"))
2072
conf->accounting_storage_port = DEFAULT_PGSQL_PORT;
1853
2074
conf->accounting_storage_port = DEFAULT_STORAGE_PORT;
2077
/* remove the user and loc if using slurmdbd */
2078
if(!strcmp(conf->accounting_storage_type,
2079
"accounting_storage/slurmdbd")) {
2080
xfree(conf->accounting_storage_loc);
2081
conf->accounting_storage_loc = xstrdup("N/A");
2082
xfree(conf->accounting_storage_user);
2083
conf->accounting_storage_user = xstrdup("N/A");
2086
s_p_get_uint16(&conf->over_time_limit, "OverTimeLimit", hashtbl);
1855
2088
if (!s_p_get_string(&conf->plugindir, "PluginDir", hashtbl))
1856
2089
conf->plugindir = xstrdup(default_plugin_path);
2090
if (!_is_valid_dir(conf->plugindir))
2091
fatal("Bad value \"%s\" for PluginDir", conf->plugindir);
1858
2093
if (!s_p_get_string(&conf->plugstack, "PlugStackConfig", hashtbl))
1859
2094
conf->plugstack = xstrdup(default_plugstack);
1861
2096
if (!s_p_get_string(&conf->switch_type, "SwitchType", hashtbl))
1862
2097
conf->switch_type = xstrdup(DEFAULT_SWITCH_TYPE);
2099
if (s_p_get_string(&temp_str, "PriorityDecayHalfLife", hashtbl)) {
2100
int max_time = time_str2mins(temp_str);
2101
if ((max_time < 0) && (max_time != INFINITE)) {
2102
fatal("Bad value \"%s\" for PriorityDecayHalfLife",
2105
conf->priority_decay_hl = max_time * 60;
2108
conf->priority_decay_hl = DEFAULT_PRIORITY_DECAY;
2110
if (s_p_get_boolean(&truth, "PriorityFavorSmall", hashtbl) && truth)
2111
conf->priority_favor_small = 1;
2113
conf->priority_favor_small = 0;
2115
if (s_p_get_string(&temp_str, "PriorityMaxAge", hashtbl)) {
2116
int max_time = time_str2mins(temp_str);
2117
if ((max_time < 0) && (max_time != INFINITE)) {
2118
fatal("Bad value \"%s\" for PriorityMaxAge",
2121
conf->priority_max_age = max_time * 60;
2124
conf->priority_max_age = DEFAULT_PRIORITY_DECAY;
2126
if (s_p_get_string(&temp_str, "PriorityUsageResetPeriod", hashtbl)) {
2127
if (strcasecmp(temp_str, "none") == 0)
2128
conf->priority_reset_period = PRIORITY_RESET_NONE;
2129
else if (strcasecmp(temp_str, "now") == 0)
2130
conf->priority_reset_period = PRIORITY_RESET_NOW;
2131
else if (strcasecmp(temp_str, "daily") == 0)
2132
conf->priority_reset_period = PRIORITY_RESET_DAILY;
2133
else if (strcasecmp(temp_str, "weekly") == 0)
2134
conf->priority_reset_period = PRIORITY_RESET_WEEKLY;
2135
else if (strcasecmp(temp_str, "monthly") == 0)
2136
conf->priority_reset_period = PRIORITY_RESET_MONTHLY;
2137
else if (strcasecmp(temp_str, "quarterly") == 0)
2138
conf->priority_reset_period = PRIORITY_RESET_QUARTERLY;
2139
else if (strcasecmp(temp_str, "yearly") == 0)
2140
conf->priority_reset_period = PRIORITY_RESET_YEARLY;
2142
fatal("Bad value \"%s\" for PriorityUsageResetPeriod",
2147
conf->priority_reset_period = PRIORITY_RESET_NONE;
2148
if(!conf->priority_decay_hl) {
2149
fatal("You have to either have "
2150
"PriorityDecayHalfLife != 0 or "
2151
"PriorityUsageResetPeriod set to something "
2152
"or the priority plugin will result in "
2157
if (!s_p_get_string(&conf->priority_type, "PriorityType", hashtbl))
2158
conf->priority_type = xstrdup(DEFAULT_PRIORITY_TYPE);
2160
if (!s_p_get_uint32(&conf->priority_weight_age,
2161
"PriorityWeightAge", hashtbl))
2162
conf->priority_weight_age = 0;
2163
if (!s_p_get_uint32(&conf->priority_weight_fs,
2164
"PriorityWeightFairshare", hashtbl))
2165
conf->priority_weight_fs = 0;
2166
if (!s_p_get_uint32(&conf->priority_weight_js,
2167
"PriorityWeightJobSize", hashtbl))
2168
conf->priority_weight_js = 0;
2169
if (!s_p_get_uint32(&conf->priority_weight_part,
2170
"PriorityWeightPartition", hashtbl))
2171
conf->priority_weight_part = 0;
2172
if (!s_p_get_uint32(&conf->priority_weight_qos,
2173
"PriorityWeightQOS", hashtbl))
2174
conf->priority_weight_qos = 0;
1864
2176
if (!s_p_get_string(&conf->proctrack_type, "ProctrackType", hashtbl)) {
1865
2177
if (!strcmp(conf->switch_type,"switch/elan"))
1866
2178
conf->proctrack_type = xstrdup("proctrack/rms");
1873
2185
fatal("proctrack/linuxproc is incompatable with switch/elan");
1875
2187
if (s_p_get_string(&temp_str, "PrivateData", hashtbl)) {
2188
if (strstr(temp_str, "account"))
2189
conf->private_data |= PRIVATE_DATA_ACCOUNTS;
1876
2190
if (strstr(temp_str, "job"))
1877
2191
conf->private_data |= PRIVATE_DATA_JOBS;
1878
2192
if (strstr(temp_str, "node"))
1879
2193
conf->private_data |= PRIVATE_DATA_NODES;
1880
2194
if (strstr(temp_str, "partition"))
1881
2195
conf->private_data |= PRIVATE_DATA_PARTITIONS;
2196
if (strstr(temp_str, "reservation"))
2197
conf->private_data |= PRIVATE_DATA_RESERVATIONS;
1882
2198
if (strstr(temp_str, "usage"))
1883
2199
conf->private_data |= PRIVATE_DATA_USAGE;
1884
if (strstr(temp_str, "users"))
2200
if (strstr(temp_str, "user"))
1885
2201
conf->private_data |= PRIVATE_DATA_USERS;
1886
if (strstr(temp_str, "accounts"))
1887
conf->private_data |= PRIVATE_DATA_ACCOUNTS;
1888
2202
if (strstr(temp_str, "all"))
1889
2203
conf->private_data = 0xffff;
1890
2204
xfree(temp_str);
1893
2207
s_p_get_string(&conf->prolog, "Prolog", hashtbl);
2208
s_p_get_string(&conf->prolog_slurmctld, "PrologSlurmctld", hashtbl);
1895
2210
if (!s_p_get_uint16(&conf->propagate_prio_process,
1896
2211
"PropagatePrioProcess", hashtbl)) {
1919
2234
if (!s_p_get_uint16(&conf->ret2service, "ReturnToService", hashtbl))
1920
2235
conf->ret2service = DEFAULT_RETURN_TO_SERVICE;
2237
s_p_get_uint16(&conf->resv_over_run, "ResvOverRun", hashtbl);
1922
2239
s_p_get_string(&conf->resume_program, "ResumeProgram", hashtbl);
1923
2240
if (!s_p_get_uint16(&conf->resume_rate, "ResumeRate", hashtbl))
1924
2241
conf->resume_rate = DEFAULT_RESUME_RATE;
2242
if (!s_p_get_uint16(&conf->resume_timeout, "ResumeTimeout", hashtbl))
2243
conf->resume_timeout = DEFAULT_RESUME_TIMEOUT;
1926
2245
s_p_get_string(&conf->salloc_default_command, "SallocDefaultCommand",
1950
2269
else if ((strcmp(conf->schedtype, "sched/gang") == 0) &&
1951
2270
(conf->fast_schedule == 0))
1952
2271
fatal("FastSchedule=0 is not supported with sched/gang");
2272
if (strcmp(conf->priority_type, "priority/multifactor") == 0) {
2273
if (strcmp(conf->schedtype, "sched/wiki") == 0) {
2274
fatal("PriorityType=priority/multifactor is "
2275
"incompatible with SchedulerType=sched/wiki");
2277
if (strcmp(conf->schedtype, "sched/wiki2") == 0) {
2278
fatal("PriorityType=priority/multifactor is "
2279
"incompatible with SchedulerType=sched/wiki2");
1954
2283
if (!s_p_get_string(&conf->select_type, "SelectType", hashtbl))
1955
2284
conf->select_type = xstrdup(DEFAULT_SELECT_TYPE);
2317
if (!s_p_get_string( &conf->slurmd_user_name, "SlurmdUser", hashtbl)) {
2318
conf->slurmd_user_name = xstrdup("root");
2319
conf->slurmd_user_id = 0;
2322
if (uid_from_string (conf->slurmd_user_name, &my_uid) < 0) {
2323
fatal ("Invalid user for SlurmdUser %s, ignored",
2324
conf->slurmd_user_name);
2325
xfree(conf->slurmd_user_name);
2327
conf->slurmd_user_id = my_uid;
1988
2331
if (s_p_get_uint16(&conf->slurmctld_debug, "SlurmctldDebug", hashtbl))
1989
2332
_normalize_debug_level(&conf->slurmctld_debug);
2045
2391
conf->task_plugin = xstrdup(DEFAULT_TASK_PLUGIN);
2047
2393
if (s_p_get_string(&temp_str, "TaskPluginParam", hashtbl)) {
2048
if (strcasecmp(temp_str, "cpusets") == 0)
2049
conf->task_plugin_param = TASK_PARAM_CPUSETS;
2050
else if (strcasecmp(temp_str, "sched") == 0)
2051
conf->task_plugin_param = TASK_PARAM_SCHED;
2053
fatal("Bad TaskPluginParam: %s", temp_str);
2054
conf->task_plugin_param = TASK_PARAM_NONE;
2394
char *last = NULL, *tok;
2395
bool set_mode = false, set_unit = false;
2396
tok = strtok_r(temp_str, ",", &last);
2398
if (strcasecmp(tok, "none") == 0) {
2400
fatal("Bad TaskPluginParam: %s", tok);
2402
conf->task_plugin_param |= CPU_BIND_NONE;
2403
} else if (strcasecmp(tok, "sockets") == 0) {
2405
fatal("Bad TaskPluginParam: %s", tok);
2407
conf->task_plugin_param |= CPU_BIND_TO_SOCKETS;
2408
} else if (strcasecmp(tok, "cores") == 0) {
2410
fatal("Bad TaskPluginParam: %s", tok);
2412
conf->task_plugin_param |= CPU_BIND_TO_CORES;
2413
} else if (strcasecmp(tok, "threads") == 0) {
2415
fatal("Bad TaskPluginParam: %s", tok);
2417
conf->task_plugin_param |= CPU_BIND_TO_THREADS;
2418
} else if (strcasecmp(tok, "cpusets") == 0) {
2420
fatal("Bad TaskPluginParam: %s", tok);
2422
conf->task_plugin_param |= CPU_BIND_CPUSETS;
2423
} else if (strcasecmp(tok, "sched") == 0) {
2425
fatal("Bad TaskPluginParam: %s", tok);
2427
/* No change to task_plugin_param,
2428
* this is the default */
2429
} else if (strcasecmp(tok, "verbose") == 0) {
2430
conf->task_plugin_param |= CPU_BIND_VERBOSE;
2432
fatal("Bad TaskPluginParam: %s", tok);
2433
tok = strtok_r(NULL, ",", &last);
2056
2435
xfree(temp_str);
2507
* debug_flags2str - convert a DebugFlags uint32_t to the equivalent string
2509
extern char * debug_flags2str(uint32_t debug_flags)
2513
if (debug_flags & DEBUG_FLAG_CPU_BIND) {
2516
xstrcat(rc, "CPU_Bind");
2518
if (debug_flags & DEBUG_FLAG_SELECT_TYPE) {
2521
xstrcat(rc, "SelectType");
2523
if (debug_flags & DEBUG_FLAG_STEPS) {
2526
xstrcat(rc, "Steps");
2528
if (debug_flags & DEBUG_FLAG_TRIGGERS) {
2531
xstrcat(rc, "Triggers");
2533
if (debug_flags & DEBUG_FLAG_WIKI) {
2536
xstrcat(rc, "Wiki");
2543
* debug_str2flags - Convert a DebugFlags string to the equivalent uint32_t
2544
* Returns NO_VAL if invalid
2546
extern uint32_t debug_str2flags(char *debug_flags)
2549
char *tmp_str, *tok, *last = NULL;
2554
tmp_str = xstrdup(debug_flags);
2555
tok = strtok_r(tmp_str, ",", &last);
2557
if (strcasecmp(tok, "CPU_Bind") == 0)
2558
rc |= DEBUG_FLAG_CPU_BIND;
2559
else if (strcasecmp(tok, "SelectType") == 0)
2560
rc |= DEBUG_FLAG_SELECT_TYPE;
2561
else if (strcasecmp(tok, "Steps") == 0)
2562
rc |= DEBUG_FLAG_STEPS;
2563
else if (strcasecmp(tok, "Triggers") == 0)
2564
rc |= DEBUG_FLAG_TRIGGERS;
2565
else if (strcasecmp(tok, "Wiki") == 0)
2566
rc |= DEBUG_FLAG_WIKI;
2568
error("Invalid DebugFlag: %s", tok);
2572
tok = strtok_r(NULL, ",", &last);
2579
extern void destroy_config_key_pair(void *object)
2581
config_key_pair_t *key_pair_ptr = (config_key_pair_t *)object;
2584
xfree(key_pair_ptr->name);
2585
xfree(key_pair_ptr->value);
2586
xfree(key_pair_ptr);
2590
extern void pack_config_key_pair(void *in, uint16_t rpc_version, Buf buffer)
2592
config_key_pair_t *object = (config_key_pair_t *)in;
2593
packstr(object->name, buffer);
2594
packstr(object->value, buffer);
2597
extern int unpack_config_key_pair(void **object, uint16_t rpc_version,
2600
uint32_t uint32_tmp;
2601
config_key_pair_t *object_ptr = xmalloc(sizeof(config_key_pair_t));
2603
*object = object_ptr;
2604
safe_unpackstr_xmalloc(&object_ptr->name, &uint32_tmp, buffer);
2605
safe_unpackstr_xmalloc(&object_ptr->value, &uint32_tmp, buffer);
2607
return SLURM_SUCCESS;
2610
destroy_config_key_pair(object_ptr);
2615
extern int sort_key_pairs(config_key_pair_t *key_a, config_key_pair_t *key_b)
2617
int size_a = strcmp(key_a->name, key_b->name);
2621
else if (size_a > 0)