~ubuntu-branches/ubuntu/wily/slurm-llnl/wily

« back to all changes in this revision

Viewing changes to .pc/debian-changes-2.1.10/src/common/read_config.h

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2010-09-03 18:03:29 UTC
  • mfrom: (3.3.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100903180329-t0t8mtvk2eoctoso
Tags: 2.1.14-1
New upstream release 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 *  read_config.h - definitions for reading the overall slurm configuration
 
3
 *  file
 
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.
 
11
 *
 
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.
 
15
 *
 
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)
 
19
 *  any later version.
 
20
 *
 
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.
 
31
 *
 
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
 
35
 *  details.
 
36
 *
 
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
\*****************************************************************************/
 
41
 
 
42
#ifndef _READ_CONFIG_H
 
43
#define _READ_CONFIG_H
 
44
 
 
45
#include "src/common/slurm_protocol_defs.h"
 
46
#include "src/common/slurm_protocol_socket_common.h"
 
47
#include "src/common/parse_config.h"
 
48
 
 
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;
 
53
 
 
54
#define ACCOUNTING_ENFORCE_ASSOCS 0x0001
 
55
#define ACCOUNTING_ENFORCE_LIMITS 0x0002
 
56
#define ACCOUNTING_ENFORCE_WCKEYS 0x0004
 
57
#define ACCOUNTING_ENFORCE_QOS    0x0008
 
58
 
 
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"
 
96
#else
 
97
#  define DEFAULT_CHECKPOINT_TYPE   "checkpoint/none"
 
98
#  define DEFAULT_PROCTRACK_TYPE    "proctrack/pgid"
 
99
#endif
 
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"
 
115
#else
 
116
#  define DEFAULT_SELECT_TYPE       "select/linear"
 
117
#endif
 
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"
 
135
#ifdef HAVE_3D
 
136
#  define DEFAULT_TOPOLOGY_PLUGIN     "topology/3d_torus"
 
137
#else
 
138
#  define DEFAULT_TOPOLOGY_PLUGIN     "topology/none"
 
139
#endif
 
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
 
144
 
 
145
typedef struct slurm_conf_node {
 
146
        char *nodenames;
 
147
        char *hostnames;
 
148
        char *addresses;
 
149
        char *feature;          /* arbitrary list of features associated */
 
150
        uint16_t port;
 
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 */
 
156
        char *reason;
 
157
        char *state;
 
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 */
 
161
} slurm_conf_node_t;
 
162
 
 
163
typedef struct slurm_conf_partition {
 
164
        char *allow_alloc_nodes;/* comma delimited list of allowed
 
165
                                 * allocating nodes
 
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
 
173
                                     * default */
 
174
 
 
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;
 
189
 
 
190
typedef struct slurm_conf_downnodes {
 
191
        char *nodenames;
 
192
        char *reason;
 
193
        char *state;
 
194
} slurm_conf_downnodes_t;
 
195
 
 
196
typedef struct {
 
197
        char *name;
 
198
        char *value;
 
199
} config_key_pair_t;
 
200
 
 
201
/*
 
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().
 
213
 */
 
214
extern int slurm_conf_init(const char *file_name);
 
215
 
 
216
/*
 
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().
 
226
 */
 
227
extern int slurm_conf_reinit(const char *file_name);
 
228
 
 
229
/*
 
230
 * slurm_conf_mutex_init - init the slurm_conf mutex
 
231
 */
 
232
extern void slurm_conf_mutex_init(void);
 
233
 
 
234
/* slurm_conf_install_fork_handlers
 
235
 * installs what to do with a fork with the conf mutex
 
236
 */
 
237
void slurm_conf_install_fork_handlers();
 
238
 
 
239
/*
 
240
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
241
 */
 
242
extern int slurm_conf_destroy(void);
 
243
 
 
244
extern slurm_ctl_conf_t *slurm_conf_lock(void);
 
245
 
 
246
extern void slurm_conf_unlock(void);
 
247
 
 
248
/*
 
249
 * Set "ptr_array" with the pointer to an array of pointers to
 
250
 * slurm_conf_node_t structures.
 
251
 *
 
252
 * Return value is the length of the array.
 
253
 */
 
254
extern int slurm_conf_nodename_array(slurm_conf_node_t **ptr_array[]);
 
255
 
 
256
/*
 
257
 * Set "ptr_array" with the pointer to an array of pointers to
 
258
 * slurm_conf_partition_t structures.
 
259
 *
 
260
 * Return value is the length of the array.
 
261
 */
 
262
extern int slurm_conf_partition_array(slurm_conf_partition_t **ptr_array[]);
 
263
 
 
264
/*
 
265
 * Set "ptr_array" with the pointer to an array of pointers to
 
266
 * slurm_conf_downnodes_t structures.
 
267
 *
 
268
 * Return value is the length of the array.
 
269
 */
 
270
extern int slurm_conf_downnodes_array(slurm_conf_downnodes_t **ptr_array[]);
 
271
 
 
272
/*
 
273
 * slurm_conf_get_hostname - Return the NodeHostname for given NodeName
 
274
 *
 
275
 * Returned string was allocated with xmalloc(), and must be freed by
 
276
 * the caller using xfree().
 
277
 *
 
278
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
279
 */
 
280
extern char *slurm_conf_get_hostname(const char *node_name);
 
281
 
 
282
/*
 
283
 * slurm_conf_get_nodename - Return the NodeName for given NodeHostname
 
284
 *
 
285
 * NOTE: Call xfree() to release returned value's memory.
 
286
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
287
 */
 
288
extern char *slurm_conf_get_nodename(const char *node_hostname);
 
289
 
 
290
/*
 
291
 * slurm_conf_get_nodeaddr - Return the NodeAddr for given NodeHostname
 
292
 *
 
293
 * NOTE: Call xfree() to release returned value's memory.
 
294
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
295
 */
 
296
extern char *slurm_conf_get_nodeaddr(const char *node_hostname);
 
297
 
 
298
/*
 
299
 * slurm_conf_get_aliased_nodename - Return the NodeName matching an alias
 
300
 * of the local hostname
 
301
 *
 
302
 * Returned string was allocated with xmalloc(), and must be freed by
 
303
 * the caller using xfree().
 
304
 *
 
305
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
306
 */
 
307
extern char *slurm_conf_get_aliased_nodename(void);
 
308
 
 
309
/*
 
310
 * slurm_conf_get_port - Return the port for a given NodeName
 
311
 *
 
312
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
313
 */
 
314
extern uint16_t slurm_conf_get_port(const char *node_name);
 
315
 
 
316
/*
 
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.
 
320
 *
 
321
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
322
 */
 
323
extern int slurm_conf_get_addr(const char *node_name, slurm_addr *address);
 
324
 
 
325
/*
 
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.
 
329
 *
 
330
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
331
 */
 
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);
 
335
 
 
336
/*
 
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
 
341
 */
 
342
extern void init_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr);
 
343
 
 
344
/*
 
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
 
349
 */
 
350
extern void free_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr,
 
351
                             bool purge_node_hash);
 
352
 
 
353
/*
 
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.
 
359
 */
 
360
extern int gethostname_short (char *name, size_t len);
 
361
 
 
362
/*
 
363
 * Replace first "%h" in path string with NodeHostname.
 
364
 * Replace first "%n" in path string with NodeName.
 
365
 *
 
366
 * NOTE: Caller should be holding slurm_conf_lock() when calling this function.
 
367
 *
 
368
 * Returns an xmalloc()ed string which the caller must free with xfree().
 
369
 */
 
370
extern char *slurm_conf_expand_slurmd_path(const char *path,
 
371
                                           const char *node_name);
 
372
 
 
373
/*
 
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().
 
376
 */
 
377
extern char *debug_flags2str(uint32_t debug_flags);
 
378
 
 
379
/*
 
380
 * debug_str2flags - Convert a DebugFlags string to the equivalent uint32_t
 
381
 * Returns NO_VAL if invalid
 
382
 */
 
383
extern uint32_t debug_str2flags(char *debug_flags);
 
384
 
 
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,
 
388
                                  Buf buffer);
 
389
extern int sort_key_pairs(config_key_pair_t *key_a, config_key_pair_t *key_b);
 
390
 
 
391
 
 
392
#endif /* !_READ_CONFIG_H */