1
/*****************************************************************************
2
* read_config.h - definitions for reading the overall slurm configuration
4
*****************************************************************************
5
* Copyright (C) 2002-2007 The Regents of the University of California.
6
* Copyright (C) 2008-2010 Lawrence Livermore National Security.
7
* Portions Copyright (C) 2008 Vijay Ramasubramanian.
8
* Portions Copyright (C) 2010 SchedMD <http://www.schedmd.com>.
9
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
10
* Written by Morris Mette <jette1@llnl.gov>.
11
* CODE-OCEC-09-009. All rights reserved.
13
* This file is part of SLURM, a resource management program.
14
* For details, see <https://computing.llnl.gov/linux/slurm/>.
15
* Please also read the included file: DISCLAIMER.
17
* SLURM is free software; you can redistribute it and/or modify it under
18
* the terms of the GNU General Public License as published by the Free
19
* Software Foundation; either version 2 of the License, or (at your option)
22
* In addition, as a special exception, the copyright holders give permission
23
* to link the code of portions of this program with the OpenSSL library under
24
* certain conditions as described in each individual source file, and
25
* distribute linked combinations including the two. You must obey the GNU
26
* General Public License in all respects for all of the code used other than
27
* OpenSSL. If you modify file(s) with this exception, you may extend this
28
* exception to your version of the file(s), but you are not obligated to do
29
* so. If you do not wish to do so, delete this exception statement from your
30
* version. If you delete this exception statement from all source files in
31
* the program, then also delete it here.
33
* SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
34
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
35
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
38
* You should have received a copy of the GNU General Public License along
39
* with SLURM; if not, write to the Free Software Foundation, Inc.,
40
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
41
\*****************************************************************************/
43
#ifndef _READ_CONFIG_H
44
#define _READ_CONFIG_H
46
#include "src/common/slurm_protocol_defs.h"
47
#include "src/common/slurm_protocol_socket_common.h"
48
#include "src/common/parse_config.h"
50
extern slurm_ctl_conf_t slurmctld_conf;
51
extern char *default_slurm_config_file;
52
extern char *default_plugin_path;
53
extern char *default_plugstack;
55
#define ACCOUNTING_ENFORCE_ASSOCS 0x0001
56
#define ACCOUNTING_ENFORCE_LIMITS 0x0002
57
#define ACCOUNTING_ENFORCE_WCKEYS 0x0004
58
#define ACCOUNTING_ENFORCE_QOS 0x0008
60
#define DEFAULT_ACCOUNTING_DB "slurm_acct_db"
61
#define DEFAULT_ACCOUNTING_ENFORCE 0
62
#define DEFAULT_ACCOUNTING_STORAGE_TYPE "accounting_storage/none"
63
#define DEFAULT_AUTH_TYPE "auth/munge"
64
#define DEFAULT_BATCH_START_TIMEOUT 10
65
#define DEFAULT_COMPLETE_WAIT 0
66
#define DEFAULT_CRYPTO_TYPE "crypto/munge"
67
#define DEFAULT_EPILOG_MSG_TIME 2000
68
#define DEFAULT_FAST_SCHEDULE 1
69
#define DEFAULT_FIRST_JOB_ID 1
70
#define DEFAULT_GET_ENV_TIMEOUT 2
71
#define DEFAULT_GROUP_INFO 600
72
/* NOTE: DEFAULT_INACTIVE_LIMIT must be 0 for Blue Gene/L systems */
73
#define DEFAULT_INACTIVE_LIMIT 0
74
#define DEFAULT_JOB_ACCT_GATHER_TYPE "jobacct_gather/none"
75
#define JOB_ACCT_GATHER_TYPE_NONE "jobacct_gather/none"
76
#define DEFAULT_JOB_ACCT_GATHER_FREQ 30
77
#define ACCOUNTING_STORAGE_TYPE_NONE "accounting_storage/none"
78
#define DEFAULT_DISABLE_ROOT_JOBS 0
79
#define DEFAULT_ENFORCE_PART_LIMITS 0
80
#define DEFAULT_JOB_CKPT_DIR "/var/slurm/checkpoint"
81
#define DEFAULT_JOB_COMP_TYPE "jobcomp/none"
82
#define DEFAULT_JOB_COMP_LOC "/var/log/slurm_jobcomp.log"
83
#define DEFAULT_JOB_COMP_DB "slurm_jobcomp_db"
84
#define DEFAULT_KILL_ON_BAD_EXIT 0
85
#define DEFAULT_KILL_TREE 0
86
#define DEFAULT_KILL_WAIT 30
87
#define DEFAULT_MAIL_PROG "/bin/mail"
88
#define DEFAULT_MAX_JOB_COUNT 10000
89
#define DEFAULT_MEM_PER_CPU 0
90
#define DEFAULT_MAX_MEM_PER_CPU 0
91
#define DEFAULT_MIN_JOB_AGE 300
92
#define DEFAULT_MPI_DEFAULT "none"
93
#define DEFAULT_MSG_TIMEOUT 10
94
#ifdef HAVE_AIX /* AIX specific default configuration parameters */
95
# define DEFAULT_CHECKPOINT_TYPE "checkpoint/aix"
96
# define DEFAULT_PROCTRACK_TYPE "proctrack/aix"
98
# define DEFAULT_CHECKPOINT_TYPE "checkpoint/none"
99
# define DEFAULT_PROCTRACK_TYPE "proctrack/pgid"
101
#define DEFAULT_PREEMPT_TYPE "preempt/none"
102
#define DEFAULT_PRIORITY_DECAY 604800 /* 7 days */
103
#define DEFAULT_PRIORITY_CALC_PERIOD 300 /* in seconds */
104
#define DEFAULT_PRIORITY_TYPE "priority/basic"
105
#define DEFAULT_RETURN_TO_SERVICE 0
106
#define DEFAULT_RESUME_RATE 300
107
#define DEFAULT_RESUME_TIMEOUT 60
108
#define DEFAULT_SAVE_STATE_LOC "/tmp"
109
#define DEFAULT_SCHEDROOTFILTER 1
110
#define DEFAULT_SCHEDULER_PORT 7321
111
#define DEFAULT_SCHED_LOG_LEVEL 0
112
#define DEFAULT_SCHED_TIME_SLICE 30
113
#define DEFAULT_SCHEDTYPE "sched/builtin"
114
#ifdef HAVE_BG /* Blue Gene specific default configuration parameters */
116
# define DEFAULT_SELECT_TYPE "select/bgq"
118
# define DEFAULT_SELECT_TYPE "select/bluegene"
121
# ifdef HAVE_CRAY /* Cray specific default configuration parameters */
122
# define DEFAULT_SELECT_TYPE "select/cray"
124
# define DEFAULT_SELECT_TYPE "select/linear"
127
#define DEFAULT_SLURMCTLD_PIDFILE "/var/run/slurmctld.pid"
128
#define DEFAULT_SLURMCTLD_TIMEOUT 120
129
#define DEFAULT_SLURMD_PIDFILE "/var/run/slurmd.pid"
130
#define DEFAULT_SLURMD_TIMEOUT 300
131
#define DEFAULT_SPOOLDIR "/var/spool/slurmd"
132
#define DEFAULT_STORAGE_HOST "localhost"
133
#define DEFAULT_STORAGE_LOC "/var/log/slurm_jobacct.log"
134
#define DEFAULT_STORAGE_USER "root"
135
#define DEFAULT_STORAGE_PORT 0
136
#define DEFAULT_PGSQL_PORT 5432
137
#define DEFAULT_MYSQL_PORT 3306
138
#define DEFAULT_SUSPEND_RATE 60
139
#define DEFAULT_SUSPEND_TIME 0
140
#define DEFAULT_SUSPEND_TIMEOUT 30
141
#define DEFAULT_SWITCH_TYPE "switch/none"
142
#define DEFAULT_TASK_PLUGIN "task/none"
143
#define DEFAULT_TMP_FS "/tmp"
145
# define DEFAULT_TOPOLOGY_PLUGIN "topology/3d_torus"
147
# define DEFAULT_TOPOLOGY_PLUGIN "topology/none"
149
#define DEFAULT_WAIT_TIME 0
150
#define DEFAULT_TREE_WIDTH 50
151
#define DEFAULT_UNKILLABLE_TIMEOUT 60 /* seconds */
152
#define DEFAULT_MAX_TASKS_PER_NODE 128
154
typedef struct slurm_conf_node {
158
char *gres; /* arbitrary list of node's generic resources */
159
char *feature; /* arbitrary list of node's features */
161
uint16_t cpus; /* count of cpus running on the node */
162
uint16_t sockets; /* number of sockets per node */
163
uint16_t cores; /* number of cores per CPU */
164
uint16_t threads; /* number of threads per core */
165
uint32_t real_memory; /* MB real memory on the node */
168
uint32_t tmp_disk; /* MB total storage in TMP_FS file system */
169
uint32_t weight; /* arbitrary priority of node for
170
* scheduling work on */
173
typedef struct slurm_conf_partition {
174
char *allow_alloc_nodes;/* comma delimited list of allowed
176
* NULL indicates all */
177
char *allow_groups; /* comma delimited list of groups,
178
* NULL indicates all */
179
char *alternate; /* name of alternate partition */
180
bool default_flag; /* Set if default partition */
181
uint32_t default_time; /* minutes or INFINITE */
182
uint16_t disable_root_jobs; /* if set then user root can't run
183
* jobs if NO_VAL use global
186
bool hidden_flag; /* 1 if hidden by default */
187
uint16_t max_share; /* number of jobs to gang schedule */
188
uint32_t max_time; /* minutes or INFINITE */
189
uint32_t max_nodes; /* per job or INFINITE */
190
uint32_t min_nodes; /* per job */
191
char *name; /* name of the partition */
192
char *nodes; /* comma delimited list names of nodes */
193
uint16_t preempt_mode; /* See PREEMPT_MODE_* in slurm/slurm.h */
194
uint16_t priority; /* scheduling priority for jobs */
195
bool root_only_flag;/* 1 if allocate/submit RPC can only be
196
issued by user root */
197
uint16_t state_up; /* for states see PARTITION_* in slurm.h */
198
uint32_t total_nodes; /* total number of nodes in the partition */
199
uint32_t total_cpus; /* total number of cpus in the partition */
200
} slurm_conf_partition_t;
202
typedef struct slurm_conf_downnodes {
206
} slurm_conf_downnodes_t;
214
* slurm_conf_init - load the slurm configuration from the a file.
215
* IN file_name - name of the slurm configuration file to be read
216
* If file_name is NULL, then this routine tries to use
217
* the value in the SLURM_CONF env variable. Failing that,
218
* it uses the compiled-in default file name.
219
* If the conf structures have already been initialized by a call to
220
* slurm_conf_init, any subsequent calls will do nothing until
221
* slurm_conf_destroy is called.
222
* RET SLURM_SUCCESS if conf file is initialized. If the slurm conf
223
* was already initialied, return SLURM_ERROR.
224
* NOTE: Caller must NOT be holding slurm_conf_lock().
226
extern int slurm_conf_init(const char *file_name);
229
* slurm_conf_reinit - reload the slurm configuration from a file.
230
* IN file_name - name of the slurm configuration file to be read
231
* If file_name is NULL, then this routine tries to use
232
* the value in the SLURM_CONF env variable. Failing that,
233
* it uses the compiled-in default file name.
234
* Unlike slurm_conf_init, slurm_conf_reinit will always reread the
235
* file and reinitialize the configuration structures.
236
* RET SLURM_SUCCESS if conf file is reinitialized, otherwise SLURM_ERROR.
237
* NOTE: Caller must NOT be holding slurm_conf_lock().
239
extern int slurm_conf_reinit(const char *file_name);
242
* slurm_conf_mutex_init - init the slurm_conf mutex
244
extern void slurm_conf_mutex_init(void);
246
/* slurm_conf_install_fork_handlers
247
* installs what to do with a fork with the conf mutex
249
void slurm_conf_install_fork_handlers();
252
* NOTE: Caller must NOT be holding slurm_conf_lock().
254
extern int slurm_conf_destroy(void);
256
extern slurm_ctl_conf_t *slurm_conf_lock(void);
258
extern void slurm_conf_unlock(void);
261
* Set "ptr_array" with the pointer to an array of pointers to
262
* slurm_conf_node_t structures.
264
* Return value is the length of the array.
266
extern int slurm_conf_nodename_array(slurm_conf_node_t **ptr_array[]);
269
* Set "ptr_array" with the pointer to an array of pointers to
270
* slurm_conf_partition_t structures.
272
* Return value is the length of the array.
274
extern int slurm_conf_partition_array(slurm_conf_partition_t **ptr_array[]);
277
* Set "ptr_array" with the pointer to an array of pointers to
278
* slurm_conf_downnodes_t structures.
280
* Return value is the length of the array.
282
extern int slurm_conf_downnodes_array(slurm_conf_downnodes_t **ptr_array[]);
285
* slurm_conf_get_hostname - Return the NodeHostname for given NodeName
287
* Returned string was allocated with xmalloc(), and must be freed by
288
* the caller using xfree().
290
* NOTE: Caller must NOT be holding slurm_conf_lock().
292
extern char *slurm_conf_get_hostname(const char *node_name);
295
* slurm_conf_get_nodename - Return the NodeName for given NodeHostname
297
* NOTE: Call xfree() to release returned value's memory.
298
* NOTE: Caller must NOT be holding slurm_conf_lock().
300
extern char *slurm_conf_get_nodename(const char *node_hostname);
303
* slurm_conf_get_aliases - Return all the nodes NodeName value
304
* associated to a given NodeHostname (usefull in case of multiple-slurmd
305
* to get the list of virtual nodes associated with a real node)
307
* NOTE: Call xfree() to release returned value's memory.
308
* NOTE: Caller must NOT be holding slurm_conf_lock().
310
extern char *slurm_conf_get_aliases(const char *node_hostname);
313
* slurm_conf_get_nodeaddr - Return the NodeAddr for given NodeHostname
315
* NOTE: Call xfree() to release returned value's memory.
316
* NOTE: Caller must NOT be holding slurm_conf_lock().
318
extern char *slurm_conf_get_nodeaddr(const char *node_hostname);
321
* slurm_conf_get_aliased_nodename - Return the NodeName matching an alias
322
* of the local hostname
324
* Returned string was allocated with xmalloc(), and must be freed by
325
* the caller using xfree().
327
* NOTE: Caller must NOT be holding slurm_conf_lock().
329
extern char *slurm_conf_get_aliased_nodename(void);
332
* slurm_conf_get_port - Return the port for a given NodeName
334
* NOTE: Caller must NOT be holding slurm_conf_lock().
336
extern uint16_t slurm_conf_get_port(const char *node_name);
339
* slurm_conf_get_addr - Return the slurm_addr_t for a given NodeName in
340
* the parameter "address". The return code is SLURM_SUCCESS on success,
341
* and SLURM_FAILURE if the address lookup failed.
343
* NOTE: Caller must NOT be holding slurm_conf_lock().
345
extern int slurm_conf_get_addr(const char *node_name, slurm_addr_t *address);
348
* slurm_conf_get_cpus_sct -
349
* Return the cpus, sockets, cores, and threads configured for a given NodeName
350
* Returns SLURM_SUCCESS on success, SLURM_FAILURE on failure.
352
* NOTE: Caller must NOT be holding slurm_conf_lock().
354
extern int slurm_conf_get_cpus_sct(const char *node_name,
355
uint16_t *procs, uint16_t *sockets,
356
uint16_t *cores, uint16_t *threads);
359
* init_slurm_conf - initialize or re-initialize the slurm configuration
360
* values defaults (NULL or NO_VAL). Note that the configuration
361
* file pathname (slurm_conf) is not changed.
362
* IN/OUT ctl_conf_ptr - pointer to data structure to be initialized
364
extern void init_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr);
367
* free_slurm_conf - free all storage associated with a slurm_ctl_conf_t.
368
* IN/OUT ctl_conf_ptr - pointer to data structure to be freed
369
* IN purge_node_hash - purge system-wide node hash table if set,
370
* set to zero if clearing private copy of config data
372
extern void free_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr,
373
bool purge_node_hash);
376
* gethostname_short - equivalent to gethostname(), but return only the first
377
* component of the fully qualified name (e.g. "linux123.foo.bar"
378
* becomes "linux123")
379
* NOTE: NodeName in the config may be different from real hostname.
380
* Use get_conf_node_name() to get the former.
382
extern int gethostname_short (char *name, size_t len);
385
* Replace first "%h" in path string with NodeHostname.
386
* Replace first "%n" in path string with NodeName.
388
* NOTE: Caller should be holding slurm_conf_lock() when calling this function.
390
* Returns an xmalloc()ed string which the caller must free with xfree().
392
extern char *slurm_conf_expand_slurmd_path(const char *path,
393
const char *node_name);
396
* debug_flags2str - convert a DebugFlags uint32_t to the equivalent string
397
* Returns an xmalloc()ed string which the caller must free with xfree().
399
extern char *debug_flags2str(uint32_t debug_flags);
402
* debug_str2flags - Convert a DebugFlags string to the equivalent uint32_t
403
* Returns NO_VAL if invalid
405
extern uint32_t debug_str2flags(char *debug_flags);
407
extern void destroy_config_key_pair(void *object);
408
extern void pack_config_key_pair(void *in, uint16_t rpc_version, Buf buffer);
409
extern int unpack_config_key_pair(void **object, uint16_t rpc_version,
411
extern int sort_key_pairs(config_key_pair_t *key_a, config_key_pair_t *key_b);
414
#endif /* !_READ_CONFIG_H */