~ubuntu-branches/ubuntu/saucy/slurm-llnl/saucy

« back to all changes in this revision

Viewing changes to src/common/read_config.c

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2008-05-30 13:11:30 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080530131130-l6ko6aie7xhrlmxe
Tags: 1.3.3-1
* New upstream release
* Removed patches to src/slurmctd/controller.c src/slurmdbd/slurmdbd.c
  doc/man/man1/sacctmgr.1 included to upstream
* Edited watch file to seek for 1.3 releases
* doc/man/man1/salloc.1 doc/man/man1/sbatch.1 doc/man/man5/slurm.conf.5
  patched to improve formatting and avoid manual warnings 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************\
2
2
 *  read_config.c - read the overall slurm configuration file
3
3
 *****************************************************************************
4
 
 *  Copyright (C) 2002-2006 The Regents of the University of California.
 
4
 *  Copyright (C) 2002-2007 The Regents of the University of California.
 
5
 *  Copyright (C) 2008 Lawrence Livermore National Security.
5
6
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
6
7
 *  Written by Morris Jette <jette1@llnl.gov>.
7
 
 *  UCRL-CODE-226842.
 
8
 *  LLNL-CODE-402394.
8
9
 *  
9
10
 *  This file is part of SLURM, a resource management program.
10
11
 *  For details, see <http://www.llnl.gov/linux/slurm/>.
64
65
#include "src/common/xstring.h"
65
66
#include "src/common/slurm_rlimits_info.h"
66
67
#include "src/common/parse_config.h"
 
68
#include "src/common/parse_time.h"
67
69
#include "src/common/slurm_selecttype_info.h"
68
70
 
69
71
/* Instantiation of the "extern slurm_ctl_conf_t slurmcltd_conf"
119
121
                                      s_p_hashtbl_t *hashtbl);
120
122
 
121
123
s_p_options_t slurm_conf_options[] = {
 
124
        {"AccountingStorageEnforce", S_P_UINT16},
 
125
        {"AccountingStorageHost", S_P_STRING},
 
126
        {"AccountingStorageLoc", S_P_STRING},
 
127
        {"AccountingStoragePass", S_P_STRING},
 
128
        {"AccountingStoragePort", S_P_UINT32},
 
129
        {"AccountingStorageType", S_P_STRING},
 
130
        {"AccountingStorageUser", S_P_STRING},
122
131
        {"AuthType", S_P_STRING},
 
132
        {"BackupAddr", S_P_STRING},
 
133
        {"BackupController", S_P_STRING},
123
134
        {"CheckpointType", S_P_STRING},
124
135
        {"CacheGroups", S_P_UINT16},
125
 
        {"BackupAddr", S_P_STRING},
126
 
        {"BackupController", S_P_STRING},
 
136
        {"ClusterName", S_P_STRING},
127
137
        {"ControlAddr", S_P_STRING},
128
138
        {"ControlMachine", S_P_STRING},
129
 
        {"DisableRootJobs", S_P_UINT16},
 
139
        {"CryptoType", S_P_STRING},
 
140
        {"DefaultStorageHost", S_P_STRING},
 
141
        {"DefaultStorageLoc", S_P_STRING},
 
142
        {"DefaultStoragePass", S_P_STRING},
 
143
        {"DefaultStoragePort", S_P_UINT32},
 
144
        {"DefaultStorageType", S_P_STRING},
 
145
        {"DefaultStorageUser", S_P_STRING},
 
146
        {"DefMemPerTask", S_P_UINT32},
 
147
        {"DisableRootJobs", S_P_BOOLEAN},
130
148
        {"Epilog", S_P_STRING},
 
149
        {"EpilogMsgTime", S_P_UINT32},
131
150
        {"FastSchedule", S_P_UINT16},
132
151
        {"FirstJobId", S_P_UINT32},
 
152
        {"GetEnvTimeout", S_P_UINT16},
133
153
        {"HashBase", S_P_LONG, defunct_option},
134
154
        {"HeartbeatInterval", S_P_LONG, defunct_option},
 
155
        {"HealthCheckInterval", S_P_UINT16},
 
156
        {"HealthCheckProgram", S_P_STRING},
135
157
        {"InactiveLimit", S_P_UINT16},
 
158
        {"JobAcctGatherType", S_P_STRING},
 
159
        {"JobAcctFrequency", S_P_UINT16, defunct_option},
 
160
        {"JobAcctGatherFrequency", S_P_UINT16},
136
161
        {"JobAcctLogFile", S_P_STRING},
137
 
        {"JobAcctFrequency", S_P_UINT16},
138
162
        {"JobAcctType", S_P_STRING},
 
163
        {"JobCompHost", S_P_STRING},
139
164
        {"JobCompLoc", S_P_STRING},
 
165
        {"JobCompPass", S_P_STRING},
 
166
        {"JobCompPort", S_P_UINT32},
140
167
        {"JobCompType", S_P_STRING},
 
168
        {"JobCompUser", S_P_STRING},
141
169
        {"JobCredentialPrivateKey", S_P_STRING},
142
170
        {"JobCredentialPublicCertificate", S_P_STRING},
143
171
        {"JobFileAppend", S_P_UINT16},
144
 
        {"GetEnvTimeout", S_P_UINT16},
 
172
        {"JobRequeue", S_P_UINT16},
145
173
        {"KillTree", S_P_UINT16, defunct_option},
146
174
        {"KillWait", S_P_UINT16},
 
175
        {"Licenses", S_P_STRING},
147
176
        {"MailProg", S_P_STRING},
148
177
        {"MaxJobCount", S_P_UINT16},
 
178
        {"MaxMemPerTask", S_P_UINT32},
149
179
        {"MessageTimeout", S_P_UINT16},
150
180
        {"MinJobAge", S_P_UINT16},
151
 
        {"MpichGmDirectSupport", S_P_LONG},
 
181
        {"MpichGmDirectSupport", S_P_LONG, defunct_option},
152
182
        {"MpiDefault", S_P_STRING},
153
183
        {"PluginDir", S_P_STRING},
154
184
        {"PlugStackConfig", S_P_STRING},
 
185
        {"PrivateData", S_P_UINT16},
155
186
        {"ProctrackType", S_P_STRING},
156
187
        {"Prolog", S_P_STRING},
157
188
        {"PropagatePrioProcess", S_P_UINT16},
158
189
        {"PropagateResourceLimitsExcept", S_P_STRING},
159
190
        {"PropagateResourceLimits", S_P_STRING},
 
191
        {"ResumeProgram", S_P_STRING},
 
192
        {"ResumeRate", S_P_UINT16},
160
193
        {"ReturnToService", S_P_UINT16},
161
 
        {"SchedulerAuth", S_P_STRING},
 
194
        {"SchedulerAuth", S_P_STRING, defunct_option},
 
195
        {"SchedulerParameters", S_P_STRING},
162
196
        {"SchedulerPort", S_P_UINT16},
163
197
        {"SchedulerRootFilter", S_P_UINT16},
 
198
        {"SchedulerTimeSlice", S_P_UINT16},
164
199
        {"SchedulerType", S_P_STRING},
165
200
        {"SelectType", S_P_STRING},
166
201
        {"SelectTypeParameters", S_P_STRING},
179
214
        {"SrunEpilog", S_P_STRING},
180
215
        {"SrunProlog", S_P_STRING},
181
216
        {"StateSaveLocation", S_P_STRING},
 
217
        {"SuspendExcNodes", S_P_STRING},
 
218
        {"SuspendExcParts", S_P_STRING},
 
219
        {"SuspendProgram", S_P_STRING},
 
220
        {"SuspendRate", S_P_UINT16},
 
221
        {"SuspendTime", S_P_LONG},
182
222
        {"SwitchType", S_P_STRING},
183
223
        {"TaskEpilog", S_P_STRING},
184
224
        {"TaskProlog", S_P_STRING},
214
254
        s_p_hashtbl_t *tbl, *dflt;
215
255
        slurm_conf_node_t *n;
216
256
        static s_p_options_t _nodename_options[] = {
217
 
                {"NodeHostname", S_P_STRING},
218
 
                {"NodeAddr", S_P_STRING},
219
257
                {"CoresPerSocket", S_P_UINT16},
220
258
                {"Feature", S_P_STRING},
 
259
                {"NodeAddr", S_P_STRING},
 
260
                {"NodeHostname", S_P_STRING},
221
261
                {"Port", S_P_UINT16},
222
262
                {"Procs", S_P_UINT16},
223
263
                {"RealMemory", S_P_UINT32},
280
320
 
281
321
                if (!s_p_get_uint16(&n->port, "Port", tbl)
282
322
                    && !s_p_get_uint16(&n->port, "Port", dflt)) {
283
 
                        /* This gets resolved in slurm_conf_get_port()
284
 
                         * and slurm_conf_get_addr(). For now just
 
323
                        /* This gets resolved in slurm_conf_get_port() 
 
324
                         * and slurm_conf_get_addr(). For now just 
285
325
                         * leave with a value of zero */
286
326
                        n->port = 0;
287
327
                }
400
440
        static s_p_options_t _partition_options[] = {
401
441
                {"AllowGroups", S_P_STRING},
402
442
                {"Default", S_P_BOOLEAN}, /* YES or NO */
 
443
                {"DisableRootJobs", S_P_BOOLEAN}, /* YES or NO */
403
444
                {"Hidden", S_P_BOOLEAN}, /* YES or NO */
404
 
                {"MaxTime", S_P_UINT32}, /* INFINITE or a number */
 
445
                {"MaxTime", S_P_STRING},
405
446
                {"MaxNodes", S_P_UINT32}, /* INFINITE or a number */
406
447
                {"MinNodes", S_P_UINT32},
407
448
                {"Nodes", S_P_STRING},
 
449
                {"Priority", S_P_UINT16},
408
450
                {"RootOnly", S_P_BOOLEAN}, /* YES or NO */
409
451
                {"Shared", S_P_STRING}, /* YES, NO, or FORCE */
410
452
                {"State", S_P_BOOLEAN}, /* UP or DOWN */
439
481
                    && !s_p_get_boolean(&p->default_flag, "Default", dflt))
440
482
                        p->default_flag = false;
441
483
 
 
484
                if (!s_p_get_boolean((bool *)&p->disable_root_jobs,
 
485
                                     "DisableRootJobs", tbl))
 
486
                        p->disable_root_jobs = (uint16_t)NO_VAL;
 
487
 
442
488
                if (!s_p_get_boolean(&p->hidden_flag, "Hidden", tbl)
443
489
                    && !s_p_get_boolean(&p->hidden_flag, "Hidden", dflt))
444
490
                        p->hidden_flag = false;
445
491
 
446
 
                if (!s_p_get_uint32(&p->max_time, "MaxTime", tbl)
447
 
                    && !s_p_get_uint32(&p->max_time, "MaxTime", dflt))
 
492
                if (!s_p_get_string(&tmp, "MaxTime", tbl) &&
 
493
                    !s_p_get_string(&tmp, "MaxTime", dflt))
448
494
                        p->max_time = INFINITE;
 
495
                else {
 
496
                        int max_time = time_str2mins(tmp);
 
497
                        if ((max_time < 0) && (max_time != INFINITE)) {
 
498
                                error("Bad value \"%s\" for MaxTime", tmp);
 
499
                                destroy_partitionname(p);
 
500
                                s_p_hashtbl_destroy(tbl);
 
501
                                xfree(tmp);
 
502
                                return -1;
 
503
                        }
 
504
                        p->max_time = max_time;
 
505
                        xfree(tmp);
 
506
                }
449
507
 
450
508
                if (!s_p_get_uint32(&p->max_nodes, "MaxNodes", tbl)
451
509
                    && !s_p_get_uint32(&p->max_nodes, "MaxNodes", dflt))
470
528
                    && !s_p_get_boolean(&p->root_only_flag, "RootOnly", dflt))
471
529
                        p->root_only_flag = false;
472
530
 
473
 
                if (!s_p_get_string(&tmp, "Shared", tbl)
474
 
                    && !s_p_get_string(&tmp, "Shared", dflt)) {
475
 
                        p->shared = SHARED_NO;
476
 
                } else {
 
531
                if (!s_p_get_uint16(&p->priority, "Priority", tbl) &&
 
532
                    !s_p_get_uint16(&p->priority, "Priority", dflt))
 
533
                        p->priority = 1;
 
534
 
 
535
                if (s_p_get_string(&tmp, "Shared", tbl) ||
 
536
                    s_p_get_string(&tmp, "Shared", dflt)) {
477
537
                        if (strcasecmp(tmp, "NO") == 0)
478
 
                                p->shared = SHARED_NO;
 
538
                                p->max_share = 1;
479
539
#ifndef HAVE_XCPU
480
540
                        /* Only "Shared=NO" is valid on XCPU systems */
481
 
                        else if (strcasecmp(tmp, "YES") == 0)
482
 
                                p->shared = SHARED_YES;
483
541
                        else if (strcasecmp(tmp, "EXCLUSIVE") == 0)
484
 
                                p->shared = SHARED_EXCLUSIVE;
485
 
                        else if (strcasecmp(tmp, "FORCE") == 0)
486
 
                                p->shared = SHARED_FORCE;
 
542
                                p->max_share = 0;
 
543
                        else if (strncasecmp(tmp, "YES:", 4) == 0)
 
544
                                p->max_share = strtol(&tmp[4], (char **) NULL, 10);
 
545
                        else if (strcasecmp(tmp, "YES") == 0) 
 
546
                                p->max_share = 4;
 
547
                        else if (strncasecmp(tmp, "FORCE:", 6) == 0) {
 
548
                                p->max_share = strtol(&tmp[6], (char **) NULL, 10) |
 
549
                                        SHARED_FORCE;
 
550
                        } else if (strcasecmp(tmp, "FORCE") == 0)
 
551
                                p->max_share = 4 | SHARED_FORCE;
487
552
#endif
488
553
                        else {
489
554
                                error("Bad value \"%s\" for Shared", tmp);
492
557
                                xfree(tmp);
493
558
                                return -1;
494
559
                        }
495
 
                }
 
560
                } else
 
561
                        p->max_share = 1;
 
562
 
496
563
                xfree(tmp);
497
564
 
498
565
                if (!s_p_get_boolean(&p->state_up_flag, "State", tbl)
875
942
        p = node_to_host_hashtbl[idx];
876
943
        while (p) {
877
944
                if (strcmp(p->alias, node_name) == 0) {
878
 
                        uint16_t port = p->port;
879
 
                        if (!port)
 
945
                        uint16_t port;
 
946
                        if (!p->port)
880
947
                                p->port = (uint16_t) conf_ptr->slurmd_port;
881
948
                        port = p->port;
882
949
                        slurm_conf_unlock();
998
1065
extern void
999
1066
free_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr, bool purge_node_hash)
1000
1067
{
 
1068
        xfree (ctl_conf_ptr->accounting_storage_host);
 
1069
        xfree (ctl_conf_ptr->accounting_storage_loc);
 
1070
        xfree (ctl_conf_ptr->accounting_storage_pass);
 
1071
        xfree (ctl_conf_ptr->accounting_storage_type);
 
1072
        xfree (ctl_conf_ptr->accounting_storage_user);
1001
1073
        xfree (ctl_conf_ptr->authtype);
1002
 
        xfree (ctl_conf_ptr->checkpoint_type);
1003
1074
        xfree (ctl_conf_ptr->backup_addr);
1004
1075
        xfree (ctl_conf_ptr->backup_controller);
 
1076
        xfree (ctl_conf_ptr->checkpoint_type);
 
1077
        xfree (ctl_conf_ptr->cluster_name);
1005
1078
        xfree (ctl_conf_ptr->control_addr);
1006
1079
        xfree (ctl_conf_ptr->control_machine);
 
1080
        xfree (ctl_conf_ptr->crypto_type);
1007
1081
        xfree (ctl_conf_ptr->epilog);
1008
 
        xfree (ctl_conf_ptr->job_acct_logfile);
1009
 
        xfree (ctl_conf_ptr->job_acct_type);
 
1082
        xfree (ctl_conf_ptr->health_check_program);
 
1083
        xfree (ctl_conf_ptr->job_acct_gather_type);
 
1084
        xfree (ctl_conf_ptr->job_comp_host);
1010
1085
        xfree (ctl_conf_ptr->job_comp_loc);
 
1086
        xfree (ctl_conf_ptr->job_comp_pass);
1011
1087
        xfree (ctl_conf_ptr->job_comp_type);
 
1088
        xfree (ctl_conf_ptr->job_comp_user);
1012
1089
        xfree (ctl_conf_ptr->job_credential_private_key);
1013
1090
        xfree (ctl_conf_ptr->job_credential_public_certificate);
 
1091
        xfree (ctl_conf_ptr->licenses);
1014
1092
        xfree (ctl_conf_ptr->mail_prog);
1015
1093
        xfree (ctl_conf_ptr->mpi_default);
 
1094
        xfree (ctl_conf_ptr->node_prefix);
1016
1095
        xfree (ctl_conf_ptr->plugindir);
1017
1096
        xfree (ctl_conf_ptr->plugstack);
1018
1097
        xfree (ctl_conf_ptr->proctrack_type);
1019
1098
        xfree (ctl_conf_ptr->prolog);
1020
1099
        xfree (ctl_conf_ptr->propagate_rlimits_except);
1021
1100
        xfree (ctl_conf_ptr->propagate_rlimits);
 
1101
        xfree (ctl_conf_ptr->resume_program);
 
1102
        xfree (ctl_conf_ptr->slurm_conf);
1022
1103
        xfree (ctl_conf_ptr->schedtype);
1023
1104
        xfree (ctl_conf_ptr->select_type);
1024
 
        xfree (ctl_conf_ptr->slurm_conf);
1025
1105
        xfree (ctl_conf_ptr->slurm_user_name);
1026
1106
        xfree (ctl_conf_ptr->slurmctld_logfile);
1027
1107
        xfree (ctl_conf_ptr->slurmctld_pidfile);
1028
1108
        xfree (ctl_conf_ptr->slurmd_logfile);
1029
1109
        xfree (ctl_conf_ptr->slurmd_pidfile);
1030
1110
        xfree (ctl_conf_ptr->slurmd_spooldir);
 
1111
        xfree (ctl_conf_ptr->srun_epilog);
 
1112
        xfree (ctl_conf_ptr->srun_prolog);
1031
1113
        xfree (ctl_conf_ptr->state_save_location);
 
1114
        xfree (ctl_conf_ptr->suspend_exc_nodes);
 
1115
        xfree (ctl_conf_ptr->suspend_exc_parts);
 
1116
        xfree (ctl_conf_ptr->suspend_program);
1032
1117
        xfree (ctl_conf_ptr->switch_type);
1033
 
        xfree (ctl_conf_ptr->tmp_fs);
1034
1118
        xfree (ctl_conf_ptr->task_epilog);
 
1119
        xfree (ctl_conf_ptr->task_plugin);
1035
1120
        xfree (ctl_conf_ptr->task_prolog);
1036
 
        xfree (ctl_conf_ptr->task_plugin);
1037
1121
        xfree (ctl_conf_ptr->tmp_fs);
1038
 
        xfree (ctl_conf_ptr->srun_prolog);
1039
 
        xfree (ctl_conf_ptr->srun_epilog);
1040
 
        xfree (ctl_conf_ptr->node_prefix);
1041
1122
        xfree (ctl_conf_ptr->unkillable_program);
1042
1123
 
1043
1124
        if (purge_node_hash)
1054
1135
init_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr)
1055
1136
{
1056
1137
        ctl_conf_ptr->last_update               = time(NULL);
1057
 
        xfree (ctl_conf_ptr->authtype);
1058
1138
        ctl_conf_ptr->cache_groups              = (uint16_t) NO_VAL;
1059
 
        xfree (ctl_conf_ptr->checkpoint_type);
 
1139
        xfree (ctl_conf_ptr->accounting_storage_host);
 
1140
        xfree (ctl_conf_ptr->accounting_storage_loc);
 
1141
        xfree (ctl_conf_ptr->accounting_storage_pass);
 
1142
        ctl_conf_ptr->accounting_storage_port             = 0;
 
1143
        xfree (ctl_conf_ptr->accounting_storage_type);
 
1144
        xfree (ctl_conf_ptr->accounting_storage_user);
 
1145
        xfree (ctl_conf_ptr->authtype);
1060
1146
        xfree (ctl_conf_ptr->backup_addr);
1061
1147
        xfree (ctl_conf_ptr->backup_controller);
 
1148
        ctl_conf_ptr->cache_groups              = 0;
 
1149
        xfree (ctl_conf_ptr->checkpoint_type);
 
1150
        xfree (ctl_conf_ptr->cluster_name);
1062
1151
        xfree (ctl_conf_ptr->control_addr);
1063
1152
        xfree (ctl_conf_ptr->control_machine);
 
1153
        xfree (ctl_conf_ptr->crypto_type);
 
1154
        ctl_conf_ptr->def_mem_per_task          = 0;
1064
1155
        ctl_conf_ptr->disable_root_jobs         = 0;
1065
1156
        xfree (ctl_conf_ptr->epilog);
 
1157
        ctl_conf_ptr->epilog_msg_time           = (uint32_t) NO_VAL;
1066
1158
        ctl_conf_ptr->fast_schedule             = (uint16_t) NO_VAL;
1067
1159
        ctl_conf_ptr->first_job_id              = (uint32_t) NO_VAL;
 
1160
        ctl_conf_ptr->get_env_timeout           = 0;
 
1161
        ctl_conf_ptr->health_check_interval     = 0;
 
1162
        xfree(ctl_conf_ptr->health_check_program);
1068
1163
        ctl_conf_ptr->inactive_limit            = (uint16_t) NO_VAL;
1069
 
        xfree (ctl_conf_ptr->job_acct_logfile);
1070
 
        ctl_conf_ptr->job_acct_freq             = 0;
1071
 
        xfree (ctl_conf_ptr->job_acct_type);
 
1164
        xfree (ctl_conf_ptr->job_acct_gather_type);
 
1165
        ctl_conf_ptr->job_acct_gather_freq             = 0;
1072
1166
        xfree (ctl_conf_ptr->job_comp_loc);
 
1167
        xfree (ctl_conf_ptr->job_comp_pass);
 
1168
        ctl_conf_ptr->job_comp_port             = 0;
1073
1169
        xfree (ctl_conf_ptr->job_comp_type);
 
1170
        xfree (ctl_conf_ptr->job_comp_user);
1074
1171
        xfree (ctl_conf_ptr->job_credential_private_key);
1075
1172
        xfree (ctl_conf_ptr->job_credential_public_certificate);
1076
1173
        ctl_conf_ptr->job_file_append           = (uint16_t) NO_VAL;
 
1174
        ctl_conf_ptr->job_requeue               = (uint16_t) NO_VAL;
1077
1175
        ctl_conf_ptr->kill_wait                 = (uint16_t) NO_VAL;
 
1176
        xfree (ctl_conf_ptr->licenses);
1078
1177
        xfree (ctl_conf_ptr->mail_prog);
1079
1178
        ctl_conf_ptr->max_job_cnt               = (uint16_t) NO_VAL;
 
1179
        ctl_conf_ptr->max_mem_per_task          = 0;
1080
1180
        ctl_conf_ptr->min_job_age               = (uint16_t) NO_VAL;
1081
1181
        xfree (ctl_conf_ptr->mpi_default);
1082
1182
        ctl_conf_ptr->msg_timeout               = (uint16_t) NO_VAL;
1083
1183
        ctl_conf_ptr->next_job_id               = (uint32_t) NO_VAL;
 
1184
        xfree (ctl_conf_ptr->node_prefix);
1084
1185
        xfree (ctl_conf_ptr->plugindir);
1085
1186
        xfree (ctl_conf_ptr->plugstack);
 
1187
        ctl_conf_ptr->private_data              = 0;
1086
1188
        xfree (ctl_conf_ptr->proctrack_type);
1087
1189
        xfree (ctl_conf_ptr->prolog);
1088
1190
        ctl_conf_ptr->propagate_prio_process    = (uint16_t) NO_VAL;
 
1191
        xfree (ctl_conf_ptr->propagate_rlimits);
1089
1192
        xfree (ctl_conf_ptr->propagate_rlimits_except);
1090
 
        xfree (ctl_conf_ptr->propagate_rlimits);
 
1193
        xfree (ctl_conf_ptr->resume_program);
 
1194
        ctl_conf_ptr->resume_rate               = (uint16_t) NO_VAL;
1091
1195
        ctl_conf_ptr->ret2service               = (uint16_t) NO_VAL;
 
1196
        xfree( ctl_conf_ptr->sched_params );
 
1197
        ctl_conf_ptr->sched_time_slice          = (uint16_t) NO_VAL;
 
1198
        xfree( ctl_conf_ptr->schedtype );
1092
1199
        ctl_conf_ptr->schedport                 = (uint16_t) NO_VAL;
1093
1200
        ctl_conf_ptr->schedrootfltr             = (uint16_t) NO_VAL;
1094
 
        xfree( ctl_conf_ptr->schedtype );
1095
1201
        xfree( ctl_conf_ptr->select_type );
1096
1202
        ctl_conf_ptr->select_type_param         = (uint16_t) NO_VAL;
1097
1203
        ctl_conf_ptr->slurm_user_id             = (uint16_t) NO_VAL; 
1107
1213
        ctl_conf_ptr->slurmd_port               = (uint32_t) NO_VAL;
1108
1214
        xfree (ctl_conf_ptr->slurmd_spooldir);
1109
1215
        ctl_conf_ptr->slurmd_timeout            = (uint16_t) NO_VAL;
 
1216
        xfree (ctl_conf_ptr->srun_prolog);
 
1217
        xfree (ctl_conf_ptr->srun_epilog);
1110
1218
        xfree (ctl_conf_ptr->state_save_location);
 
1219
        xfree (ctl_conf_ptr->suspend_exc_nodes);
 
1220
        xfree (ctl_conf_ptr->suspend_exc_parts);
 
1221
        xfree (ctl_conf_ptr->suspend_program);
 
1222
        ctl_conf_ptr->suspend_rate              = (uint16_t) NO_VAL;
 
1223
        ctl_conf_ptr->suspend_time              = (uint16_t) NO_VAL;
1111
1224
        xfree (ctl_conf_ptr->switch_type);
1112
1225
        xfree (ctl_conf_ptr->task_epilog);
 
1226
        xfree (ctl_conf_ptr->task_plugin);
 
1227
        ctl_conf_ptr->task_plugin_param         = 0;
1113
1228
        xfree (ctl_conf_ptr->task_prolog);
1114
 
        xfree (ctl_conf_ptr->task_plugin);
1115
1229
        xfree (ctl_conf_ptr->tmp_fs);
1116
 
        ctl_conf_ptr->wait_time                 = (uint16_t) NO_VAL;
1117
 
        xfree (ctl_conf_ptr->srun_prolog);
1118
 
        xfree (ctl_conf_ptr->srun_epilog);
1119
 
        xfree (ctl_conf_ptr->node_prefix);
1120
1230
        ctl_conf_ptr->tree_width                = (uint16_t) NO_VAL;
 
1231
        xfree (ctl_conf_ptr->unkillable_program);
 
1232
        ctl_conf_ptr->unkillable_timeout        = (uint16_t) NO_VAL;
1121
1233
        ctl_conf_ptr->use_pam                   = 0;
1122
 
        xfree (ctl_conf_ptr->unkillable_program);
1123
 
        ctl_conf_ptr->unkillable_timeout        = (uint16_t) NO_VAL;
 
1234
        ctl_conf_ptr->wait_time                 = (uint16_t) NO_VAL;
1124
1235
 
1125
1236
        _free_name_hashtbl();
1126
1237
        _init_name_hashtbl();
1339
1450
validate_and_set_defaults(slurm_ctl_conf_t *conf, s_p_hashtbl_t *hashtbl)
1340
1451
{
1341
1452
        char *temp_str = NULL;
 
1453
        long long_suspend_time;
1342
1454
        bool truth;
1343
 
 
 
1455
        char *default_storage_type = NULL, *default_storage_host = NULL;
 
1456
        char *default_storage_user = NULL, *default_storage_pass = NULL;
 
1457
        char *default_storage_loc = NULL;
 
1458
        uint32_t default_storage_port = 0;
 
1459
                
1344
1460
        if (s_p_get_string(&conf->backup_controller, "BackupController",
1345
1461
                           hashtbl)
1346
1462
            && strcasecmp("localhost", conf->backup_controller) == 0) {
1359
1475
                        conf->backup_addr = xstrdup(conf->backup_controller);
1360
1476
        }
1361
1477
 
 
1478
        s_p_get_string(&conf->cluster_name, "ClusterName", hashtbl);
 
1479
 
1362
1480
        if (!s_p_get_string(&conf->control_machine, "ControlMachine", hashtbl))
1363
1481
                fatal ("validate_and_set_defaults: "
1364
1482
                       "ControlMachine not specified.");
1380
1498
                xfree(conf->backup_controller);
1381
1499
        }
1382
1500
 
 
1501
        s_p_get_string(&default_storage_type, "DefaultStorageType", hashtbl);
 
1502
        s_p_get_string(&default_storage_host, "DefaultStorageHost", hashtbl);
 
1503
        s_p_get_string(&default_storage_user, "DefaultStorageUser", hashtbl);
 
1504
        s_p_get_string(&default_storage_pass, "DefaultStoragePass", hashtbl);
 
1505
        s_p_get_string(&default_storage_loc, "DefaultStorageLoc", hashtbl);
 
1506
        s_p_get_uint32(&default_storage_port, "DefaultStoragePort", hashtbl);
 
1507
 
1383
1508
        if (!s_p_get_string(&conf->job_credential_private_key,
1384
1509
                            "JobCredentialPrivateKey", hashtbl))
1385
1510
                fatal("JobCredentialPrivateKey not set");
1400
1525
        if (!s_p_get_string(&conf->checkpoint_type, "CheckpointType", hashtbl))
1401
1526
                conf->checkpoint_type = xstrdup(DEFAULT_CHECKPOINT_TYPE);
1402
1527
 
1403
 
        if (!s_p_get_uint16(&conf->disable_root_jobs, "DisableRootJobs", 
1404
 
                            hashtbl))
 
1528
        if (!s_p_get_string(&conf->crypto_type, "CryptoType", hashtbl))
 
1529
                 conf->crypto_type = xstrdup(DEFAULT_CRYPTO_TYPE);
 
1530
 
 
1531
        if (!s_p_get_uint32(&conf->def_mem_per_task, "DefMemPerTask", hashtbl))
 
1532
                conf->def_mem_per_task = DEFAULT_MEM_PER_TASK;
 
1533
 
 
1534
        if (!s_p_get_boolean((bool *) &conf->disable_root_jobs, 
 
1535
                             "DisableRootJobs", hashtbl))
1405
1536
                conf->disable_root_jobs = DEFAULT_DISABLE_ROOT_JOBS;
1406
1537
 
1407
1538
        s_p_get_string(&conf->epilog, "Epilog", hashtbl);
1408
1539
 
 
1540
        if (!s_p_get_uint32(&conf->epilog_msg_time, "EpilogMsgTime", hashtbl))
 
1541
                conf->epilog_msg_time = DEFAULT_EPILOG_MSG_TIME;
 
1542
 
1409
1543
        if (!s_p_get_uint16(&conf->fast_schedule, "FastSchedule", hashtbl))
1410
1544
                conf->fast_schedule = DEFAULT_FAST_SCHEDULE;
1411
1545
 
1428
1562
                conf->inactive_limit = DEFAULT_INACTIVE_LIMIT;
1429
1563
        }
1430
1564
 
1431
 
        if (!s_p_get_string(&conf->job_acct_logfile, 
1432
 
                            "JobAcctLogFile", hashtbl))
1433
 
                conf->job_acct_logfile = xstrdup(DEFAULT_JOB_ACCT_LOGFILE);
1434
 
 
1435
 
        if (!s_p_get_uint16(&conf->job_acct_freq, "JobAcctFrequency", hashtbl))
1436
 
                conf->job_acct_freq = DEFAULT_JOB_ACCT_FREQ;
1437
 
 
1438
 
        if (!s_p_get_string(&conf->job_acct_type, "JobAcctType", hashtbl))
1439
 
                conf->job_acct_type = xstrdup(DEFAULT_JOB_ACCT_TYPE);
1440
 
 
1441
 
        s_p_get_string(&conf->job_comp_loc, "JobCompLoc", hashtbl);
1442
 
 
1443
 
        if (!s_p_get_string(&conf->job_comp_type, "JobCompType", hashtbl))
1444
 
                conf->job_comp_type = xstrdup(DEFAULT_JOB_COMP_TYPE);
1445
 
 
 
1565
        if (!s_p_get_uint16(&conf->job_acct_gather_freq,
 
1566
                            "JobAcctGatherFrequency", hashtbl))
 
1567
                conf->job_acct_gather_freq = DEFAULT_JOB_ACCT_GATHER_FREQ;
 
1568
 
 
1569
        if (s_p_get_string(&conf->job_acct_gather_type,
 
1570
                            "JobAcctType", hashtbl)) {
 
1571
                fatal("JobAcctType is no longer a valid parameter.\n"
 
1572
                      "The job accounting plugin has changed to 2 different "
 
1573
                      "plugins one for gathering and one for storing the "
 
1574
                      "gathered information.\n"
 
1575
                      "Please change this to JobAcctGatherType to "
 
1576
                      "correctly work.\n"
 
1577
                      "The major 'jobacct' is now 'jobacct_gather' and "
 
1578
                      "'jobacct_storage' your declarations will also need "
 
1579
                      "to change in your slurm.conf file.\n"
 
1580
                      "Refer to the slurm.conf man page or the web "
 
1581
                      "documentation for further explanation.");
 
1582
        }
 
1583
        
 
1584
        if(!s_p_get_string(&conf->job_acct_gather_type,
 
1585
                           "JobAcctGatherType", hashtbl))
 
1586
                conf->job_acct_gather_type =
 
1587
                        xstrdup(DEFAULT_JOB_ACCT_GATHER_TYPE);
 
1588
 
 
1589
        if (!s_p_get_string(&conf->job_comp_type, "JobCompType", hashtbl)) {
 
1590
                if(default_storage_type)
 
1591
                        conf->job_comp_type =
 
1592
                                xstrdup_printf("jobcomp/%s",
 
1593
                                               default_storage_type);
 
1594
                else
 
1595
                        conf->job_comp_type = xstrdup(DEFAULT_JOB_COMP_TYPE);
 
1596
        }
 
1597
        if (!s_p_get_string(&conf->job_comp_loc, "JobCompLoc", hashtbl)) {
 
1598
                if(default_storage_loc)
 
1599
                        conf->job_comp_loc = xstrdup(default_storage_loc);
 
1600
                else
 
1601
                        conf->job_comp_loc = xstrdup(DEFAULT_JOB_COMP_LOC);
 
1602
        }
 
1603
 
 
1604
        if (!s_p_get_string(&conf->job_comp_host, "JobCompHost",
 
1605
                            hashtbl)) {
 
1606
                if(default_storage_host)
 
1607
                        conf->job_comp_host =
 
1608
                                xstrdup(default_storage_host);
 
1609
                else
 
1610
                        conf->job_comp_host = xstrdup(DEFAULT_STORAGE_HOST);
 
1611
        }
 
1612
        if (!s_p_get_string(&conf->job_comp_user, "JobCompUser",
 
1613
                            hashtbl)) {
 
1614
                if(default_storage_user)
 
1615
                        conf->job_comp_user =
 
1616
                                xstrdup(default_storage_user);
 
1617
                else
 
1618
                        conf->job_comp_user = xstrdup(DEFAULT_STORAGE_USER);
 
1619
        }
 
1620
        if (!s_p_get_string(&conf->job_comp_pass, "JobCompPass",
 
1621
                            hashtbl)) {
 
1622
                if(default_storage_pass)
 
1623
                        conf->job_comp_pass =
 
1624
                                xstrdup(default_storage_pass);
 
1625
        }
 
1626
        if (!s_p_get_uint32(&conf->job_comp_port, "JobCompPort",
 
1627
                            hashtbl)) {
 
1628
                if(default_storage_port)
 
1629
                        conf->job_comp_port = default_storage_port;
 
1630
                else
 
1631
                        conf->job_comp_port = DEFAULT_STORAGE_PORT;
 
1632
        }
1446
1633
        if (!s_p_get_uint16(&conf->job_file_append, "JobFileAppend", hashtbl))
1447
1634
                conf->job_file_append = 0;
1448
1635
 
 
1636
        if (!s_p_get_uint16(&conf->job_requeue, "JobRequeue", hashtbl))
 
1637
                conf->job_requeue = 1;
 
1638
        else if (conf->job_requeue > 1)
 
1639
                conf->job_requeue = 1;
 
1640
 
1449
1641
        if (!s_p_get_uint16(&conf->get_env_timeout, "GetEnvTimeout", hashtbl))
1450
1642
                conf->get_env_timeout = DEFAULT_GET_ENV_TIMEOUT;
1451
1643
 
 
1644
        s_p_get_uint16(&conf->health_check_interval, "HealthCheckInterval", hashtbl);
 
1645
        s_p_get_string(&conf->health_check_program, "HealthCheckProgram", hashtbl);
 
1646
 
1452
1647
        if (!s_p_get_uint16(&conf->kill_wait, "KillWait", hashtbl))
1453
1648
                conf->kill_wait = DEFAULT_KILL_WAIT;
1454
1649
 
 
1650
        s_p_get_string(&conf->licenses, "Licenses", hashtbl);
 
1651
 
1455
1652
        if (!s_p_get_string(&conf->mail_prog, "MailProg", hashtbl))
1456
1653
                conf->mail_prog = xstrdup(DEFAULT_MAIL_PROG);
1457
1654
 
1458
1655
        if (!s_p_get_uint16(&conf->max_job_cnt, "MaxJobCount", hashtbl))
1459
1656
                conf->max_job_cnt = DEFAULT_MAX_JOB_COUNT;
1460
1657
 
 
1658
        if (!s_p_get_uint32(&conf->max_mem_per_task, "MaxMemPerTask", hashtbl))
 
1659
                conf->max_mem_per_task = DEFAULT_MAX_MEM_PER_TASK;
 
1660
 
1461
1661
        if (!s_p_get_uint16(&conf->msg_timeout, "MessageTimeout", hashtbl))
1462
1662
                conf->msg_timeout = DEFAULT_MSG_TIMEOUT;
1463
 
        else if (conf->msg_timeout > 100)
1464
 
                info("WARNING: MessageTimeout is too high for effective fault-tolerance");
 
1663
        else if (conf->msg_timeout > 100) {
 
1664
                info("WARNING: MessageTimeout is too high for effective "
 
1665
                        "fault-tolerance");
 
1666
        }
1465
1667
 
1466
1668
        if (!s_p_get_uint16(&conf->min_job_age, "MinJobAge", hashtbl))
1467
1669
                conf->min_job_age = DEFAULT_MIN_JOB_AGE;
1469
1671
        if (!s_p_get_string(&conf->mpi_default, "MpiDefault", hashtbl))
1470
1672
                conf->mpi_default = xstrdup(DEFAULT_MPI_DEFAULT);
1471
1673
 
 
1674
        if (!s_p_get_string(&conf->accounting_storage_type,
 
1675
                            "AccountingStorageType", hashtbl)) {
 
1676
                if(default_storage_type)
 
1677
                        conf->accounting_storage_type =
 
1678
                                xstrdup_printf("accounting_storage/%s",
 
1679
                                               default_storage_type);
 
1680
                else    
 
1681
                        conf->accounting_storage_type =
 
1682
                                xstrdup(DEFAULT_ACCOUNTING_STORAGE_TYPE);
 
1683
        }
 
1684
 
 
1685
        if (!s_p_get_uint16(&conf->accounting_storage_enforce, 
 
1686
                            "AccountingStorageEnforce", hashtbl))
 
1687
                conf->accounting_storage_enforce = DEFAULT_ACCOUNTING_ENFORCE;
 
1688
 
 
1689
        if (!s_p_get_string(&conf->accounting_storage_host,
 
1690
                            "AccountingStorageHost", hashtbl)) {
 
1691
                if(default_storage_host)
 
1692
                        conf->accounting_storage_host =
 
1693
                                xstrdup(default_storage_host);
 
1694
                else
 
1695
                        conf->accounting_storage_host =
 
1696
                                xstrdup(DEFAULT_STORAGE_HOST);
 
1697
        }
 
1698
 
 
1699
        /* AccountingStorageLoc replaces JobAcctLogFile since it now represents
 
1700
         * the database name also depending on the storage type you
 
1701
         * use so we still check JobAcctLogFile for the same thing
 
1702
         */
 
1703
        if (!s_p_get_string(&conf->accounting_storage_loc,
 
1704
                            "AccountingStorageLoc", hashtbl)
 
1705
                && !s_p_get_string(&conf->accounting_storage_loc,
 
1706
                               "JobAcctLogFile", hashtbl)) {
 
1707
                if(default_storage_loc)
 
1708
                        conf->accounting_storage_loc =
 
1709
                                xstrdup(default_storage_loc);
 
1710
                else
 
1711
                        conf->accounting_storage_loc =
 
1712
                                xstrdup(DEFAULT_STORAGE_LOC);
 
1713
        }
 
1714
 
 
1715
        if (!s_p_get_string(&conf->accounting_storage_user,
 
1716
                            "AccountingStorageUser", hashtbl)) {
 
1717
                if(default_storage_user)
 
1718
                        conf->accounting_storage_user =
 
1719
                                xstrdup(default_storage_user);
 
1720
                else
 
1721
                        conf->accounting_storage_user =
 
1722
                                xstrdup(DEFAULT_STORAGE_USER);
 
1723
        }
 
1724
        if (!s_p_get_string(&conf->accounting_storage_pass,
 
1725
                            "AccountingStoragePass", hashtbl)) {
 
1726
                if(default_storage_pass)
 
1727
                        conf->accounting_storage_pass =
 
1728
                                xstrdup(default_storage_pass);
 
1729
        }
 
1730
        if (!s_p_get_uint32(&conf->accounting_storage_port,
 
1731
                            "AccountingStoragePort", hashtbl)) {
 
1732
                if(default_storage_port)
 
1733
                        conf->accounting_storage_port = default_storage_port;
 
1734
                else
 
1735
                        conf->accounting_storage_port = DEFAULT_STORAGE_PORT;
 
1736
        }
1472
1737
        if (!s_p_get_string(&conf->plugindir, "PluginDir", hashtbl))
1473
1738
                conf->plugindir = xstrdup(default_plugin_path);
1474
1739
 
1489
1754
            && (!strcmp(conf->proctrack_type,"proctrack/linuxproc")))
1490
1755
                fatal("proctrack/linuxproc is incompatable with switch/elan");
1491
1756
 
 
1757
        s_p_get_uint16(&conf->private_data, "PrivateData", hashtbl);
 
1758
 
1492
1759
        s_p_get_string(&conf->prolog, "Prolog", hashtbl);
1493
1760
 
1494
1761
        if (!s_p_get_uint16(&conf->propagate_prio_process,
1518
1785
        if (!s_p_get_uint16(&conf->ret2service, "ReturnToService", hashtbl))
1519
1786
                conf->ret2service = DEFAULT_RETURN_TO_SERVICE;
1520
1787
 
 
1788
        s_p_get_string(&conf->resume_program, "ResumeProgram", hashtbl);
 
1789
        if (!s_p_get_uint16(&conf->resume_rate, "ResumeRate", hashtbl))
 
1790
                conf->resume_rate = DEFAULT_RESUME_RATE;
 
1791
 
 
1792
        s_p_get_string(&conf->sched_params, "SchedulerParameters", hashtbl);
 
1793
 
1521
1794
        if (s_p_get_uint16(&conf->schedport, "SchedulerPort", hashtbl)) {
1522
1795
                if (conf->schedport == 0) {
1523
1796
                        error("SchedulerPort=0 is invalid");
1531
1804
                            "SchedulerRootFilter", hashtbl))
1532
1805
                conf->schedrootfltr = DEFAULT_SCHEDROOTFILTER;
1533
1806
 
 
1807
        if (!s_p_get_uint16(&conf->sched_time_slice, "SchedulerTimeSlice",
 
1808
            hashtbl))
 
1809
                conf->sched_time_slice = DEFAULT_SCHED_TIME_SLICE;
 
1810
 
1534
1811
        if (!s_p_get_string(&conf->schedtype, "SchedulerType", hashtbl))
1535
1812
                conf->schedtype = xstrdup(DEFAULT_SCHEDTYPE);
1536
1813
 
1565
1842
                               conf->slurm_user_name);
1566
1843
                        xfree(conf->slurm_user_name);
1567
1844
                } else {
1568
 
                        if (slurm_passwd->pw_uid > 0xffff)
1569
 
                                error("SlurmUser numeric overflow, "
1570
 
                                      "will be fixed soon");
1571
 
                        else
1572
 
                                conf->slurm_user_id = slurm_passwd->pw_uid;
 
1845
                        conf->slurm_user_id = slurm_passwd->pw_uid;
1573
1846
                }
1574
1847
        }
1575
1848
 
1617
1890
                            "StateSaveLocation", hashtbl))
1618
1891
                conf->state_save_location = xstrdup(DEFAULT_SAVE_STATE_LOC);
1619
1892
 
 
1893
        s_p_get_string(&conf->suspend_exc_nodes, "SuspendExcNodes", hashtbl);
 
1894
        s_p_get_string(&conf->suspend_exc_parts, "SuspendExcParts", hashtbl);
 
1895
        s_p_get_string(&conf->suspend_program, "SuspendProgram", hashtbl);
 
1896
        if (!s_p_get_uint16(&conf->suspend_rate, "SuspendRate", hashtbl))
 
1897
                conf->suspend_rate = DEFAULT_SUSPEND_RATE;
 
1898
        if (s_p_get_long(&long_suspend_time, "SuspendTime", hashtbl))
 
1899
                conf->suspend_time = long_suspend_time + 1;
 
1900
        else
 
1901
                conf->suspend_time = 0;
 
1902
 
1620
1903
        /* see above for switch_type, order dependent */
1621
1904
 
1622
1905
        if (!s_p_get_string(&conf->task_plugin, "TaskPlugin", hashtbl))
1663
1946
        if (!s_p_get_uint16(&conf->unkillable_timeout,
1664
1947
                            "UnkillableStepTimeout", hashtbl))
1665
1948
                conf->unkillable_timeout = DEFAULT_UNKILLABLE_TIMEOUT;
 
1949
        xfree(default_storage_type);
 
1950
        xfree(default_storage_loc);
 
1951
        xfree(default_storage_host);
 
1952
        xfree(default_storage_user);
 
1953
        xfree(default_storage_pass);
1666
1954
}
1667
1955
 
1668
1956
/*