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

« back to all changes in this revision

Viewing changes to src/common/slurm_protocol_defs.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:
4
4
 *      the slurm daemons directly, not for user client use.
5
5
 *****************************************************************************
6
6
 *  Copyright (C) 2002-2007 The Regents of the University of California.
7
 
 *  Copyright (C) 2008 Lawrence Livermore National Security.
 
7
 *  Copyright (C) 2008-2009 Lawrence Livermore National Security.
8
8
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
9
9
 *  Written by Kevin Tew <tew1@llnl.gov> et. al.
10
 
 *  LLNL-CODE-402394.
 
10
 *  CODE-OCEC-09-009. All rights reserved.
11
11
 *  
12
12
 *  This file is part of SLURM, a resource management program.
13
 
 *  For details, see <http://www.llnl.gov/linux/slurm/>.
 
13
 *  For details, see <https://computing.llnl.gov/linux/slurm/>.
 
14
 *  Please also read the included file: DISCLAIMER.
14
15
 *  
15
16
 *  SLURM is free software; you can redistribute it and/or modify it under
16
17
 *  the terms of the GNU General Public License as published by the Free
67
68
static void _free_all_partitions (partition_info_msg_t *msg);
68
69
static void _slurm_free_partition_info_members (partition_info_t * part);
69
70
 
 
71
static void  _free_all_reservations(reserve_info_msg_t *msg);
 
72
static void _slurm_free_reserve_info_members (reserve_info_t * part);
 
73
 
70
74
static void _free_all_step_info (job_step_info_response_msg_t *msg);
71
75
static void _slurm_free_job_step_info_members (job_step_info_t * msg);
72
76
static void _make_lower(char *change);
111
115
        xfree(tmp);
112
116
}
113
117
 
 
118
extern void slurm_destroy_uint32_ptr(void *object)
 
119
{
 
120
        uint32_t *tmp = (uint32_t *)object;
 
121
        xfree(tmp);
 
122
}
 
123
 
114
124
/* returns number of objects added to list */
115
125
extern int slurm_addto_char_list(List char_list, char *names)
116
126
{
149
159
                                        if(!strcasecmp(tmp_char, name))
150
160
                                                break;
151
161
                                }
152
 
                                
153
 
                                if(!tmp_char) {
154
 
                                        _make_lower(name);
155
 
                                        list_append(char_list, name);
 
162
                                /* If we get a duplicate remove the
 
163
                                   first one and tack this on the end.
 
164
                                   This is needed for get associations
 
165
                                   with qos.
 
166
                                */
 
167
                                if(tmp_char) 
 
168
                                        list_delete_item(itr);
 
169
                                else 
156
170
                                        count++;
157
 
                                } else 
158
 
                                        xfree(name);
 
171
                                
 
172
                                _make_lower(name);
 
173
                                list_append(char_list, name);
 
174
                                
159
175
                                list_iterator_reset(itr);
160
176
                                
161
177
                                i++;
177
193
                                break;
178
194
                }
179
195
                
180
 
                if(!tmp_char) {
181
 
                        _make_lower(name);
182
 
                        list_append(char_list, name);
 
196
                /* If we get a duplicate remove the
 
197
                   first one and tack this on the end.
 
198
                   This is needed for get associations
 
199
                   with qos.
 
200
                */
 
201
                if(tmp_char) 
 
202
                        list_delete_item(itr);
 
203
                else 
183
204
                        count++;
184
 
                } else 
185
 
                        xfree(name);
 
205
                
 
206
                _make_lower(name);
 
207
                list_append(char_list, name);
186
208
        }       
187
209
        list_iterator_destroy(itr);
188
210
        return count;
285
307
        int i;
286
308
 
287
309
        if (msg) {
288
 
                select_g_free_jobinfo(&msg->select_jobinfo);
 
310
                xfree(msg->account);
289
311
                xfree(msg->alloc_node);
 
312
                for (i = 0; i < msg->argc; i++)
 
313
                        xfree(msg->argv[i]);
 
314
                xfree(msg->argv);
 
315
                xfree(msg->blrtsimage);
 
316
                xfree(msg->ckpt_dir);
 
317
                xfree(msg->comment);
 
318
                xfree(msg->cpu_bind);
 
319
                xfree(msg->dependency);
290
320
                for (i = 0; i < msg->env_size; i++)
291
321
                        xfree(msg->environment[i]);
292
322
                xfree(msg->environment);
 
323
                xfree(msg->err);
 
324
                xfree(msg->exc_nodes);
293
325
                xfree(msg->features);
 
326
                xfree(msg->in);
294
327
                xfree(msg->licenses);
 
328
                xfree(msg->linuximage);
295
329
                xfree(msg->mail_user);
 
330
                xfree(msg->mem_bind);
 
331
                xfree(msg->mloaderimage);
296
332
                xfree(msg->name);
 
333
                xfree(msg->network);
 
334
                xfree(msg->out);
297
335
                xfree(msg->partition);
 
336
                xfree(msg->ramdiskimage);
298
337
                xfree(msg->req_nodes);
299
 
                xfree(msg->exc_nodes);
300
 
                xfree(msg->script);
301
 
                for (i = 0; i < msg->argc; i++)
302
 
                        xfree(msg->argv[i]);
303
 
                xfree(msg->argv);
304
 
                xfree(msg->err);
305
 
                xfree(msg->in);
306
 
                xfree(msg->out);
307
 
                xfree(msg->work_dir);
308
 
                xfree(msg->account);
309
 
                xfree(msg->network);
310
 
                xfree(msg->comment);
311
 
                xfree(msg->dependency);
 
338
                xfree(msg->reservation);
312
339
                xfree(msg->resp_host);
313
 
                xfree(msg->blrtsimage);
314
 
                xfree(msg->linuximage);
315
 
                xfree(msg->mloaderimage);
316
 
                xfree(msg->ramdiskimage);
 
340
                xfree(msg->script);
 
341
                select_g_free_jobinfo(&msg->select_jobinfo);
 
342
                xfree(msg->wckey);
 
343
                xfree(msg->work_dir);
317
344
                xfree(msg);
318
345
        }
319
346
}
324
351
 
325
352
        if (msg) {
326
353
                xfree(msg->nodes);
 
354
                xfree(msg->cpu_bind);
327
355
                xfree(msg->cpus_per_node);
328
356
                xfree(msg->cpu_count_reps);
329
357
                xfree(msg->script);
331
359
                xfree(msg->in);
332
360
                xfree(msg->out);
333
361
                xfree(msg->work_dir);
 
362
                xfree(msg->ckpt_dir);
 
363
                xfree(msg->restart_dir);
334
364
 
335
365
                for (i = 0; i < msg->argc; i++)
336
366
                        xfree(msg->argv[i]);
360
390
void slurm_free_job_info_members(job_info_t * job)
361
391
{
362
392
        if (job) {
363
 
                xfree(job->nodes);
364
 
                xfree(job->partition);
365
393
                xfree(job->account);
366
 
                xfree(job->name);
367
394
                xfree(job->alloc_node);
368
 
                xfree(job->node_inx);
 
395
                xfree(job->command);
 
396
                xfree(job->comment);
 
397
                xfree(job->cpu_count_reps);
369
398
                xfree(job->cpus_per_node);
370
 
                xfree(job->cpu_count_reps);
371
 
                select_g_free_jobinfo(&job->select_jobinfo);
 
399
                xfree(job->dependency);
 
400
                xfree(job->exc_nodes);
 
401
                xfree(job->exc_node_inx);
372
402
                xfree(job->features);
 
403
                xfree(job->licenses);
 
404
                xfree(job->name);
 
405
                xfree(job->network);
 
406
                xfree(job->node_inx);
 
407
                xfree(job->nodes);
 
408
                xfree(job->partition);
 
409
                xfree(job->resv_name);
373
410
                xfree(job->req_nodes);
374
411
                xfree(job->req_node_inx);
375
 
                xfree(job->exc_nodes);
376
 
                xfree(job->exc_node_inx);
377
 
                xfree(job->network);
378
 
                xfree(job->comment);
379
 
                xfree(job->dependency);
 
412
                select_g_free_jobinfo(&job->select_jobinfo);
 
413
                xfree(job->state_desc);
 
414
                xfree(job->wckey);
380
415
                xfree(job->work_dir);
381
 
                xfree(job->command);
382
 
                xfree(job->licenses);
383
416
        }
384
417
}
385
418
 
402
435
void slurm_free_update_node_msg(update_node_msg_t * msg)
403
436
{
404
437
        if (msg) {
 
438
                xfree(msg->features);
405
439
                xfree(msg->node_names);
406
 
                xfree(msg->features);
407
440
                xfree(msg->reason);
408
441
                xfree(msg);
409
442
        }
412
445
void slurm_free_update_part_msg(update_part_msg_t * msg)
413
446
{
414
447
        if (msg) {
415
 
                xfree(msg->name);
416
 
                xfree(msg->nodes);
 
448
                xfree(msg->allow_alloc_nodes);
417
449
                xfree(msg->allow_groups);
 
450
                xfree(msg->name);
 
451
                xfree(msg->nodes);
418
452
                xfree(msg);
419
453
        }
420
454
}
427
461
        }
428
462
}
429
463
 
 
464
void slurm_free_resv_desc_msg(resv_desc_msg_t * msg)
 
465
{
 
466
        if (msg) {
 
467
                xfree(msg->accounts);
 
468
                xfree(msg->features);
 
469
                xfree(msg->partition);
 
470
                xfree(msg->name);
 
471
                xfree(msg->node_list);
 
472
                xfree(msg->users);
 
473
                xfree(msg);
 
474
        }
 
475
}
 
476
 
 
477
void slurm_free_resv_name_msg(reservation_name_msg_t * msg)
 
478
{
 
479
        if (msg) {
 
480
                xfree(msg->name);
 
481
                xfree(msg);
 
482
        }
 
483
}
 
484
 
 
485
void slurm_free_resv_info_request_msg(resv_info_request_msg_t * msg)
 
486
{
 
487
        xfree(msg);
 
488
}
 
489
 
430
490
void slurm_free_job_step_create_request_msg(job_step_create_request_msg_t *
431
491
                                            msg)
432
492
{
435
495
                xfree(msg->name);
436
496
                xfree(msg->network);
437
497
                xfree(msg->node_list);
438
 
                xfree(msg->ckpt_path);
 
498
                xfree(msg->ckpt_dir);
439
499
                xfree(msg);
440
500
        }
441
501
}
443
503
void slurm_free_complete_job_allocation_msg(
444
504
        complete_job_allocation_msg_t * msg)
445
505
{
446
 
        if (msg) {
447
 
                xfree(msg);
448
 
        }
 
506
        xfree(msg);
449
507
}
450
508
 
451
509
void slurm_free_complete_batch_script_msg(complete_batch_script_msg_t * msg)
536
594
        xfree(msg->task_epilog);
537
595
        xfree(msg->complete_nodelist);
538
596
 
539
 
        xfree(msg->ckpt_path);
 
597
        xfree(msg->ckpt_dir);
 
598
        xfree(msg->restart_dir);
540
599
 
541
600
        if (msg->switch_job)
542
601
                switch_free_jobinfo(msg->switch_job);
585
644
 
586
645
void slurm_free_checkpoint_tasks_msg(checkpoint_tasks_msg_t * msg)
587
646
{
588
 
        xfree(msg);
 
647
        if (msg) {
 
648
                xfree(msg->image_dir);
 
649
                xfree(msg);
 
650
        }
589
651
}
590
652
 
591
653
void slurm_free_epilog_complete_msg(epilog_complete_msg_t * msg)
627
689
        }
628
690
}
629
691
 
 
692
void inline slurm_free_srun_step_missing_msg(srun_step_missing_msg_t * msg)
 
693
{
 
694
        if (msg) {
 
695
                xfree(msg->nodelist);
 
696
                xfree(msg);
 
697
        }
 
698
}
 
699
 
630
700
void inline slurm_free_srun_timeout_msg(srun_timeout_msg_t * msg)
631
701
{
632
702
        xfree(msg);
642
712
 
643
713
void inline slurm_free_checkpoint_msg(checkpoint_msg_t *msg)
644
714
{
645
 
        xfree(msg);
 
715
        if (msg) {
 
716
                xfree(msg->image_dir);
 
717
                xfree(msg);
 
718
        }
646
719
}
647
720
 
648
721
void inline slurm_free_checkpoint_comp_msg(checkpoint_comp_msg_t *msg)
697
770
                        return "BeginTime";
698
771
                case WAIT_LICENSES:
699
772
                        return "Licenses";
700
 
                case WAIT_ASSOC_LIMIT:
701
 
                        return "AssociationLimit";
 
773
                case WAIT_ASSOC_JOB_LIMIT:
 
774
                        return "AssociationJobLimit";
 
775
                case WAIT_ASSOC_RESOURCE_LIMIT:
 
776
                        return "AssociationResourceLimit";
 
777
                case WAIT_ASSOC_TIME_LIMIT:
 
778
                        return "AssociationTimeLimit";
 
779
                case WAIT_RESERVATION:
 
780
                        return "Reservation";
702
781
                case FAIL_DOWN_PARTITION:
703
782
                        return "PartitionDown";
704
783
                case FAIL_DOWN_NODE:
781
860
                strcat(str, "none");
782
861
}
783
862
 
 
863
extern void
 
864
accounting_enforce_string(uint16_t enforce, char *str, int str_len)
 
865
{
 
866
        if (str_len > 0)
 
867
                str[0] = '\0';
 
868
        if (str_len < 26) {
 
869
                error("enforce: output buffer too small");
 
870
                return;
 
871
        }
 
872
 
 
873
        if (enforce & ACCOUNTING_ENFORCE_ASSOCS)
 
874
                strcat(str, "associations"); //12 len
 
875
        if (enforce & ACCOUNTING_ENFORCE_LIMITS) {
 
876
                if (str[0])
 
877
                        strcat(str, ",");
 
878
                strcat(str, "limits"); //7 len
 
879
        }
 
880
        if (enforce & ACCOUNTING_ENFORCE_WCKEYS) {
 
881
                if (str[0])
 
882
                        strcat(str, ",");
 
883
                strcat(str, "wckeys"); //7 len
 
884
        }
 
885
        // total len 26
 
886
 
 
887
        if (str[0] == '\0')
 
888
                strcat(str, "none");
 
889
}
 
890
 
784
891
char *job_state_string(enum job_states inx)
785
892
{
786
893
        if (inx & JOB_COMPLETING)
835
942
        }
836
943
}
837
944
 
 
945
extern char *reservation_flags_string(uint16_t flags)
 
946
{
 
947
        char *flag_str = xstrdup("");
 
948
 
 
949
        if (flags & RESERVE_FLAG_MAINT)
 
950
                xstrcat(flag_str, "MAINT");
 
951
        if (flags & RESERVE_FLAG_NO_MAINT) {
 
952
                if (flag_str[0])
 
953
                        xstrcat(flag_str, ",");
 
954
                xstrcat(flag_str, "NO_MAINT");
 
955
        }
 
956
        if (flags & RESERVE_FLAG_IGN_JOBS) {
 
957
                if (flag_str[0])
 
958
                        xstrcat(flag_str, ",");
 
959
                xstrcat(flag_str, "IGNORE_JOBS");
 
960
        }
 
961
        if (flags & RESERVE_FLAG_DAILY) {
 
962
                if (flag_str[0])
 
963
                        xstrcat(flag_str, ",");
 
964
                xstrcat(flag_str, "DAILY");
 
965
        }
 
966
        if (flags & RESERVE_FLAG_NO_DAILY) {
 
967
                if (flag_str[0])
 
968
                        xstrcat(flag_str, ",");
 
969
                xstrcat(flag_str, "NO_DAILY");
 
970
        }
 
971
        if (flags & RESERVE_FLAG_WEEKLY) {
 
972
                if (flag_str[0])
 
973
                        xstrcat(flag_str, ",");
 
974
                xstrcat(flag_str, "WEEKLY");
 
975
        }
 
976
        if (flags & RESERVE_FLAG_NO_WEEKLY) {
 
977
                if (flag_str[0])
 
978
                        xstrcat(flag_str, ",");
 
979
                xstrcat(flag_str, "NO_WEEKLY");
 
980
        }
 
981
        if (flags & RESERVE_FLAG_SPEC_NODES) {
 
982
                if (flag_str[0])
 
983
                        xstrcat(flag_str, ",");
 
984
                xstrcat(flag_str, "SPEC_NODES");
 
985
        }
 
986
        return flag_str;
 
987
}
 
988
 
838
989
char *node_state_string(enum node_states inx)
839
990
{
 
991
        int  base         = (inx & NODE_STATE_BASE);
840
992
        bool comp_flag    = (inx & NODE_STATE_COMPLETING);
841
993
        bool drain_flag   = (inx & NODE_STATE_DRAIN);
842
994
        bool fail_flag    = (inx & NODE_STATE_FAIL);
 
995
        bool maint_flag   = (inx & NODE_STATE_MAINT);
843
996
        bool no_resp_flag = (inx & NODE_STATE_NO_RESPOND);
844
997
        bool power_flag   = (inx & NODE_STATE_POWER_SAVE);
845
998
 
846
 
        inx = (uint16_t) (inx & NODE_STATE_BASE);
847
 
 
 
999
        if (maint_flag) {
 
1000
                if (no_resp_flag)
 
1001
                        return "MAINT*";
 
1002
                return "MAINT";
 
1003
        }
848
1004
        if (drain_flag) {
849
 
                if (comp_flag || (inx == NODE_STATE_ALLOCATED)) {
 
1005
                if (comp_flag || (base == NODE_STATE_ALLOCATED)) {
850
1006
                        if (no_resp_flag)
851
1007
                                return "DRAINING*";
852
1008
                        return "DRAINING";
857
1013
                }
858
1014
        }
859
1015
        if (fail_flag) {
860
 
                if (comp_flag || (inx == NODE_STATE_ALLOCATED)) {
 
1016
                if (comp_flag || (base == NODE_STATE_ALLOCATED)) {
861
1017
                        if (no_resp_flag)
862
1018
                                return "FAILING*";
863
1019
                        return "FAILING";
867
1023
                        return "FAIL";
868
1024
                }
869
1025
        }
870
 
        if (inx == NODE_STATE_DOWN) {
 
1026
        if (inx == NODE_STATE_POWER_SAVE)
 
1027
                return "POWER_DOWN";
 
1028
        if (inx == NODE_STATE_POWER_UP)
 
1029
                return "POWER_UP";
 
1030
        if (base == NODE_STATE_DOWN) {
871
1031
                if (no_resp_flag)
872
1032
                        return "DOWN*";
873
1033
                return "DOWN";
874
1034
        }
875
 
        if (inx == NODE_STATE_ALLOCATED) {
 
1035
        if (base == NODE_STATE_ALLOCATED) {
876
1036
                if (no_resp_flag)
877
1037
                        return "ALLOCATED*";
878
1038
                if (comp_flag)
884
1044
                        return "COMPLETING*";
885
1045
                return "COMPLETING";
886
1046
        }
887
 
        if (inx == NODE_STATE_IDLE) {
 
1047
        if (base == NODE_STATE_IDLE) {
888
1048
                if (no_resp_flag)
889
1049
                        return "IDLE*";
890
1050
                if (power_flag)
891
1051
                        return "IDLE~";
892
1052
                return "IDLE";
893
1053
        }
894
 
        if (inx == NODE_STATE_UNKNOWN) {
 
1054
        if (base == NODE_STATE_FUTURE) {
 
1055
                if (no_resp_flag)
 
1056
                        return "FUTURE*";
 
1057
                if (power_flag)
 
1058
                        return "FUTURE~";
 
1059
                return "FUTURE";
 
1060
        }
 
1061
        if (base == NODE_STATE_UNKNOWN) {
895
1062
                if (no_resp_flag)
896
1063
                        return "UNKNOWN*";
897
1064
                return "UNKNOWN";
904
1071
        bool comp_flag    = (inx & NODE_STATE_COMPLETING);
905
1072
        bool drain_flag   = (inx & NODE_STATE_DRAIN);
906
1073
        bool fail_flag    = (inx & NODE_STATE_FAIL);
 
1074
        bool maint_flag   = (inx & NODE_STATE_MAINT);
907
1075
        bool no_resp_flag = (inx & NODE_STATE_NO_RESPOND);
908
1076
        bool power_flag   = (inx & NODE_STATE_POWER_SAVE);
909
1077
 
910
1078
        inx = (uint16_t) (inx & NODE_STATE_BASE);
911
1079
 
 
1080
        if (maint_flag) {
 
1081
                if (no_resp_flag)
 
1082
                        return "MAINT*";
 
1083
                return "MAINT";
 
1084
        }
912
1085
        if (drain_flag) {
913
1086
                if (comp_flag || (inx == NODE_STATE_ALLOCATED)) {
914
1087
                        if (no_resp_flag)
955
1128
                        return "IDLE~";
956
1129
                return "IDLE";
957
1130
        }
 
1131
        if (inx == NODE_STATE_FUTURE) {
 
1132
                if (no_resp_flag)
 
1133
                        return "FUTR*";
 
1134
                if (power_flag)
 
1135
                        return "FUTR~";
 
1136
                return "FUTR";
 
1137
        }
958
1138
        if (inx == NODE_STATE_UNKNOWN) {
959
1139
                if (no_resp_flag)
960
1140
                        return "UNK*";
1010
1190
                job_step_create_response_msg_t * msg)
1011
1191
{
1012
1192
        if (msg) {
 
1193
                xfree(msg->resv_ports);
1013
1194
                slurm_step_layout_destroy(msg->step_layout);
1014
1195
                slurm_cred_destroy(msg->cred);
1015
1196
                if (msg->switch_job)
1056
1237
                xfree(config_ptr->control_machine);
1057
1238
                xfree(config_ptr->crypto_type);
1058
1239
                xfree(config_ptr->epilog);
 
1240
                xfree(config_ptr->epilog_slurmctld);
1059
1241
                xfree(config_ptr->health_check_program);
1060
1242
                xfree(config_ptr->job_acct_gather_type);
 
1243
                xfree(config_ptr->job_ckpt_dir);
1061
1244
                xfree(config_ptr->job_comp_host);
1062
1245
                xfree(config_ptr->job_comp_loc);
1063
1246
                xfree(config_ptr->job_comp_pass);
1068
1251
                xfree(config_ptr->licenses);
1069
1252
                xfree(config_ptr->mail_prog);
1070
1253
                xfree(config_ptr->mpi_default);
 
1254
                xfree(config_ptr->mpi_params);
1071
1255
                xfree(config_ptr->node_prefix);
1072
1256
                xfree(config_ptr->plugindir);
1073
1257
                xfree(config_ptr->plugstack);
1074
1258
                xfree(config_ptr->proctrack_type);
1075
1259
                xfree(config_ptr->prolog);
 
1260
                xfree(config_ptr->prolog_slurmctld);
1076
1261
                xfree(config_ptr->propagate_rlimits);
1077
1262
                xfree(config_ptr->propagate_rlimits_except);
1078
1263
                xfree(config_ptr->resume_program);
1080
1265
                xfree(config_ptr->sched_params);
1081
1266
                xfree(config_ptr->schedtype);
1082
1267
                xfree(config_ptr->select_type);
 
1268
                if(config_ptr->select_conf_key_pairs) 
 
1269
                        list_destroy((List)config_ptr->select_conf_key_pairs);
1083
1270
                xfree(config_ptr->slurm_conf);
1084
1271
                xfree(config_ptr->slurm_user_name);
1085
1272
                xfree(config_ptr->slurmctld_pidfile);
1098
1285
                xfree(config_ptr->task_plugin);
1099
1286
                xfree(config_ptr->task_prolog);
1100
1287
                xfree(config_ptr->tmp_fs);
 
1288
                xfree(config_ptr->topology_plugin);
1101
1289
                xfree(config_ptr->unkillable_program);
 
1290
                xfree(config_ptr->z_char);
1102
1291
                xfree(config_ptr);
1103
1292
        }
1104
1293
}
1181
1370
{
1182
1371
        if (msg != NULL) {
1183
1372
                xfree(msg->partition);
 
1373
                xfree(msg->resv_ports);
1184
1374
                xfree(msg->nodes);
1185
 
                xfree(msg->ckpt_path);
 
1375
                xfree(msg->name);
 
1376
                xfree(msg->network);
 
1377
                xfree(msg->node_inx);
 
1378
                xfree(msg->ckpt_dir);
1186
1379
        }
1187
1380
}
1188
1381
 
1261
1454
static void _slurm_free_partition_info_members(partition_info_t * part)
1262
1455
{
1263
1456
        if (part) {
 
1457
                xfree(part->allow_alloc_nodes);
 
1458
                xfree(part->allow_groups);
1264
1459
                xfree(part->name);
1265
 
                xfree(part->allow_groups);
1266
1460
                xfree(part->nodes);
1267
1461
                xfree(part->node_inx);
1268
1462
        }
1269
1463
}
1270
1464
 
 
1465
/*
 
1466
 * slurm_free_reserve_info_msg - free the reservation information 
 
1467
 *      response message
 
1468
 * IN msg - pointer to reservation information response message
 
1469
 * NOTE: buffer is loaded by slurm_load_reservation
 
1470
 */
 
1471
void slurm_free_reservation_info_msg(reserve_info_msg_t * msg)
 
1472
{
 
1473
        if (msg) {
 
1474
                if (msg->reservation_array) {
 
1475
                        _free_all_reservations(msg);
 
1476
                        xfree(msg->reservation_array);
 
1477
                }
 
1478
                xfree(msg);
 
1479
        }
 
1480
}
 
1481
 
 
1482
static void  _free_all_reservations(reserve_info_msg_t *msg)
 
1483
{
 
1484
        int i;
 
1485
 
 
1486
        if ((msg == NULL) ||
 
1487
            (msg->reservation_array == NULL))
 
1488
                return;
 
1489
 
 
1490
        for (i = 0; i < msg->record_count; i++)
 
1491
                _slurm_free_reserve_info_members(
 
1492
                        &msg->reservation_array[i]);
 
1493
 
 
1494
}
 
1495
 
 
1496
static void _slurm_free_reserve_info_members(reserve_info_t * resv)
 
1497
{
 
1498
        if (resv) {
 
1499
                xfree(resv->accounts);
 
1500
                xfree(resv->features);
 
1501
                xfree(resv->name);
 
1502
                xfree(resv->node_inx);
 
1503
                xfree(resv->node_list);
 
1504
                xfree(resv->partition);
 
1505
                xfree(resv->users);
 
1506
        }
 
1507
}
 
1508
 
 
1509
/*
 
1510
 * slurm_free_topo_info_msg - free the switch topology configuration 
 
1511
 *      information response message
 
1512
 * IN msg - pointer to switch topology configuration response message
 
1513
 * NOTE: buffer is loaded by slurm_load_topo.
 
1514
 */
 
1515
extern void slurm_free_topo_info_msg(topo_info_response_msg_t *msg)
 
1516
{
 
1517
        int i;
 
1518
 
 
1519
        if (msg) {
 
1520
                for (i = 0; i < msg->record_count; i++) {
 
1521
                        xfree(msg->topo_array[i].name);
 
1522
                        xfree(msg->topo_array[i].nodes);
 
1523
                        xfree(msg->topo_array[i].switches);
 
1524
                }
 
1525
                xfree(msg);
 
1526
        }
 
1527
}
 
1528
 
 
1529
 
1271
1530
extern void slurm_free_file_bcast_msg(file_bcast_msg_t *msg)
1272
1531
{
1273
1532
        if (msg) {
1315
1574
        xfree(msg);
1316
1575
}
1317
1576
 
 
1577
void inline slurm_destroy_association_shares_object(void *object) 
 
1578
{
 
1579
        association_shares_object_t *obj_ptr = 
 
1580
                (association_shares_object_t *)object;
 
1581
        
 
1582
        if(obj_ptr) {
 
1583
                xfree(obj_ptr->cluster);
 
1584
                xfree(obj_ptr->name);
 
1585
                xfree(obj_ptr->parent);
 
1586
                xfree(obj_ptr);
 
1587
        }
 
1588
}
 
1589
 
 
1590
void inline slurm_free_shares_request_msg(shares_request_msg_t *msg)
 
1591
{
 
1592
        if(msg) {
 
1593
                if(msg->acct_list)
 
1594
                        list_destroy(msg->acct_list);
 
1595
                if(msg->user_list)
 
1596
                        list_destroy(msg->user_list);
 
1597
                xfree(msg);
 
1598
        }
 
1599
}
 
1600
 
 
1601
void inline slurm_free_shares_response_msg(shares_response_msg_t *msg)
 
1602
{
 
1603
        if(msg) {
 
1604
                if(msg->assoc_shares_list)
 
1605
                        list_destroy(msg->assoc_shares_list);
 
1606
                xfree(msg);
 
1607
        }
 
1608
}
 
1609
 
 
1610
void inline slurm_destroy_priority_factors_object(void *object)
 
1611
{
 
1612
        priority_factors_object_t *obj_ptr =
 
1613
                (priority_factors_object_t *)object;
 
1614
        xfree(obj_ptr);
 
1615
}
 
1616
 
 
1617
void inline slurm_free_priority_factors_request_msg(
 
1618
        priority_factors_request_msg_t *msg)
 
1619
{
 
1620
        if(msg) {
 
1621
                if(msg->job_id_list)
 
1622
                        list_destroy(msg->job_id_list);
 
1623
                if(msg->uid_list)
 
1624
                        list_destroy(msg->uid_list);
 
1625
                xfree(msg);
 
1626
        }
 
1627
}
 
1628
 
 
1629
void inline slurm_free_priority_factors_response_msg(
 
1630
        priority_factors_response_msg_t *msg)
 
1631
{
 
1632
        if(msg) {
 
1633
                if(msg->priority_factors_list)
 
1634
                        list_destroy(msg->priority_factors_list);
 
1635
                xfree(msg);
 
1636
        }
 
1637
}
 
1638
 
1318
1639
 
1319
1640
void inline slurm_free_accounting_update_msg(accounting_update_msg_t *msg)
1320
1641
{
1377
1698
        case REQUEST_UPDATE_NODE:
1378
1699
                slurm_free_update_node_msg(data);
1379
1700
                break;
 
1701
        case REQUEST_CREATE_PARTITION:
1380
1702
        case REQUEST_UPDATE_PARTITION:
1381
1703
                slurm_free_update_part_msg(data);
1382
1704
                break;
1383
1705
        case REQUEST_DELETE_PARTITION:          
1384
1706
                slurm_free_delete_part_msg(data);
1385
1707
                break;
 
1708
        case REQUEST_CREATE_RESERVATION:
 
1709
        case REQUEST_UPDATE_RESERVATION:
 
1710
                slurm_free_resv_desc_msg(data);
 
1711
                break;
 
1712
        case REQUEST_DELETE_RESERVATION:
 
1713
        case RESPONSE_CREATE_RESERVATION:               
 
1714
                slurm_free_resv_name_msg(data);
 
1715
                break;
 
1716
        case REQUEST_RESERVATION_INFO:
 
1717
                slurm_free_resv_info_request_msg(data);
 
1718
                break;
1386
1719
        case REQUEST_NODE_REGISTRATION_STATUS:
1387
1720
                slurm_free_node_registration_status_msg(data);
1388
1721
                break;
1403
1736
        case REQUEST_JOB_INFO_SINGLE:
1404
1737
                slurm_free_job_id_msg(data);
1405
1738
                break;
 
1739
        case REQUEST_SHARE_INFO:
 
1740
                slurm_free_shares_request_msg(data);
 
1741
                break;
 
1742
        case RESPONSE_SHARE_INFO:
 
1743
                slurm_free_shares_response_msg(data);
 
1744
                break;
 
1745
        case REQUEST_PRIORITY_FACTORS:
 
1746
                slurm_free_priority_factors_request_msg(data);
 
1747
                break;
 
1748
        case RESPONSE_PRIORITY_FACTORS:
 
1749
                slurm_free_priority_factors_response_msg(data);
 
1750
                break;
1406
1751
        case REQUEST_NODE_SELECT_INFO:
1407
1752
                slurm_free_node_select_msg(data);
1408
1753
                break;
1463
1808
        case REQUEST_PING:              
1464
1809
        case REQUEST_RECONFIGURE:
1465
1810
        case REQUEST_CONTROL:
 
1811
        case REQUEST_TAKEOVER:
1466
1812
        case REQUEST_SHUTDOWN_IMMEDIATE:
1467
1813
        case RESPONSE_FORWARD_FAILED:
1468
1814
        case REQUEST_DAEMON_STATUS:
1469
1815
        case REQUEST_HEALTH_CHECK:
1470
1816
        case ACCOUNTING_FIRST_REG:
 
1817
        case REQUEST_TOPO_INFO:
1471
1818
                /* No body to free */
1472
1819
                break;
1473
1820
        case ACCOUNTING_UPDATE_MSG:
1474
1821
                slurm_free_accounting_update_msg(data);
1475
1822
                break;
 
1823
        case RESPONSE_TOPO_INFO:
 
1824
                slurm_free_topo_info_msg(data);
 
1825
                break;
1476
1826
        default:
1477
1827
                error("invalid type trying to be freed %u", type);
1478
1828
                break;