/
slurm_protocol_pack.c
13325 lines (11745 loc) · 418 KB
/
slurm_protocol_pack.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/****************************************************************************\
* slurm_protocol_pack.c - functions to pack and unpack structures for RPCs
*****************************************************************************
* Copyright (C) 2002-2007 The Regents of the University of California.
* Copyright (C) 2008-2010 Lawrence Livermore National Security.
* Portions Copyright (C) 2010-2015 SchedMD LLC <http://www.schedmd.com>.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Kevin Tew <tew1@llnl.gov>, et. al.
* CODE-OCEC-09-009. All rights reserved.
*
* This file is part of SLURM, a resource management program.
* For details, see <http://slurm.schedmd.com/>.
* Please also read the included file: DISCLAIMER.
*
* SLURM is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* In addition, as a special exception, the copyright holders give permission
* to link the code of portions of this program with the OpenSSL library under
* certain conditions as described in each individual source file, and
* distribute linked combinations including the two. You must obey the GNU
* General Public License in all respects for all of the code used other than
* OpenSSL. If you modify file(s) with this exception, you may extend this
* exception to your version of the file(s), but you are not obligated to do
* so. If you do not wish to do so, delete this exception statement from your
* version. If you delete this exception statement from all source files in
* the program, then also delete it here.
*
* SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along
* with SLURM; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\*****************************************************************************/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "src/api/slurm_pmi.h"
#include "src/common/bitstring.h"
#include "src/common/forward.h"
#include "src/common/job_options.h"
#include "src/common/log.h"
#include "src/common/node_select.h"
#include "src/common/pack.h"
#include "src/common/power.h"
#include "src/common/read_config.h"
#include "src/common/slurm_accounting_storage.h"
#include "src/common/slurm_acct_gather_energy.h"
#include "src/common/slurm_auth.h"
#include "src/common/slurm_cred.h"
#include "src/common/slurm_ext_sensors.h"
#include "src/common/slurm_jobacct_gather.h"
#include "src/common/slurm_protocol_api.h"
#include "src/common/slurm_protocol_defs.h"
#include "src/common/slurm_protocol_pack.h"
#include "src/common/slurmdbd_defs.h"
#include "src/common/switch.h"
#include "src/common/xmalloc.h"
#include "src/common/xstring.h"
#include "src/common/xassert.h"
#define _pack_job_info_msg(msg,buf) _pack_buffer_msg(msg,buf)
#define _pack_job_step_info_msg(msg,buf) _pack_buffer_msg(msg,buf)
#define _pack_block_info_resp_msg(msg,buf) _pack_buffer_msg(msg,buf)
#define _pack_burst_buffer_info_resp_msg(msg,buf) _pack_buffer_msg(msg,buf)
#define _pack_front_end_info_msg(msg,buf) _pack_buffer_msg(msg,buf)
#define _pack_node_info_msg(msg,buf) _pack_buffer_msg(msg,buf)
#define _pack_partition_info_msg(msg,buf) _pack_buffer_msg(msg,buf)
#define _pack_stats_response_msg(msg,buf) _pack_buffer_msg(msg,buf)
#define _pack_reserve_info_msg(msg,buf) _pack_buffer_msg(msg,buf)
#define _pack_sicp_info_msg(msg,buf) _pack_buffer_msg(msg,buf)
#define _pack_layout_info_msg(msg,buf) _pack_buffer_msg(msg,buf)
static void _pack_assoc_shares_object(void *in, Buf buffer,
uint16_t protocol_version);
static int _unpack_assoc_shares_object(void **object, Buf buffer,
uint16_t protocol_version);
static void _pack_shares_request_msg(shares_request_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_shares_request_msg(shares_request_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_shares_response_msg(shares_response_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_shares_response_msg(shares_response_msg_t ** msg,
Buf buffer,
uint16_t protocol_version);
static void _pack_priority_factors_object(void *in, Buf buffer,
uint16_t protocol_version);
static int _unpack_priority_factors_object(void **object, Buf buffer,
uint16_t protocol_version);
static void _pack_priority_factors_request_msg(
priority_factors_request_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_priority_factors_request_msg(
priority_factors_request_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_priority_factors_response_msg(
priority_factors_response_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_priority_factors_response_msg(
priority_factors_response_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_update_node_msg(update_node_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_update_node_msg(update_node_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_update_layout_msg(update_layout_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_update_layout_msg(update_layout_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void
_pack_node_registration_status_msg(slurm_node_registration_status_msg_t *
msg, Buf buffer,
uint16_t protocol_version);
static int
_unpack_node_registration_status_msg(slurm_node_registration_status_msg_t
** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_job_ready_msg(job_id_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_ready_msg(job_id_msg_t ** msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_job_user_msg(job_user_id_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_user_msg(job_user_id_msg_t ** msg_ptr, Buf buffer,
uint16_t protocol_version);
static void
_pack_resource_allocation_response_msg(resource_allocation_response_msg_t *
msg, Buf buffer,
uint16_t protocol_version);
static int
_unpack_resource_allocation_response_msg(resource_allocation_response_msg_t
** msg, Buf buffer,
uint16_t protocol_version);
static void
_pack_job_alloc_info_response_msg(job_alloc_info_response_msg_t * msg,
Buf buffer,
uint16_t protocol_version);
static int
_unpack_job_alloc_info_response_msg(job_alloc_info_response_msg_t ** msg,
Buf buffer,
uint16_t protocol_version);
static void _pack_submit_response_msg(submit_response_msg_t * msg,
Buf buffer,
uint16_t protocol_version);
static int _unpack_submit_response_msg(submit_response_msg_t ** msg,
Buf buffer,
uint16_t protocol_version);
static void _pack_node_info_request_msg(
node_info_request_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_node_info_request_msg(
node_info_request_msg_t ** msg, Buf bufer,
uint16_t protocol_version);
static void _pack_node_info_single_msg(node_info_single_msg_t * msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_node_info_single_msg(node_info_single_msg_t ** msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_node_info_msg(node_info_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_node_info_members(node_info_t * node, Buf buffer,
uint16_t protocol_version);
static void _pack_front_end_info_request_msg(
front_end_info_request_msg_t * msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_front_end_info_request_msg(
front_end_info_request_msg_t ** msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_front_end_info_msg(front_end_info_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_front_end_info_members(front_end_info_t *front_end,
Buf buffer,
uint16_t protocol_version);
static void _pack_update_front_end_msg(update_front_end_msg_t * msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_update_front_end_msg(update_front_end_msg_t ** msg,
Buf buffer, uint16_t protocol_version);
static void _pack_update_partition_msg(update_part_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_update_partition_msg(update_part_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_update_powercap_msg(update_powercap_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_update_powercap_msg(update_powercap_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_delete_partition_msg(delete_part_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_delete_partition_msg(delete_part_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_kill_job_msg(kill_job_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_kill_job_msg(kill_job_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_signal_job_msg(signal_job_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_signal_job_msg(signal_job_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_epilog_comp_msg(epilog_complete_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_epilog_comp_msg(epilog_complete_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_update_job_time_msg(job_time_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_update_job_time_msg(job_time_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_acct_gather_node_resp_msg(acct_gather_node_resp_msg_t * msg,
Buf buffer,
uint16_t protocol_version);
static int _unpack_acct_gather_node_resp_msg(acct_gather_node_resp_msg_t ** msg,
Buf buffer,
uint16_t protocol_version);
static void _pack_acct_gather_energy_req(acct_gather_energy_req_msg_t *msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_acct_gather_energy_req(acct_gather_energy_req_msg_t **msg,
Buf buffer,
uint16_t protocol_version);
static void _pack_part_info_request_msg(part_info_request_msg_t * msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_part_info_request_msg(part_info_request_msg_t ** msg,
Buf buffer, uint16_t protocol_version);
static void _pack_resv_info_request_msg(resv_info_request_msg_t * msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_resv_info_request_msg(resv_info_request_msg_t **msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_partition_info_msg(partition_info_msg_t ** msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_partition_info_members(partition_info_t * part,
Buf buffer,
uint16_t protocol_version);
static void _pack_layout_info_request_msg(layout_info_request_msg_t * msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_layout_info_request_msg(layout_info_request_msg_t ** msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_layout_info_msg(layout_info_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_reserve_info_msg(reserve_info_msg_t ** msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_reserve_info_members(reserve_info_t * resv,
Buf buffer, uint16_t protocol_version);
static void _pack_launch_tasks_request_msg(launch_tasks_request_msg_t *msg,
Buf buffer,
uint16_t protocol_version);
static int _unpack_launch_tasks_request_msg(
launch_tasks_request_msg_t **msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_task_user_managed_io_stream_msg(task_user_managed_io_msg_t *
msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_task_user_managed_io_stream_msg(task_user_managed_io_msg_t **
msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_cancel_tasks_msg(kill_tasks_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_cancel_tasks_msg(kill_tasks_msg_t ** msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_checkpoint_tasks_msg(checkpoint_tasks_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_checkpoint_tasks_msg(checkpoint_tasks_msg_t ** msg_ptr,
Buf buffer, uint16_t protocol_version);
static void _pack_launch_tasks_response_msg(launch_tasks_response_msg_t *msg,
Buf buffer,
uint16_t protocol_version);
static int _unpack_launch_tasks_response_msg(
launch_tasks_response_msg_t **msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_reboot_msg(reboot_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_reboot_msg(reboot_msg_t ** msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_shutdown_msg(shutdown_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_shutdown_msg(shutdown_msg_t ** msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_reattach_tasks_request_msg(reattach_tasks_request_msg_t *,
Buf, uint16_t);
static int _unpack_reattach_tasks_request_msg(reattach_tasks_request_msg_t **,
Buf, uint16_t);
static void
_pack_reattach_tasks_response_msg(reattach_tasks_response_msg_t *,
Buf, uint16_t);
static int
_unpack_reattach_tasks_response_msg(reattach_tasks_response_msg_t **,
Buf, uint16_t);
static void _pack_task_exit_msg(task_exit_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_task_exit_msg(task_exit_msg_t ** msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_job_alloc_info_msg(job_alloc_info_msg_t * job_desc_ptr,
Buf buffer,
uint16_t protocol_version);
static int
_unpack_job_alloc_info_msg(job_alloc_info_msg_t **job_desc_buffer_ptr,
Buf buffer,
uint16_t protocol_version);
static void _pack_step_alloc_info_msg(step_alloc_info_msg_t * job_desc_ptr,
Buf buffer,
uint16_t protocol_version);
static int
_unpack_step_alloc_info_msg(step_alloc_info_msg_t **job_desc_buffer_ptr,
Buf buffer,
uint16_t protocol_version);
static void _pack_return_code_msg(return_code_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_return_code_msg(return_code_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_return_code2_msg(return_code2_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_return_code2_msg(return_code_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_slurm_ctl_conf_msg(slurm_ctl_conf_info_msg_t * build_ptr,
Buf buffer, uint16_t protocol_version);
static int _unpack_slurm_ctl_conf_msg(slurm_ctl_conf_info_msg_t **
build_buffer_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_job_info_request_msg(job_info_request_msg_t *
msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_info_request_msg(job_info_request_msg_t**
msg, Buf buffer,
uint16_t protocol_version);
static void _pack_block_info_req_msg(block_info_request_msg_t *
msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_block_info_req_msg(block_info_request_msg_t **
msg, Buf buffer,
uint16_t protocol_version);
static void _pack_block_info_msg(block_info_t *block_info, Buf buffer,
uint16_t protocol_version);
static int _unpack_block_info(block_info_t **block_info, Buf buffer,
uint16_t protocol_version);
static void _pack_job_step_info_req_msg(job_step_info_request_msg_t * msg,
Buf buffer,
uint16_t protocol_version);
static int _unpack_job_step_info_req_msg(job_step_info_request_msg_t **
msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_step_info_response_msg(job_step_info_response_msg_t
** msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_step_info_members(job_step_info_t * step, Buf buffer,
uint16_t protocol_version);
static void _pack_complete_job_allocation_msg(
complete_job_allocation_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_complete_job_allocation_msg(
complete_job_allocation_msg_t ** msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_complete_prolog_msg(
complete_prolog_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_complete_prolog_msg(
complete_prolog_msg_t ** msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_complete_batch_script_msg(
complete_batch_script_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_complete_batch_script_msg(
complete_batch_script_msg_t ** msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_job_step_stat(job_step_stat_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_step_stat(job_step_stat_t ** msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_job_step_id_msg(job_step_id_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_step_id_msg(job_step_id_msg_t ** msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_job_step_pids(job_step_pids_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_step_pids(job_step_pids_t **msg, Buf buffer,
uint16_t protocol_version);
static void _pack_step_complete_msg(step_complete_msg_t * msg,
Buf buffer,
uint16_t protocol_version);
static int _unpack_step_complete_msg(step_complete_msg_t **
msg_ptr, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_info_members(job_info_t * job, Buf buffer,
uint16_t protocol_version);
static void _pack_batch_job_launch_msg(batch_job_launch_msg_t * msg,
Buf buffer,
uint16_t protocol_version);
static int _unpack_batch_job_launch_msg(batch_job_launch_msg_t ** msg,
Buf buffer,
uint16_t protocol_version);
static void _pack_prolog_launch_msg(prolog_launch_msg_t * msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_prolog_launch_msg(prolog_launch_msg_t ** msg,
Buf buffer, uint16_t protocol_version);
static void _pack_job_desc_msg(job_desc_msg_t * job_desc_ptr, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_desc_msg(job_desc_msg_t ** job_desc_buffer_ptr,
Buf buffer,
uint16_t protocol_version);
static int _unpack_job_info_msg(job_info_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_sicp_info_msg(sicp_info_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_last_update_msg(last_update_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_last_update_msg(last_update_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_slurm_addr_array(slurm_addr_t * slurm_address,
uint32_t size_val, Buf buffer,
uint16_t protocol_version);
static int _unpack_slurm_addr_array(slurm_addr_t ** slurm_address,
uint32_t * size_val, Buf buffer,
uint16_t protocol_version);
static void _pack_ret_list(List ret_list, uint16_t size_val, Buf buffer,
uint16_t protocol_version);
static int _unpack_ret_list(List *ret_list, uint16_t size_val, Buf buffer,
uint16_t protocol_version);
static void _pack_job_id_request_msg(job_id_request_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int
_unpack_job_id_request_msg(job_id_request_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_job_id_response_msg(job_id_response_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_id_response_msg(job_id_response_msg_t ** msg,
Buf buffer,
uint16_t protocol_version);
static void _pack_job_step_kill_msg(job_step_kill_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_step_kill_msg(job_step_kill_msg_t ** msg_ptr,
Buf buffer,
uint16_t protocol_version);
static void _pack_srun_exec_msg(srun_exec_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_srun_exec_msg(srun_exec_msg_t ** msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_srun_ping_msg(srun_ping_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_srun_ping_msg(srun_ping_msg_t ** msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_srun_node_fail_msg(srun_node_fail_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_srun_node_fail_msg(srun_node_fail_msg_t ** msg_ptr,
Buf buffer,
uint16_t protocol_version);
static void _pack_srun_step_missing_msg(srun_step_missing_msg_t * msg,
Buf buffer,
uint16_t protocol_version);
static int _unpack_srun_step_missing_msg(srun_step_missing_msg_t ** msg_ptr,
Buf buffer,
uint16_t protocol_version);
static void _pack_srun_timeout_msg(srun_timeout_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_srun_timeout_msg(srun_timeout_msg_t ** msg_ptr,
Buf buffer,
uint16_t protocol_version);
static void _pack_srun_user_msg(srun_user_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_srun_user_msg(srun_user_msg_t ** msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_checkpoint_msg(checkpoint_msg_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_checkpoint_msg(checkpoint_msg_t **msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_checkpoint_resp_msg(checkpoint_resp_msg_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_checkpoint_resp_msg(checkpoint_resp_msg_t **msg_ptr,
Buf buffer,
uint16_t protocol_version);
static void _pack_checkpoint_comp(checkpoint_comp_msg_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_checkpoint_comp(checkpoint_comp_msg_t **msg_ptr,
Buf buffer,
uint16_t protocol_version);
static void _pack_checkpoint_task_comp(checkpoint_task_comp_msg_t *msg,
Buf buffer,
uint16_t protocol_version);
static int _unpack_checkpoint_task_comp(checkpoint_task_comp_msg_t **msg_ptr,
Buf buffer,
uint16_t protocol_version);
static void _pack_suspend_msg(suspend_msg_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_suspend_msg(suspend_msg_t **msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_suspend_int_msg(suspend_int_msg_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_suspend_int_msg(suspend_int_msg_t **msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_buffer_msg(slurm_msg_t * msg, Buf buffer);
static void _pack_kvs_host_rec(struct kvs_hosts *msg_ptr, Buf buffer,
uint16_t protocol_version);
static int _unpack_kvs_host_rec(struct kvs_hosts *msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_kvs_rec(struct kvs_comm *msg_ptr, Buf buffer,
uint16_t protocol_version);
static int _unpack_kvs_rec(struct kvs_comm **msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_kvs_data(struct kvs_comm_set *msg_ptr, Buf buffer,
uint16_t protocol_version);
static int _unpack_kvs_data(struct kvs_comm_set **msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_kvs_get(kvs_get_msg_t *msg_ptr, Buf buffer,
uint16_t protocol_version);
static int _unpack_kvs_get(kvs_get_msg_t **msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_file_bcast(file_bcast_msg_t * msg , Buf buffer,
uint16_t protocol_version);
static int _unpack_file_bcast(file_bcast_msg_t ** msg_ptr , Buf buffer,
uint16_t protocol_version);
static void _pack_trigger_msg(trigger_info_msg_t *msg , Buf buffer,
uint16_t protocol_version);
static int _unpack_trigger_msg(trigger_info_msg_t ** msg_ptr , Buf buffer,
uint16_t protocol_version);
static void _pack_slurmd_status(slurmd_status_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_slurmd_status(slurmd_status_t **msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_job_notify(job_notify_msg_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_notify(job_notify_msg_t **msg_ptr, Buf buffer,
uint16_t protocol_version);
static void _pack_set_debug_flags_msg(set_debug_flags_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_set_debug_flags_msg(set_debug_flags_msg_t ** msg_ptr,
Buf buffer,
uint16_t protocol_version);
static void _pack_set_debug_level_msg(set_debug_level_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_set_debug_level_msg(set_debug_level_msg_t ** msg_ptr,
Buf buffer,
uint16_t protocol_version);
static void _pack_will_run_response_msg(will_run_response_msg_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_will_run_response_msg(will_run_response_msg_t ** msg_ptr,
Buf buffer,
uint16_t protocol_version);
static void _pack_accounting_update_msg(accounting_update_msg_t *msg,
Buf buffer,
uint16_t protocol_version);
static int _unpack_accounting_update_msg(accounting_update_msg_t **msg,
Buf buffer,
uint16_t protocol_version);
static void _pack_update_resv_msg(resv_desc_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_update_resv_msg(resv_desc_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_resv_name_msg(reservation_name_msg_t * msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_resv_name_msg(reservation_name_msg_t ** msg, Buf buffer,
uint16_t protocol_version);
static void _pack_topo_info_msg(topo_info_response_msg_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_topo_info_msg(topo_info_response_msg_t **msg,
Buf buffer,
uint16_t protocol_version);
static void _pack_powercap_info_msg(powercap_info_msg_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_powercap_info_msg(powercap_info_msg_t **msg,
Buf buffer, uint16_t protocol_version);
static void _pack_job_sbcast_cred_msg(job_sbcast_cred_msg_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_sbcast_cred_msg(job_sbcast_cred_msg_t **msg,
Buf buffer,
uint16_t protocol_version);
static void _pack_update_job_step_msg(step_update_request_msg_t * msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_update_job_step_msg(step_update_request_msg_t ** msg_ptr,
Buf buffer, uint16_t protocol_version);
static void _pack_spank_env_request_msg(spank_env_request_msg_t * msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_spank_env_request_msg(spank_env_request_msg_t ** msg_ptr,
Buf buffer, uint16_t protocol_version);
static void _pack_spank_env_responce_msg(spank_env_responce_msg_t * msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_spank_env_responce_msg(spank_env_responce_msg_t ** msg_ptr,
Buf buffer, uint16_t protocol_version);
static void _pack_stats_request_msg(stats_info_request_msg_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_stats_request_msg(stats_info_request_msg_t **msg_ptr,
Buf buffer, uint16_t protocol_version);
static int _unpack_stats_response_msg(stats_info_response_msg_t **msg_ptr,
Buf buffer, uint16_t protocol_version);
static void _pack_forward_data_msg(forward_data_msg_t *msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_forward_data_msg(forward_data_msg_t **msg_ptr,
Buf buffer, uint16_t protocol_version);
static void _pack_ping_slurmd_resp(ping_slurmd_resp_msg_t *msg,
Buf buffer, uint16_t protocol_version);
static int _unpack_ping_slurmd_resp(ping_slurmd_resp_msg_t **msg_ptr,
Buf buffer, uint16_t protocol_version);
static void _pack_license_info_request_msg(license_info_request_msg_t *msg,
Buf buffer,
uint16_t protocol_version);
static int _unpack_license_info_request_msg(license_info_request_msg_t **msg,
Buf buffer,
uint16_t protocol_version);
static inline void _pack_license_info_msg(slurm_msg_t *msg, Buf buffer);
static int _unpack_license_info_msg(license_info_msg_t **msg,
Buf buffer,
uint16_t protocol_version);
static void _pack_job_requeue_msg(requeue_msg_t *msg, Buf buf,
uint16_t protocol_version);
static int _unpack_job_requeue_msg(requeue_msg_t **msg, Buf buf,
uint16_t protocol_version);
static void _pack_job_array_resp_msg(job_array_resp_msg_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_job_array_resp_msg(job_array_resp_msg_t **msg, Buf buffer,
uint16_t protocol_version);
static void _pack_composite_msg(composite_msg_t *msg, Buf buffer,
uint16_t protocol_version);
static int _unpack_composite_msg(composite_msg_t **msg, Buf buffer,
uint16_t protocol_version);
static int
_unpack_burst_buffer_info_msg(burst_buffer_info_msg_t **burst_buffer_info,
Buf buffer,
uint16_t protocol_version);
static void
_pack_cache_info_request_msg(cache_info_request_msg_t *,
Buf,
uint16_t);
static int
_unpack_cache_info_request_msg(cache_info_request_msg_t **,
Buf,
uint16_t);
static inline void
_pack_cache_info_msg(slurm_msg_t *msg, Buf buffer);
static int
_unpack_cache_info_msg(cache_info_msg_t **,
Buf,
uint16_t protocol_version);
static void
_pack_network_callerid_msg(network_callerid_msg_t *msg, Buf buffer,
uint16_t protocol_version);
static int
_unpack_network_callerid_msg(network_callerid_msg_t **msg_ptr, Buf buffer,
uint16_t protocol_version);
static void
_pack_network_callerid_resp_msg(network_callerid_resp_t *msg,
Buf buffer,
uint16_t protocol_version);
static int
_unpack_network_callerid_resp_msg(network_callerid_resp_t **msg_ptr,
Buf buffer,
uint16_t protocol_version);
/* pack_header
* packs a slurm protocol header that precedes every slurm message
* IN header - the header structure to pack
* IN/OUT buffer - destination of the pack, contains pointers that are
* automatically updated
*/
void
pack_header(header_t * header, Buf buffer)
{
pack16((uint16_t)header->version, buffer);
if (header->version >= SLURM_15_08_PROTOCOL_VERSION) {
pack16((uint16_t)header->flags, buffer);
pack16((uint16_t)header->msg_index, buffer);
pack16((uint16_t)header->msg_type, buffer);
pack32((uint32_t)header->body_length, buffer);
pack16((uint16_t)header->forward.cnt, buffer);
if (header->forward.cnt > 0) {
packstr(header->forward.nodelist, buffer);
pack32((uint32_t)header->forward.timeout, buffer);
}
pack16((uint16_t)header->ret_cnt, buffer);
if (header->ret_cnt > 0) {
_pack_ret_list(header->ret_list,
header->ret_cnt, buffer,
header->version);
}
slurm_pack_slurm_addr(&header->orig_addr, buffer);
} else {
pack16((uint16_t)header->flags, buffer);
pack16((uint16_t)header->msg_type, buffer);
pack32((uint32_t)header->body_length, buffer);
pack16((uint16_t)header->forward.cnt, buffer);
if (header->forward.cnt > 0) {
packstr(header->forward.nodelist, buffer);
pack32((uint32_t)header->forward.timeout, buffer);
}
pack16((uint16_t)header->ret_cnt, buffer);
if (header->ret_cnt > 0) {
_pack_ret_list(header->ret_list,
header->ret_cnt, buffer,
header->version);
}
slurm_pack_slurm_addr(&header->orig_addr, buffer);
}
}
/* unpack_header
* unpacks a slurm protocol header that precedes every slurm message
* OUT header - the header structure to unpack
* IN/OUT buffer - source of the unpack data, contains pointers that are
* automatically updated
* RET 0 or error code
*/
int
unpack_header(header_t * header, Buf buffer)
{
uint32_t uint32_tmp = 0;
memset(header, 0, sizeof(header_t));
forward_init(&header->forward, NULL);
header->ret_list = NULL;
safe_unpack16(&header->version, buffer);
if (header->version >= SLURM_15_08_PROTOCOL_VERSION) {
safe_unpack16(&header->flags, buffer);
safe_unpack16(&header->msg_index, buffer);
safe_unpack16(&header->msg_type, buffer);
safe_unpack32(&header->body_length, buffer);
safe_unpack16(&header->forward.cnt, buffer);
if (header->forward.cnt > 0) {
safe_unpackstr_xmalloc(&header->forward.nodelist,
&uint32_tmp, buffer);
safe_unpack32(&header->forward.timeout, buffer);
}
safe_unpack16(&header->ret_cnt, buffer);
if (header->ret_cnt > 0) {
if (_unpack_ret_list(&(header->ret_list),
header->ret_cnt, buffer,
header->version))
goto unpack_error;
} else {
header->ret_list = NULL;
}
slurm_unpack_slurm_addr_no_alloc(&header->orig_addr, buffer);
} else {
safe_unpack16(&header->flags, buffer);
safe_unpack16(&header->msg_type, buffer);
safe_unpack32(&header->body_length, buffer);
safe_unpack16(&header->forward.cnt, buffer);
if (header->forward.cnt > 0) {
safe_unpackstr_xmalloc(&header->forward.nodelist,
&uint32_tmp, buffer);
safe_unpack32(&header->forward.timeout, buffer);
}
safe_unpack16(&header->ret_cnt, buffer);
if (header->ret_cnt > 0) {
if (_unpack_ret_list(&(header->ret_list),
header->ret_cnt, buffer,
header->version))
goto unpack_error;
} else {
header->ret_list = NULL;
}
slurm_unpack_slurm_addr_no_alloc(&header->orig_addr, buffer);
}
return SLURM_SUCCESS;
unpack_error:
error("unpacking header");
destroy_forward(&header->forward);
if (header->ret_list)
list_destroy(header->ret_list);
return SLURM_ERROR;
}
/* pack_msg
* packs a generic slurm protocol message body
* IN msg - the body structure to pack (note: includes message type)
* IN/OUT buffer - destination of the pack, contains pointers that are
* automatically updated
* RET 0 or error code
*/
int
pack_msg(slurm_msg_t const *msg, Buf buffer)
{
switch (msg->msg_type) {
case REQUEST_NODE_INFO:
_pack_node_info_request_msg((node_info_request_msg_t *)
msg->data, buffer,
msg->protocol_version);
break;
case REQUEST_NODE_INFO_SINGLE:
_pack_node_info_single_msg((node_info_single_msg_t *)
msg->data, buffer,
msg->protocol_version);
break;
case REQUEST_PARTITION_INFO:
_pack_part_info_request_msg((part_info_request_msg_t *)
msg->data, buffer,
msg->protocol_version);
break;
case REQUEST_RESERVATION_INFO:
_pack_resv_info_request_msg((resv_info_request_msg_t *)
msg->data, buffer,
msg->protocol_version);
break;
case REQUEST_LAYOUT_INFO:
_pack_layout_info_request_msg((layout_info_request_msg_t *)
msg->data, buffer,
msg->protocol_version);
break;
case REQUEST_BUILD_INFO:
case REQUEST_ACCTING_INFO:
_pack_last_update_msg((last_update_msg_t *)
msg->data, buffer,
msg->protocol_version);
break;
case RESPONSE_BUILD_INFO:
_pack_slurm_ctl_conf_msg((slurm_ctl_conf_info_msg_t *)
msg->data, buffer,
msg->protocol_version);
break;
case RESPONSE_JOB_INFO:
_pack_job_info_msg((slurm_msg_t *) msg, buffer);
break;
case RESPONSE_PARTITION_INFO:
_pack_partition_info_msg((slurm_msg_t *) msg, buffer);
break;
case RESPONSE_NODE_INFO:
_pack_node_info_msg((slurm_msg_t *) msg, buffer);
break;
case MESSAGE_NODE_REGISTRATION_STATUS:
_pack_node_registration_status_msg(
(slurm_node_registration_status_msg_t *) msg->data,
buffer,
msg->protocol_version);
break;
case RESPONSE_ACCT_GATHER_UPDATE:
case RESPONSE_ACCT_GATHER_ENERGY:
_pack_acct_gather_node_resp_msg(
(acct_gather_node_resp_msg_t *) msg->data,
buffer, msg->protocol_version);
break;
case REQUEST_RESOURCE_ALLOCATION:
case REQUEST_SUBMIT_BATCH_JOB:
case REQUEST_JOB_WILL_RUN:
case REQUEST_UPDATE_JOB:
_pack_job_desc_msg((job_desc_msg_t *)
msg->data, buffer,
msg->protocol_version);
break;
case REQUEST_UPDATE_JOB_STEP:
_pack_update_job_step_msg((step_update_request_msg_t *)
msg->data, buffer,
msg->protocol_version);
case REQUEST_JOB_END_TIME:
case REQUEST_JOB_ALLOCATION_INFO:
case REQUEST_JOB_ALLOCATION_INFO_LITE:
_pack_job_alloc_info_msg((job_alloc_info_msg_t *) msg->data,
buffer,
msg->protocol_version);
break;
case REQUEST_JOB_SBCAST_CRED:
_pack_step_alloc_info_msg((step_alloc_info_msg_t *) msg->data,
buffer,
msg->protocol_version);
break;
case REQUEST_NODE_REGISTRATION_STATUS:
case REQUEST_RECONFIGURE:
case REQUEST_SHUTDOWN_IMMEDIATE:
case REQUEST_PING:
case REQUEST_CONTROL:
case REQUEST_TAKEOVER:
case REQUEST_DAEMON_STATUS:
case REQUEST_HEALTH_CHECK:
case REQUEST_ACCT_GATHER_UPDATE:
case ACCOUNTING_FIRST_REG:
case ACCOUNTING_REGISTER_CTLD:
case REQUEST_TOPO_INFO:
case REQUEST_BURST_BUFFER_INFO:
case REQUEST_SICP_INFO:
case REQUEST_POWERCAP_INFO:
/* Message contains no body/information */
break;
case REQUEST_ACCT_GATHER_ENERGY:
_pack_acct_gather_energy_req(
(acct_gather_energy_req_msg_t *)msg->data,
buffer, msg->protocol_version);
break;
case REQUEST_REBOOT_NODES:
_pack_reboot_msg((reboot_msg_t *)msg->data, buffer,
msg->protocol_version);
break;
case REQUEST_SHUTDOWN:
_pack_shutdown_msg((shutdown_msg_t *) msg->data, buffer,
msg->protocol_version);
break;
case RESPONSE_SUBMIT_BATCH_JOB: