~ubuntu-branches/ubuntu/vivid/slurm-llnl/vivid

« back to all changes in this revision

Viewing changes to src/slurmdbd/read_config.c

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2009-09-24 23:28:15 UTC
  • mfrom: (1.1.11 upstream) (3.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090924232815-enh65jn32q1ebg07
Tags: 2.0.5-1
* New upstream release 
* Changed dependecy from lib-mysqlclient15 to lib-mysqlclient 
* Added Default-Start for runlevel 2 and 4 and $remote_fs requirement in
  init.d scripts (Closes: #541252)
* Postinst checks for wrong runlevels 2 and 4 links
* Upgraded to standard version 3.8.3
* Add lintian overrides for missing slurm-llnl-configurator.html in doc
  base registration
* modified postrm scripts to ignore pkill return value in order to avoid
  postrm failure when no slurm process is running
* Checking for slurmctld.pid before cancelling running and pending
  jobs during package removal 

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *  read_config.c - functions for reading slurmdbd.conf
3
3
 *****************************************************************************
4
4
 *  Copyright (C) 2003-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
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
7
7
 *  Written by Morris Jette <jette1@llnl.gov>
8
 
 *  LLNL-CODE-402394.
 
8
 *  CODE-OCEC-09-009. All rights reserved.
9
9
 *  
10
10
 *  This file is part of SLURM, a resource management program.
11
 
 *  For details, see <http://www.llnl.gov/linux/slurm/>.
 
11
 *  For details, see <https://computing.llnl.gov/linux/slurm/>.
 
12
 *  Please also read the included file: DISCLAIMER.
12
13
 *  
13
14
 *  SLURM is free software; you can redistribute it and/or modify it under
14
15
 *  the terms of the GNU General Public License as published by the Free
39
40
#include <pwd.h>
40
41
#include <stdlib.h>
41
42
#include <string.h>
 
43
#include <time.h>
42
44
#include <sys/stat.h>
43
45
#include <sys/types.h>
44
46
#include <unistd.h>
45
47
#include <slurm/slurm_errno.h>
46
48
 
 
49
#include "src/common/log.h"
 
50
#include "src/common/list.h"
47
51
#include "src/common/macros.h"
48
 
#include "src/common/log.h"
49
52
#include "src/common/parse_config.h"
 
53
#include "src/common/parse_time.h"
50
54
#include "src/common/read_config.h"
 
55
#include "src/common/slurm_accounting_storage.h"
51
56
#include "src/common/uid.h"
52
57
#include "src/common/xmalloc.h"
53
58
#include "src/common/xstring.h"
61
66
static void _clear_slurmdbd_conf(void);
62
67
static char * _get_conf_path(void);
63
68
 
 
69
static time_t boot_time;
 
70
 
64
71
/*
65
72
 * free_slurmdbd_conf - free storage associated with the global variable 
66
73
 *      slurmdbd_conf
77
84
{
78
85
        if (slurmdbd_conf) {
79
86
                xfree(slurmdbd_conf->archive_dir);
 
87
                slurmdbd_conf->archive_events = 0;
80
88
                slurmdbd_conf->archive_jobs = 0;
81
89
                xfree(slurmdbd_conf->archive_script);
82
90
                slurmdbd_conf->archive_steps = 0;
 
91
                slurmdbd_conf->archive_suspend = 0;
83
92
                xfree(slurmdbd_conf->auth_info);
84
93
                xfree(slurmdbd_conf->auth_type);
85
94
                xfree(slurmdbd_conf->dbd_addr);
 
95
                xfree(slurmdbd_conf->dbd_backup);
86
96
                xfree(slurmdbd_conf->dbd_host);
87
97
                slurmdbd_conf->dbd_port = 0;
88
98
                slurmdbd_conf->debug_level = 0;
89
99
                xfree(slurmdbd_conf->default_qos);
90
 
                slurmdbd_conf->job_purge = 0;
91
100
                xfree(slurmdbd_conf->log_file);
92
101
                xfree(slurmdbd_conf->pid_file);
93
102
                xfree(slurmdbd_conf->plugindir);
94
103
                slurmdbd_conf->private_data = 0;
 
104
                slurmdbd_conf->purge_event = 0;
 
105
                slurmdbd_conf->purge_job = 0;
 
106
                slurmdbd_conf->purge_step = 0;
 
107
                slurmdbd_conf->purge_suspend = 0;
95
108
                slurmdbd_conf->slurm_user_id = NO_VAL;
96
109
                xfree(slurmdbd_conf->slurm_user_name);
97
 
                slurmdbd_conf->step_purge = 0;
 
110
                xfree(slurmdbd_conf->storage_backup_host);
98
111
                xfree(slurmdbd_conf->storage_host);
99
112
                xfree(slurmdbd_conf->storage_loc);
100
113
                xfree(slurmdbd_conf->storage_pass);
115
128
{
116
129
        s_p_options_t options[] = {
117
130
                {"ArchiveDir", S_P_STRING},
 
131
                {"ArchiveEvents", S_P_BOOLEAN},
118
132
                {"ArchiveJobs", S_P_BOOLEAN},
119
133
                {"ArchiveScript", S_P_STRING},
120
134
                {"ArchiveSteps", S_P_BOOLEAN},
 
135
                {"ArchiveSuspend", S_P_BOOLEAN},
121
136
                {"AuthInfo", S_P_STRING},
122
137
                {"AuthType", S_P_STRING},
123
138
                {"DbdAddr", S_P_STRING},
 
139
                {"DbdBackupHost", S_P_STRING},
124
140
                {"DbdHost", S_P_STRING},
125
141
                {"DbdPort", S_P_UINT16},
126
142
                {"DebugLevel", S_P_UINT16},
131
147
                {"PidFile", S_P_STRING},
132
148
                {"PluginDir", S_P_STRING},
133
149
                {"PrivateData", S_P_STRING},
 
150
                {"PurgeEventMonths", S_P_UINT16},
 
151
                {"PurgeJobMonths", S_P_UINT16},
 
152
                {"PurgeStepMonths", S_P_UINT16},
 
153
                {"PurgeSuspendMonths", S_P_UINT16},
134
154
                {"SlurmUser", S_P_STRING},
135
155
                {"StepPurge", S_P_UINT16},
 
156
                {"StorageBackupHost", S_P_STRING},
136
157
                {"StorageHost", S_P_STRING},
137
158
                {"StorageLoc", S_P_STRING},
138
159
                {"StoragePass", S_P_STRING},
148
169
 
149
170
        /* Set initial values */
150
171
        slurm_mutex_lock(&conf_mutex);
151
 
        if (slurmdbd_conf == NULL)
 
172
        if (slurmdbd_conf == NULL) {
152
173
                slurmdbd_conf = xmalloc(sizeof(slurm_dbd_conf_t));
 
174
                boot_time = time(NULL);
 
175
        }
153
176
        slurmdbd_conf->debug_level = LOG_LEVEL_INFO;
154
177
        _clear_slurmdbd_conf();
155
178
 
163
186
                tbl = s_p_hashtbl_create(options);
164
187
                if (s_p_parse_file(tbl, conf_path) == SLURM_ERROR) {
165
188
                        fatal("Could not open/read/parse slurmdbd.conf file %s",
166
 
                             conf_path);
 
189
                              conf_path);
167
190
                }
168
191
 
169
192
                if(!s_p_get_string(&slurmdbd_conf->archive_dir, "ArchiveDir",
170
193
                                   tbl))
171
194
                        slurmdbd_conf->archive_dir =
172
195
                                xstrdup(DEFAULT_SLURMDBD_ARCHIVE_DIR);
 
196
                s_p_get_boolean((bool *)&slurmdbd_conf->archive_events,
 
197
                                "ArchiveEvents", tbl);
173
198
                s_p_get_boolean((bool *)&slurmdbd_conf->archive_jobs,
174
199
                                "ArchiveJobs", tbl);
175
200
                s_p_get_string(&slurmdbd_conf->archive_script, "ArchiveScript",
178
203
                                "ArchiveSteps", tbl);
179
204
                s_p_get_string(&slurmdbd_conf->auth_info, "AuthInfo", tbl);
180
205
                s_p_get_string(&slurmdbd_conf->auth_type, "AuthType", tbl);
 
206
                s_p_get_string(&slurmdbd_conf->dbd_backup,
 
207
                               "DbdBackupHost", tbl);
181
208
                s_p_get_string(&slurmdbd_conf->dbd_host, "DbdHost", tbl);
182
209
                s_p_get_string(&slurmdbd_conf->dbd_addr, "DbdAddr", tbl);
183
210
                s_p_get_uint16(&slurmdbd_conf->dbd_port, "DbdPort", tbl);
184
211
                s_p_get_uint16(&slurmdbd_conf->debug_level, "DebugLevel", tbl);
185
212
                s_p_get_string(&slurmdbd_conf->default_qos, "DefaultQOS", tbl);
186
 
                s_p_get_uint16(&slurmdbd_conf->job_purge, "JobPurge", tbl);
 
213
                s_p_get_uint16(&slurmdbd_conf->purge_job, "JobPurge", tbl);
187
214
                s_p_get_string(&slurmdbd_conf->log_file, "LogFile", tbl);
188
215
                if (!s_p_get_uint16(&slurmdbd_conf->msg_timeout,
189
216
                                    "MessageTimeout", tbl))
195
222
                s_p_get_string(&slurmdbd_conf->pid_file, "PidFile", tbl);
196
223
                s_p_get_string(&slurmdbd_conf->plugindir, "PluginDir", tbl);
197
224
                if (s_p_get_string(&temp_str, "PrivateData", tbl)) {
 
225
                        if (strstr(temp_str, "account"))
 
226
                                slurmdbd_conf->private_data 
 
227
                                        |= PRIVATE_DATA_ACCOUNTS;
198
228
                        if (strstr(temp_str, "job"))
199
229
                                slurmdbd_conf->private_data 
200
230
                                        |= PRIVATE_DATA_JOBS;
204
234
                        if (strstr(temp_str, "partition"))
205
235
                                slurmdbd_conf->private_data 
206
236
                                        |= PRIVATE_DATA_PARTITIONS;
 
237
                        if (strstr(temp_str, "reservation"))
 
238
                                slurmdbd_conf->private_data
 
239
                                        |= PRIVATE_DATA_RESERVATIONS;
207
240
                        if (strstr(temp_str, "usage"))
208
241
                                slurmdbd_conf->private_data
209
242
                                        |= PRIVATE_DATA_USAGE;
210
 
                        if (strstr(temp_str, "users"))
 
243
                        if (strstr(temp_str, "user"))
211
244
                                slurmdbd_conf->private_data 
212
245
                                        |= PRIVATE_DATA_USERS;
213
 
                        if (strstr(temp_str, "accounts"))
214
 
                                slurmdbd_conf->private_data 
215
 
                                        |= PRIVATE_DATA_ACCOUNTS;
216
246
                        if (strstr(temp_str, "all"))
217
247
                                slurmdbd_conf->private_data = 0xffff;
218
248
                        xfree(temp_str);
219
249
                }
220
250
 
 
251
                s_p_get_uint16(&slurmdbd_conf->purge_event,
 
252
                               "PurgeEventMonths", tbl);
 
253
                s_p_get_uint16(&slurmdbd_conf->purge_job,
 
254
                               "PurgeJobMonths", tbl);
 
255
                s_p_get_uint16(&slurmdbd_conf->purge_step,
 
256
                               "PurgeStepMonths", tbl);
 
257
                s_p_get_uint16(&slurmdbd_conf->purge_suspend,
 
258
                               "PurgeSuspendMonths", tbl);
 
259
 
221
260
                s_p_get_string(&slurmdbd_conf->slurm_user_name, "SlurmUser",
222
261
                               tbl);
223
 
                s_p_get_uint16(&slurmdbd_conf->step_purge, "StepPurge", tbl);
 
262
                s_p_get_uint16(&slurmdbd_conf->purge_step, "StepPurge", tbl);
224
263
 
 
264
                s_p_get_string(&slurmdbd_conf->storage_backup_host,
 
265
                               "StorageBackupHost", tbl);
225
266
                s_p_get_string(&slurmdbd_conf->storage_host,
226
 
                                "StorageHost", tbl);
 
267
                               "StorageHost", tbl);
227
268
                s_p_get_string(&slurmdbd_conf->storage_loc,
228
 
                                "StorageLoc", tbl);
 
269
                               "StorageLoc", tbl);
229
270
                s_p_get_string(&slurmdbd_conf->storage_pass,
230
 
                                "StoragePass", tbl);
 
271
                               "StoragePass", tbl);
231
272
                s_p_get_uint16(&slurmdbd_conf->storage_port,
232
273
                               "StoragePort", tbl);
233
274
                s_p_get_string(&slurmdbd_conf->storage_type,
234
275
                               "StorageType", tbl);
235
276
                s_p_get_string(&slurmdbd_conf->storage_user,
236
 
                                "StorageUser", tbl);
237
 
 
 
277
                               "StorageUser", tbl);
 
278
                
238
279
                if(!s_p_get_boolean((bool *)&slurmdbd_conf->track_wckey, 
239
280
                                    "TrackWCKey", tbl))
240
281
                        slurmdbd_conf->track_wckey = false;
259
300
        if(slurmdbd_conf->plugindir == NULL)
260
301
                slurmdbd_conf->plugindir = xstrdup(default_plugin_path);
261
302
        if (slurmdbd_conf->slurm_user_name) {
262
 
                uid_t pw_uid = uid_from_string(slurmdbd_conf->slurm_user_name);
263
 
                if (pw_uid == (uid_t) -1) {
 
303
                uid_t pw_uid;
 
304
                if (uid_from_string (slurmdbd_conf->slurm_user_name,
 
305
                                        &pw_uid) < 0)
264
306
                        fatal("Invalid user for SlurmUser %s, ignored",
265
307
                              slurmdbd_conf->slurm_user_name);
266
 
                } else
 
308
                else
267
309
                        slurmdbd_conf->slurm_user_id = pw_uid;
268
310
        } else {
269
311
                slurmdbd_conf->slurm_user_name = xstrdup("root");
270
312
                slurmdbd_conf->slurm_user_id = 0;
271
313
        }
 
314
        
272
315
        if (slurmdbd_conf->storage_type == NULL)
273
316
                fatal("StorageType must be specified");
 
317
 
 
318
        if (!slurmdbd_conf->storage_host)
 
319
                slurmdbd_conf->storage_host = xstrdup(DEFAULT_STORAGE_HOST);
 
320
 
 
321
        if (!slurmdbd_conf->storage_user)               
 
322
                slurmdbd_conf->storage_user = xstrdup(getlogin());
274
323
        
 
324
        if(!strcmp(slurmdbd_conf->storage_type, 
 
325
                          "accounting_storage/mysql")) {
 
326
                if(!slurmdbd_conf->storage_port)
 
327
                        slurmdbd_conf->storage_port = DEFAULT_MYSQL_PORT;
 
328
                if(!slurmdbd_conf->storage_loc)
 
329
                        slurmdbd_conf->storage_loc =
 
330
                                xstrdup(DEFAULT_ACCOUNTING_DB);
 
331
        } else if(!strcmp(slurmdbd_conf->storage_type,
 
332
                          "accounting_storage/pgsql")) {
 
333
                if(!slurmdbd_conf->storage_port)
 
334
                        slurmdbd_conf->storage_port = DEFAULT_PGSQL_PORT;
 
335
                if(!slurmdbd_conf->storage_loc)
 
336
                        slurmdbd_conf->storage_loc =
 
337
                                xstrdup(DEFAULT_ACCOUNTING_DB);
 
338
        } else {
 
339
                if(!slurmdbd_conf->storage_port)
 
340
                        slurmdbd_conf->storage_port = DEFAULT_STORAGE_PORT;
 
341
                if(!slurmdbd_conf->storage_loc)
 
342
                        slurmdbd_conf->storage_loc =
 
343
                                xstrdup(DEFAULT_STORAGE_LOC);
 
344
        }
 
345
 
275
346
        if (slurmdbd_conf->archive_dir) {
276
347
                if(stat(slurmdbd_conf->archive_dir, &buf) < 0) 
277
348
                        fatal("Failed to stat the archive directory %s: %m",
309
380
        char tmp_str[128];
310
381
 
311
382
        debug2("ArchiveDir        = %s", slurmdbd_conf->archive_dir);
 
383
        debug2("ArchiveEvents     = %u", slurmdbd_conf->archive_events);
 
384
        debug2("ArchiveJobs       = %u", slurmdbd_conf->archive_jobs);
312
385
        debug2("ArchiveScript     = %s", slurmdbd_conf->archive_script);
 
386
        debug2("ArchiveSteps      = %u", slurmdbd_conf->archive_steps);
 
387
        debug2("ArchiveSuspend    = %u", slurmdbd_conf->archive_suspend);
313
388
        debug2("AuthInfo          = %s", slurmdbd_conf->auth_info);
314
389
        debug2("AuthType          = %s", slurmdbd_conf->auth_type);
315
390
        debug2("DbdAddr           = %s", slurmdbd_conf->dbd_addr);
 
391
        debug2("DbdBackupHost     = %s", slurmdbd_conf->dbd_backup);
316
392
        debug2("DbdHost           = %s", slurmdbd_conf->dbd_host);
317
393
        debug2("DbdPort           = %u", slurmdbd_conf->dbd_port);
318
394
        debug2("DebugLevel        = %u", slurmdbd_conf->debug_level);
319
395
        debug2("DefaultQOS        = %s", slurmdbd_conf->default_qos);
320
396
 
321
 
        if(slurmdbd_conf->job_purge)
322
 
                debug2("JobPurge          = %u months",
323
 
                       slurmdbd_conf->job_purge);
324
 
        else
325
 
                debug2("JobPurge          = NONE");
326
 
                
327
397
        debug2("LogFile           = %s", slurmdbd_conf->log_file);
328
398
        debug2("MessageTimeout    = %u", slurmdbd_conf->msg_timeout);
329
399
        debug2("PidFile           = %s", slurmdbd_conf->pid_file);
333
403
                            tmp_str, sizeof(tmp_str));
334
404
 
335
405
        debug2("PrivateData       = %s", tmp_str);
 
406
 
 
407
        if(slurmdbd_conf->purge_job)
 
408
                debug2("PurgeJobMonths    = %u months",
 
409
                       slurmdbd_conf->purge_job);
 
410
        else
 
411
                debug2("PurgeJobMonths    = NONE");
 
412
                
 
413
        if(slurmdbd_conf->purge_event)
 
414
                debug2("PurgeEventMonths  = %u months",
 
415
                       slurmdbd_conf->purge_event);
 
416
        else
 
417
                debug2("PurgeEventMonths  = NONE");
 
418
                
 
419
        if(slurmdbd_conf->purge_step)
 
420
                debug2("PurgeStepMonths   = %u months",
 
421
                       slurmdbd_conf->purge_step);
 
422
        else
 
423
                debug2("PurgeStepMonths   = NONE");
 
424
                
 
425
        if(slurmdbd_conf->purge_suspend)
 
426
                debug2("PurgeSuspendMonths= %u months",
 
427
                       slurmdbd_conf->purge_suspend);
 
428
        else
 
429
                debug2("PurgeSuspendMonths= NONE");
 
430
                
336
431
        debug2("SlurmUser         = %s(%u)", 
337
 
                slurmdbd_conf->slurm_user_name, slurmdbd_conf->slurm_user_id);
 
432
               slurmdbd_conf->slurm_user_name, slurmdbd_conf->slurm_user_id);
338
433
 
339
 
        if(slurmdbd_conf->step_purge)
340
 
                debug2("StepPurge         = %u months", 
341
 
                       slurmdbd_conf->step_purge); 
342
 
        else
343
 
                debug2("StepPurge         = NONE"); 
344
 
                
 
434
        debug2("StorageBackupHost = %s", slurmdbd_conf->storage_backup_host);
345
435
        debug2("StorageHost       = %s", slurmdbd_conf->storage_host);
346
436
        debug2("StorageLoc        = %s", slurmdbd_conf->storage_loc);
347
437
        debug2("StoragePass       = %s", slurmdbd_conf->storage_pass);
348
438
        debug2("StoragePort       = %u", slurmdbd_conf->storage_port);
349
439
        debug2("StorageType       = %s", slurmdbd_conf->storage_type);
350
440
        debug2("StorageUser       = %s", slurmdbd_conf->storage_user);
 
441
 
351
442
        debug2("TrackWCKey        = %u", slurmdbd_conf->track_wckey);
352
443
}
353
444
 
397
488
 
398
489
        return path;
399
490
}
 
491
 
 
492
/* Dump the configuration in name,value pairs for output to 
 
493
 *      "sacctmgr show config", caller must call list_destroy() */
 
494
extern List dump_config(void)
 
495
{
 
496
        config_key_pair_t *key_pair;
 
497
        List my_list = list_create(destroy_config_key_pair);
 
498
 
 
499
        if (!my_list)
 
500
                fatal("malloc failure on list_create");
 
501
 
 
502
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
503
        key_pair->name = xstrdup("ArchiveDir");
 
504
        key_pair->value = xstrdup(slurmdbd_conf->archive_dir);
 
505
        list_append(my_list, key_pair);
 
506
 
 
507
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
508
        key_pair->name = xstrdup("ArchiveEvents");
 
509
        key_pair->value = xmalloc(16);
 
510
        snprintf(key_pair->value, 16, "%u", slurmdbd_conf->archive_events);
 
511
        list_append(my_list, key_pair);
 
512
 
 
513
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
514
        key_pair->name = xstrdup("ArchiveJobs");
 
515
        key_pair->value = xmalloc(16);
 
516
        snprintf(key_pair->value, 16, "%u", slurmdbd_conf->archive_jobs);
 
517
        list_append(my_list, key_pair);
 
518
 
 
519
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
520
        key_pair->name = xstrdup("ArchiveScript");
 
521
        key_pair->value = xstrdup(slurmdbd_conf->archive_script);
 
522
        list_append(my_list, key_pair);
 
523
 
 
524
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
525
        key_pair->name = xstrdup("ArchiveSteps");
 
526
        key_pair->value = xmalloc(16);
 
527
        snprintf(key_pair->value, 16, "%u", slurmdbd_conf->archive_steps);
 
528
        list_append(my_list, key_pair);
 
529
 
 
530
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
531
        key_pair->name = xstrdup("ArchiveSupend");
 
532
        key_pair->value = xmalloc(16);
 
533
        snprintf(key_pair->value, 16, "%u", slurmdbd_conf->archive_suspend);
 
534
        list_append(my_list, key_pair);
 
535
 
 
536
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
537
        key_pair->name = xstrdup("AuthInfo");
 
538
        key_pair->value = xstrdup(slurmdbd_conf->auth_info);
 
539
        list_append(my_list, key_pair);
 
540
 
 
541
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
542
        key_pair->name = xstrdup("AuthType");
 
543
        key_pair->value = xstrdup(slurmdbd_conf->auth_type);
 
544
        list_append(my_list, key_pair);
 
545
 
 
546
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
547
        key_pair->name = xstrdup("BOOT_TIME");
 
548
        key_pair->value = xmalloc(128);
 
549
        slurm_make_time_str ((time_t *)&boot_time, key_pair->value, 128);
 
550
        list_append(my_list, key_pair);
 
551
 
 
552
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
553
        key_pair->name = xstrdup("DbdAddr");
 
554
        key_pair->value = xstrdup(slurmdbd_conf->dbd_addr);
 
555
        list_append(my_list, key_pair);
 
556
 
 
557
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
558
        key_pair->name = xstrdup("DbdBackupHost");
 
559
        key_pair->value = xstrdup(slurmdbd_conf->dbd_backup);
 
560
        list_append(my_list, key_pair);
 
561
 
 
562
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
563
        key_pair->name = xstrdup("DbdHost");
 
564
        key_pair->value = xstrdup(slurmdbd_conf->dbd_host);
 
565
        list_append(my_list, key_pair);
 
566
 
 
567
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
568
        key_pair->name = xstrdup("DbdPort");
 
569
        key_pair->value = xmalloc(32);
 
570
        snprintf(key_pair->value, 32, "%u", slurmdbd_conf->dbd_port);
 
571
        list_append(my_list, key_pair);
 
572
 
 
573
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
574
        key_pair->name = xstrdup("DebugLevel");
 
575
        key_pair->value = xmalloc(32);
 
576
        snprintf(key_pair->value, 32, "%u", slurmdbd_conf->debug_level);
 
577
        list_append(my_list, key_pair);
 
578
 
 
579
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
580
        key_pair->name = xstrdup("DefaultQOS");
 
581
        key_pair->value = xstrdup(slurmdbd_conf->default_qos);
 
582
        list_append(my_list, key_pair);
 
583
 
 
584
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
585
        key_pair->name = xstrdup("LogFile");
 
586
        key_pair->value = xstrdup(slurmdbd_conf->log_file);
 
587
        list_append(my_list, key_pair);
 
588
 
 
589
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
590
        key_pair->name = xstrdup("MessageTimeout");
 
591
        key_pair->value = xmalloc(32);
 
592
        snprintf(key_pair->value, 32, "%u secs", slurmdbd_conf->msg_timeout);
 
593
        list_append(my_list, key_pair);
 
594
 
 
595
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
596
        key_pair->name = xstrdup("PidFile");
 
597
        key_pair->value = xstrdup(slurmdbd_conf->pid_file);
 
598
        list_append(my_list, key_pair);
 
599
 
 
600
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
601
        key_pair->name = xstrdup("PluginDir");
 
602
        key_pair->value = xstrdup(slurmdbd_conf->plugindir);
 
603
        list_append(my_list, key_pair);
 
604
 
 
605
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
606
        key_pair->name = xstrdup("PrivateData");
 
607
        key_pair->value = xmalloc(128);
 
608
        private_data_string(slurmdbd_conf->private_data,
 
609
                            key_pair->value, 128);
 
610
        list_append(my_list, key_pair);
 
611
 
 
612
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
613
        key_pair->name = xstrdup("PurgeEventMonths");
 
614
        if(slurmdbd_conf->purge_event) {
 
615
                key_pair->value = xmalloc(32);
 
616
                snprintf(key_pair->value, 32, "%u months", 
 
617
                         slurmdbd_conf->purge_event);
 
618
        } else
 
619
                key_pair->value = xstrdup("NONE");
 
620
        list_append(my_list, key_pair);
 
621
 
 
622
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
623
        key_pair->name = xstrdup("PurgeJobMonths");
 
624
        if(slurmdbd_conf->purge_job) {
 
625
                key_pair->value = xmalloc(32);
 
626
                snprintf(key_pair->value, 32, "%u months", 
 
627
                         slurmdbd_conf->purge_job);
 
628
        } else
 
629
                key_pair->value = xstrdup("NONE");
 
630
        list_append(my_list, key_pair);
 
631
 
 
632
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
633
        key_pair->name = xstrdup("PurgeStepMonths");
 
634
        if(slurmdbd_conf->purge_step) {
 
635
                key_pair->value = xmalloc(32);
 
636
                snprintf(key_pair->value, 32, "%u months", 
 
637
                         slurmdbd_conf->purge_step);
 
638
        } else
 
639
                key_pair->value = xstrdup("NONE");
 
640
        list_append(my_list, key_pair);
 
641
 
 
642
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
643
        key_pair->name = xstrdup("PurgeSuspendMonths");
 
644
        if(slurmdbd_conf->purge_suspend) {
 
645
                key_pair->value = xmalloc(32);
 
646
                snprintf(key_pair->value, 32, "%u months", 
 
647
                         slurmdbd_conf->purge_suspend);
 
648
        } else
 
649
                key_pair->value = xstrdup("NONE");
 
650
        list_append(my_list, key_pair);
 
651
 
 
652
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
653
        key_pair->name = xstrdup("SLURMDBD_CONF");
 
654
        key_pair->value = _get_conf_path();
 
655
        list_append(my_list, key_pair);
 
656
 
 
657
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
658
        key_pair->name = xstrdup("SLURMDBD_VERSION");
 
659
        key_pair->value = xstrdup(SLURM_VERSION);
 
660
        list_append(my_list, key_pair);
 
661
 
 
662
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
663
        key_pair->name = xstrdup("SlurmUser");
 
664
        key_pair->value = xmalloc(128);
 
665
        snprintf(key_pair->value, 128, "%s(%u)",
 
666
                 slurmdbd_conf->slurm_user_name, slurmdbd_conf->slurm_user_id);
 
667
        list_append(my_list, key_pair);
 
668
 
 
669
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
670
        key_pair->name = xstrdup("StorageBackupHost");
 
671
        key_pair->value = xstrdup(slurmdbd_conf->storage_backup_host);
 
672
        list_append(my_list, key_pair);
 
673
 
 
674
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
675
        key_pair->name = xstrdup("StorageHost");
 
676
        key_pair->value = xstrdup(slurmdbd_conf->storage_host);
 
677
        list_append(my_list, key_pair);
 
678
 
 
679
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
680
        key_pair->name = xstrdup("StorageLoc");
 
681
        key_pair->value = xstrdup(slurmdbd_conf->storage_loc);
 
682
        list_append(my_list, key_pair);
 
683
 
 
684
        /* StoragePass should NOT be passed due to security reasons */
 
685
 
 
686
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
687
        key_pair->name = xstrdup("StoragePort");
 
688
        key_pair->value = xmalloc(32);
 
689
        snprintf(key_pair->value, 32, "%u", slurmdbd_conf->storage_port);
 
690
        list_append(my_list, key_pair);
 
691
 
 
692
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
693
        key_pair->name = xstrdup("StorageType");
 
694
        key_pair->value = xstrdup(slurmdbd_conf->storage_type);
 
695
        list_append(my_list, key_pair);
 
696
 
 
697
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
698
        key_pair->name = xstrdup("StorageUser");
 
699
        key_pair->value = xstrdup(slurmdbd_conf->storage_user);
 
700
        list_append(my_list, key_pair);
 
701
 
 
702
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
703
        key_pair->name = xstrdup("TrackWCKey");
 
704
        key_pair->value = xmalloc(32);
 
705
        snprintf(key_pair->value, 32, "%u", slurmdbd_conf->track_wckey);
 
706
        list_append(my_list, key_pair);
 
707
 
 
708
        return my_list;
 
709
}