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
* CODE-OCEC-09-009. All rights reserved.
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.
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);
71
static void _free_all_reservations(reserve_info_msg_t *msg);
72
static void _slurm_free_reserve_info_members (reserve_info_t * part);
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);
118
extern void slurm_destroy_uint32_ptr(void *object)
120
uint32_t *tmp = (uint32_t *)object;
114
124
/* returns number of objects added to list */
115
125
extern int slurm_addto_char_list(List char_list, char *names)
149
159
if(!strcasecmp(tmp_char, 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
168
list_delete_item(itr);
173
list_append(char_list, name);
159
175
list_iterator_reset(itr);
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
202
list_delete_item(itr);
207
list_append(char_list, name);
187
209
list_iterator_destroy(itr);
288
select_g_free_jobinfo(&msg->select_jobinfo);
289
311
xfree(msg->alloc_node);
312
for (i = 0; i < msg->argc; i++)
315
xfree(msg->blrtsimage);
316
xfree(msg->ckpt_dir);
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);
324
xfree(msg->exc_nodes);
293
325
xfree(msg->features);
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);
297
335
xfree(msg->partition);
336
xfree(msg->ramdiskimage);
298
337
xfree(msg->req_nodes);
299
xfree(msg->exc_nodes);
301
for (i = 0; i < msg->argc; i++)
307
xfree(msg->work_dir);
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);
341
select_g_free_jobinfo(&msg->select_jobinfo);
343
xfree(msg->work_dir);
360
390
void slurm_free_job_info_members(job_info_t * job)
364
xfree(job->partition);
365
393
xfree(job->account);
367
394
xfree(job->alloc_node);
368
xfree(job->node_inx);
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);
406
xfree(job->node_inx);
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);
379
xfree(job->dependency);
412
select_g_free_jobinfo(&job->select_jobinfo);
413
xfree(job->state_desc);
380
415
xfree(job->work_dir);
382
xfree(job->licenses);
464
void slurm_free_resv_desc_msg(resv_desc_msg_t * msg)
467
xfree(msg->accounts);
468
xfree(msg->features);
469
xfree(msg->partition);
471
xfree(msg->node_list);
477
void slurm_free_resv_name_msg(reservation_name_msg_t * msg)
485
void slurm_free_resv_info_request_msg(resv_info_request_msg_t * msg)
430
490
void slurm_free_job_step_create_request_msg(job_step_create_request_msg_t *
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");
864
accounting_enforce_string(uint16_t enforce, char *str, int str_len)
869
error("enforce: output buffer too small");
873
if (enforce & ACCOUNTING_ENFORCE_ASSOCS)
874
strcat(str, "associations"); //12 len
875
if (enforce & ACCOUNTING_ENFORCE_LIMITS) {
878
strcat(str, "limits"); //7 len
880
if (enforce & ACCOUNTING_ENFORCE_WCKEYS) {
883
strcat(str, "wckeys"); //7 len
784
891
char *job_state_string(enum job_states inx)
786
893
if (inx & JOB_COMPLETING)
945
extern char *reservation_flags_string(uint16_t flags)
947
char *flag_str = xstrdup("");
949
if (flags & RESERVE_FLAG_MAINT)
950
xstrcat(flag_str, "MAINT");
951
if (flags & RESERVE_FLAG_NO_MAINT) {
953
xstrcat(flag_str, ",");
954
xstrcat(flag_str, "NO_MAINT");
956
if (flags & RESERVE_FLAG_IGN_JOBS) {
958
xstrcat(flag_str, ",");
959
xstrcat(flag_str, "IGNORE_JOBS");
961
if (flags & RESERVE_FLAG_DAILY) {
963
xstrcat(flag_str, ",");
964
xstrcat(flag_str, "DAILY");
966
if (flags & RESERVE_FLAG_NO_DAILY) {
968
xstrcat(flag_str, ",");
969
xstrcat(flag_str, "NO_DAILY");
971
if (flags & RESERVE_FLAG_WEEKLY) {
973
xstrcat(flag_str, ",");
974
xstrcat(flag_str, "WEEKLY");
976
if (flags & RESERVE_FLAG_NO_WEEKLY) {
978
xstrcat(flag_str, ",");
979
xstrcat(flag_str, "NO_WEEKLY");
981
if (flags & RESERVE_FLAG_SPEC_NODES) {
983
xstrcat(flag_str, ",");
984
xstrcat(flag_str, "SPEC_NODES");
838
989
char *node_state_string(enum node_states inx)
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);
846
inx = (uint16_t) (inx & NODE_STATE_BASE);
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";
870
if (inx == NODE_STATE_DOWN) {
1026
if (inx == NODE_STATE_POWER_SAVE)
1027
return "POWER_DOWN";
1028
if (inx == NODE_STATE_POWER_UP)
1030
if (base == NODE_STATE_DOWN) {
871
1031
if (no_resp_flag)
875
if (inx == NODE_STATE_ALLOCATED) {
1035
if (base == NODE_STATE_ALLOCATED) {
876
1036
if (no_resp_flag)
877
1037
return "ALLOCATED*";
884
1044
return "COMPLETING*";
885
1045
return "COMPLETING";
887
if (inx == NODE_STATE_IDLE) {
1047
if (base == NODE_STATE_IDLE) {
888
1048
if (no_resp_flag)
894
if (inx == NODE_STATE_UNKNOWN) {
1054
if (base == NODE_STATE_FUTURE) {
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);
910
1078
inx = (uint16_t) (inx & NODE_STATE_BASE);
912
1085
if (drain_flag) {
913
1086
if (comp_flag || (inx == NODE_STATE_ALLOCATED)) {
914
1087
if (no_resp_flag)
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);
1261
1454
static void _slurm_free_partition_info_members(partition_info_t * 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);
1466
* slurm_free_reserve_info_msg - free the reservation information
1468
* IN msg - pointer to reservation information response message
1469
* NOTE: buffer is loaded by slurm_load_reservation
1471
void slurm_free_reservation_info_msg(reserve_info_msg_t * msg)
1474
if (msg->reservation_array) {
1475
_free_all_reservations(msg);
1476
xfree(msg->reservation_array);
1482
static void _free_all_reservations(reserve_info_msg_t *msg)
1486
if ((msg == NULL) ||
1487
(msg->reservation_array == NULL))
1490
for (i = 0; i < msg->record_count; i++)
1491
_slurm_free_reserve_info_members(
1492
&msg->reservation_array[i]);
1496
static void _slurm_free_reserve_info_members(reserve_info_t * resv)
1499
xfree(resv->accounts);
1500
xfree(resv->features);
1502
xfree(resv->node_inx);
1503
xfree(resv->node_list);
1504
xfree(resv->partition);
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.
1515
extern void slurm_free_topo_info_msg(topo_info_response_msg_t *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);
1271
1530
extern void slurm_free_file_bcast_msg(file_bcast_msg_t *msg)
1577
void inline slurm_destroy_association_shares_object(void *object)
1579
association_shares_object_t *obj_ptr =
1580
(association_shares_object_t *)object;
1583
xfree(obj_ptr->cluster);
1584
xfree(obj_ptr->name);
1585
xfree(obj_ptr->parent);
1590
void inline slurm_free_shares_request_msg(shares_request_msg_t *msg)
1594
list_destroy(msg->acct_list);
1596
list_destroy(msg->user_list);
1601
void inline slurm_free_shares_response_msg(shares_response_msg_t *msg)
1604
if(msg->assoc_shares_list)
1605
list_destroy(msg->assoc_shares_list);
1610
void inline slurm_destroy_priority_factors_object(void *object)
1612
priority_factors_object_t *obj_ptr =
1613
(priority_factors_object_t *)object;
1617
void inline slurm_free_priority_factors_request_msg(
1618
priority_factors_request_msg_t *msg)
1621
if(msg->job_id_list)
1622
list_destroy(msg->job_id_list);
1624
list_destroy(msg->uid_list);
1629
void inline slurm_free_priority_factors_response_msg(
1630
priority_factors_response_msg_t *msg)
1633
if(msg->priority_factors_list)
1634
list_destroy(msg->priority_factors_list);
1319
1640
void inline slurm_free_accounting_update_msg(accounting_update_msg_t *msg)
1377
1698
case REQUEST_UPDATE_NODE:
1378
1699
slurm_free_update_node_msg(data);
1701
case REQUEST_CREATE_PARTITION:
1380
1702
case REQUEST_UPDATE_PARTITION:
1381
1703
slurm_free_update_part_msg(data);
1383
1705
case REQUEST_DELETE_PARTITION:
1384
1706
slurm_free_delete_part_msg(data);
1708
case REQUEST_CREATE_RESERVATION:
1709
case REQUEST_UPDATE_RESERVATION:
1710
slurm_free_resv_desc_msg(data);
1712
case REQUEST_DELETE_RESERVATION:
1713
case RESPONSE_CREATE_RESERVATION:
1714
slurm_free_resv_name_msg(data);
1716
case REQUEST_RESERVATION_INFO:
1717
slurm_free_resv_info_request_msg(data);
1386
1719
case REQUEST_NODE_REGISTRATION_STATUS:
1387
1720
slurm_free_node_registration_status_msg(data);
1403
1736
case REQUEST_JOB_INFO_SINGLE:
1404
1737
slurm_free_job_id_msg(data);
1739
case REQUEST_SHARE_INFO:
1740
slurm_free_shares_request_msg(data);
1742
case RESPONSE_SHARE_INFO:
1743
slurm_free_shares_response_msg(data);
1745
case REQUEST_PRIORITY_FACTORS:
1746
slurm_free_priority_factors_request_msg(data);
1748
case RESPONSE_PRIORITY_FACTORS:
1749
slurm_free_priority_factors_response_msg(data);
1406
1751
case REQUEST_NODE_SELECT_INFO:
1407
1752
slurm_free_node_select_msg(data);
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 */
1473
1820
case ACCOUNTING_UPDATE_MSG:
1474
1821
slurm_free_accounting_update_msg(data);
1823
case RESPONSE_TOPO_INFO:
1824
slurm_free_topo_info_msg(data);
1477
1827
error("invalid type trying to be freed %u", type);