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-2009 Lawrence Livermore National Security.
7
* Portions Copyright (C) 2008 Vijay Ramasubramanian.
8
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
9
* Written by Morris Mette <jette1@llnl.gov>.
10
* CODE-OCEC-09-009. All rights reserved.
12
* This file is part of SLURM, a resource management program.
13
* For details, see <https://computing.llnl.gov/linux/slurm/>.
14
* Please also read the included file: DISCLAIMER.
16
* SLURM is free software; you can redistribute it and/or modify it under
17
* the terms of the GNU General Public License as published by the Free
18
* Software Foundation; either version 2 of the License, or (at your option)
21
* In addition, as a special exception, the copyright holders give permission
22
* to link the code of portions of this program with the OpenSSL library under
23
* certain conditions as described in each individual source file, and
24
* distribute linked combinations including the two. You must obey the GNU
25
* General Public License in all respects for all of the code used other than
26
* OpenSSL. If you modify file(s) with this exception, you may extend this
27
* exception to your version of the file(s), but you are not obligated to do
28
* so. If you do not wish to do so, delete this exception statement from your
29
* version. If you delete this exception statement from all source files in
30
* the program, then also delete it here.
32
* SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
33
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
34
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
37
* You should have received a copy of the GNU General Public License along
38
* with SLURM; if not, write to the Free Software Foundation, Inc.,
39
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
40
\*****************************************************************************/
42
#ifndef _READ_CONFIG_H
43
#define _READ_CONFIG_H
45
#include "src/common/slurm_protocol_defs.h"
46
#include "src/common/slurm_protocol_socket_common.h"
47
#include "src/common/parse_config.h"
49
extern slurm_ctl_conf_t slurmctld_conf;
50
extern char *default_slurm_config_file;
51
extern char *default_plugin_path;
52
extern char *default_plugstack;
54
#define ACCOUNTING_ENFORCE_ASSOCS 0x0001
55
#define ACCOUNTING_ENFORCE_LIMITS 0x0002
56
#define ACCOUNTING_ENFORCE_WCKEYS 0x0004
57
#define ACCOUNTING_ENFORCE_QOS 0x0008
59
#define DEFAULT_ACCOUNTING_DB "slurm_acct_db"
60
#define DEFAULT_ACCOUNTING_ENFORCE 0
61
#define DEFAULT_ACCOUNTING_STORAGE_TYPE "accounting_storage/none"
62
#define DEFAULT_AUTH_TYPE "auth/munge"
63
#define DEFAULT_BATCH_START_TIMEOUT 10
64
#define DEFAULT_CACHE_GROUPS 0
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
/* NOTE: DEFAULT_INACTIVE_LIMIT must be 0 for Blue Gene/L systems */
72
#define DEFAULT_INACTIVE_LIMIT 0
73
#define DEFAULT_JOB_ACCT_GATHER_TYPE "jobacct_gather/none"
74
#define JOB_ACCT_GATHER_TYPE_NONE "jobacct_gather/none"
75
#define DEFAULT_JOB_ACCT_GATHER_FREQ 30
76
#define ACCOUNTING_STORAGE_TYPE_NONE "accounting_storage/none"
77
#define DEFAULT_DISABLE_ROOT_JOBS 0
78
#define DEFAULT_ENFORCE_PART_LIMITS 0
79
#define DEFAULT_JOB_CKPT_DIR "/var/slurm/checkpoint"
80
#define DEFAULT_JOB_COMP_TYPE "jobcomp/none"
81
#define DEFAULT_JOB_COMP_LOC "/var/log/slurm_jobcomp.log"
82
#define DEFAULT_JOB_COMP_DB "slurm_jobcomp_db"
83
#define DEFAULT_KILL_ON_BAD_EXIT 0
84
#define DEFAULT_KILL_TREE 0
85
#define DEFAULT_KILL_WAIT 30
86
#define DEFAULT_MAIL_PROG "/bin/mail"
87
#define DEFAULT_MAX_JOB_COUNT 5000
88
#define DEFAULT_MEM_PER_CPU 0
89
#define DEFAULT_MAX_MEM_PER_CPU 0
90
#define DEFAULT_MIN_JOB_AGE 300
91
#define DEFAULT_MPI_DEFAULT "none"
92
#define DEFAULT_MSG_TIMEOUT 10
93
#ifdef HAVE_AIX /* AIX specific default configuration parameters */
94
# define DEFAULT_CHECKPOINT_TYPE "checkpoint/aix"
95
# define DEFAULT_PROCTRACK_TYPE "proctrack/aix"
97
# define DEFAULT_CHECKPOINT_TYPE "checkpoint/none"
98
# define DEFAULT_PROCTRACK_TYPE "proctrack/pgid"
100
#define DEFAULT_PREEMPT_TYPE "preempt/none"
101
#define DEFAULT_PRIORITY_DECAY 604800 /* 7 days */
102
#define DEFAULT_PRIORITY_CALC_PERIOD 300 /* in seconds */
103
#define DEFAULT_PRIORITY_TYPE "priority/basic"
104
#define DEFAULT_PROPAGATE_PRIO_PROCESS 0
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_TIME_SLICE 30
112
#define DEFAULT_SCHEDTYPE "sched/builtin"
113
#ifdef HAVE_BG /* Blue Gene specific default configuration parameters */
114
# define DEFAULT_SELECT_TYPE "select/bluegene"
116
# define DEFAULT_SELECT_TYPE "select/linear"
118
#define DEFAULT_SLURMCTLD_PIDFILE "/var/run/slurmctld.pid"
119
#define DEFAULT_SLURMCTLD_TIMEOUT 120
120
#define DEFAULT_SLURMD_PIDFILE "/var/run/slurmd.pid"
121
#define DEFAULT_SLURMD_TIMEOUT 300
122
#define DEFAULT_SPOOLDIR "/var/spool/slurmd"
123
#define DEFAULT_STORAGE_HOST "localhost"
124
#define DEFAULT_STORAGE_LOC "/var/log/slurm_jobacct.log"
125
#define DEFAULT_STORAGE_USER "root"
126
#define DEFAULT_STORAGE_PORT 0
127
#define DEFAULT_PGSQL_PORT 5432
128
#define DEFAULT_MYSQL_PORT 3306
129
#define DEFAULT_SUSPEND_RATE 60
130
#define DEFAULT_SUSPEND_TIME 0
131
#define DEFAULT_SUSPEND_TIMEOUT 30
132
#define DEFAULT_SWITCH_TYPE "switch/none"
133
#define DEFAULT_TASK_PLUGIN "task/none"
134
#define DEFAULT_TMP_FS "/tmp"
136
# define DEFAULT_TOPOLOGY_PLUGIN "topology/3d_torus"
138
# define DEFAULT_TOPOLOGY_PLUGIN "topology/none"
140
#define DEFAULT_WAIT_TIME 0
141
#define DEFAULT_TREE_WIDTH 50
142
#define DEFAULT_UNKILLABLE_TIMEOUT 60 /* seconds */
143
#define DEFAULT_MAX_TASKS_PER_NODE 128
145
typedef struct slurm_conf_node {
149
char *feature; /* arbitrary list of features associated */
151
uint16_t cpus; /* count of cpus running on the node */
152
uint16_t sockets; /* number of sockets per node */
153
uint16_t cores; /* number of cores per CPU */
154
uint16_t threads; /* number of threads per core */
155
uint32_t real_memory; /* MB real memory on the node */
158
uint32_t tmp_disk; /* MB total storage in TMP_FS file system */
159
uint32_t weight; /* arbitrary priority of node for
160
* scheduling work on */
163
typedef struct slurm_conf_partition {
164
char *allow_alloc_nodes;/* comma delimited list of allowed
166
* NULL indicates all */
167
char *allow_groups; /* comma delimited list of groups,
168
* NULL indicates all */
169
bool default_flag; /* Set if default partition */
170
uint32_t default_time; /* minutes or INFINITE */
171
uint16_t disable_root_jobs; /* if set then user root can't run
172
* jobs if NO_VAL use global
175
bool hidden_flag; /* 1 if hidden by default */
176
uint16_t max_share; /* number of jobs to gang schedule */
177
uint32_t max_time; /* minutes or INFINITE */
178
uint32_t max_nodes; /* per job or INFINITE */
179
uint32_t min_nodes; /* per job */
180
char *name; /* name of the partition */
181
char *nodes; /* comma delimited list names of nodes */
182
uint16_t priority; /* scheduling priority for jobs */
183
bool root_only_flag;/* 1 if allocate/submit RPC can only be
184
issued by user root */
185
bool state_up_flag; /* 1 if state is up, 0 if down */
186
uint32_t total_nodes; /* total number of nodes in the partition */
187
uint32_t total_cpus; /* total number of cpus in the partition */
188
} slurm_conf_partition_t;
190
typedef struct slurm_conf_downnodes {
194
} slurm_conf_downnodes_t;
202
* slurm_conf_init - load the slurm configuration from the a file.
203
* IN file_name - name of the slurm configuration file to be read
204
* If file_name is NULL, then this routine tries to use
205
* the value in the SLURM_CONF env variable. Failing that,
206
* it uses the compiled-in default file name.
207
* If the conf structures have already been initialized by a call to
208
* slurm_conf_init, any subsequent calls will do nothing until
209
* slurm_conf_destroy is called.
210
* RET SLURM_SUCCESS if conf file is initialized. If the slurm conf
211
* was already initialied, return SLURM_ERROR.
212
* NOTE: Caller must NOT be holding slurm_conf_lock().
214
extern int slurm_conf_init(const char *file_name);
217
* slurm_conf_reinit - reload the slurm configuration from a file.
218
* IN file_name - name of the slurm configuration file to be read
219
* If file_name is NULL, then this routine tries to use
220
* the value in the SLURM_CONF env variable. Failing that,
221
* it uses the compiled-in default file name.
222
* Unlike slurm_conf_init, slurm_conf_reinit will always reread the
223
* file and reinitialize the configuration structures.
224
* RET SLURM_SUCCESS if conf file is reinitialized, otherwise SLURM_ERROR.
225
* NOTE: Caller must NOT be holding slurm_conf_lock().
227
extern int slurm_conf_reinit(const char *file_name);
230
* slurm_conf_mutex_init - init the slurm_conf mutex
232
extern void slurm_conf_mutex_init(void);
234
/* slurm_conf_install_fork_handlers
235
* installs what to do with a fork with the conf mutex
237
void slurm_conf_install_fork_handlers();
240
* NOTE: Caller must NOT be holding slurm_conf_lock().
242
extern int slurm_conf_destroy(void);
244
extern slurm_ctl_conf_t *slurm_conf_lock(void);
246
extern void slurm_conf_unlock(void);
249
* Set "ptr_array" with the pointer to an array of pointers to
250
* slurm_conf_node_t structures.
252
* Return value is the length of the array.
254
extern int slurm_conf_nodename_array(slurm_conf_node_t **ptr_array[]);
257
* Set "ptr_array" with the pointer to an array of pointers to
258
* slurm_conf_partition_t structures.
260
* Return value is the length of the array.
262
extern int slurm_conf_partition_array(slurm_conf_partition_t **ptr_array[]);
265
* Set "ptr_array" with the pointer to an array of pointers to
266
* slurm_conf_downnodes_t structures.
268
* Return value is the length of the array.
270
extern int slurm_conf_downnodes_array(slurm_conf_downnodes_t **ptr_array[]);
273
* slurm_conf_get_hostname - Return the NodeHostname for given NodeName
275
* Returned string was allocated with xmalloc(), and must be freed by
276
* the caller using xfree().
278
* NOTE: Caller must NOT be holding slurm_conf_lock().
280
extern char *slurm_conf_get_hostname(const char *node_name);
283
* slurm_conf_get_nodename - Return the NodeName for given NodeHostname
285
* NOTE: Call xfree() to release returned value's memory.
286
* NOTE: Caller must NOT be holding slurm_conf_lock().
288
extern char *slurm_conf_get_nodename(const char *node_hostname);
291
* slurm_conf_get_nodeaddr - Return the NodeAddr for given NodeHostname
293
* NOTE: Call xfree() to release returned value's memory.
294
* NOTE: Caller must NOT be holding slurm_conf_lock().
296
extern char *slurm_conf_get_nodeaddr(const char *node_hostname);
299
* slurm_conf_get_aliased_nodename - Return the NodeName matching an alias
300
* of the local hostname
302
* Returned string was allocated with xmalloc(), and must be freed by
303
* the caller using xfree().
305
* NOTE: Caller must NOT be holding slurm_conf_lock().
307
extern char *slurm_conf_get_aliased_nodename(void);
310
* slurm_conf_get_port - Return the port for a given NodeName
312
* NOTE: Caller must NOT be holding slurm_conf_lock().
314
extern uint16_t slurm_conf_get_port(const char *node_name);
317
* slurm_conf_get_addr - Return the slurm_addr for a given NodeName in
318
* the parameter "address". The return code is SLURM_SUCCESS on success,
319
* and SLURM_FAILURE if the address lookup failed.
321
* NOTE: Caller must NOT be holding slurm_conf_lock().
323
extern int slurm_conf_get_addr(const char *node_name, slurm_addr *address);
326
* slurm_conf_get_cpus_sct -
327
* Return the cpus, sockets, cores, and threads configured for a given NodeName
328
* Returns SLURM_SUCCESS on success, SLURM_FAILURE on failure.
330
* NOTE: Caller must NOT be holding slurm_conf_lock().
332
extern int slurm_conf_get_cpus_sct(const char *node_name,
333
uint16_t *procs, uint16_t *sockets,
334
uint16_t *cores, uint16_t *threads);
337
* init_slurm_conf - initialize or re-initialize the slurm configuration
338
* values defaults (NULL or NO_VAL). Note that the configuration
339
* file pathname (slurm_conf) is not changed.
340
* IN/OUT ctl_conf_ptr - pointer to data structure to be initialized
342
extern void init_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr);
345
* free_slurm_conf - free all storage associated with a slurm_ctl_conf_t.
346
* IN/OUT ctl_conf_ptr - pointer to data structure to be freed
347
* IN purge_node_hash - purge system-wide node hash table if set,
348
* set to zero if clearing private copy of config data
350
extern void free_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr,
351
bool purge_node_hash);
354
* gethostname_short - equivalent to gethostname(), but return only the first
355
* component of the fully qualified name (e.g. "linux123.foo.bar"
356
* becomes "linux123")
357
* NOTE: NodeName in the config may be different from real hostname.
358
* Use get_conf_node_name() to get the former.
360
extern int gethostname_short (char *name, size_t len);
363
* Replace first "%h" in path string with NodeHostname.
364
* Replace first "%n" in path string with NodeName.
366
* NOTE: Caller should be holding slurm_conf_lock() when calling this function.
368
* Returns an xmalloc()ed string which the caller must free with xfree().
370
extern char *slurm_conf_expand_slurmd_path(const char *path,
371
const char *node_name);
374
* debug_flags2str - convert a DebugFlags uint32_t to the equivalent string
375
* Returns an xmalloc()ed string which the caller must free with xfree().
377
extern char *debug_flags2str(uint32_t debug_flags);
380
* debug_str2flags - Convert a DebugFlags string to the equivalent uint32_t
381
* Returns NO_VAL if invalid
383
extern uint32_t debug_str2flags(char *debug_flags);
385
extern void destroy_config_key_pair(void *object);
386
extern void pack_config_key_pair(void *in, uint16_t rpc_version, Buf buffer);
387
extern int unpack_config_key_pair(void **object, uint16_t rpc_version,
389
extern int sort_key_pairs(config_key_pair_t *key_a, config_key_pair_t *key_b);
392
#endif /* !_READ_CONFIG_H */