This source file includes following definitions.
- pcmk__setup_output_cib_sched
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11 #include <crm/cib/internal.h>
12 #include <crm/common/output.h>
13 #include <crm/common/results.h>
14 #include <crm/common/scheduler.h>
15 #include <pacemaker-internal.h>
16 #include <pacemaker.h>
17
18 #include "libpacemaker_private.h"
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 int
41 pcmk__setup_output_cib_sched(pcmk__output_t **out, cib_t **cib,
42 pcmk_scheduler_t **scheduler, xmlNode **xml)
43 {
44 int rc = pcmk_rc_ok;
45
46 rc = pcmk__xml_output_new(out, xml);
47 if (rc != pcmk_rc_ok) {
48 return rc;
49 }
50
51 if (cib != NULL) {
52 *cib = cib_new();
53 if (*cib == NULL) {
54 return pcmk_rc_cib_corrupt;
55 }
56
57 rc = (*cib)->cmds->signon(*cib, crm_system_name, cib_command);
58 rc = pcmk_legacy2rc(rc);
59
60 if (rc != pcmk_rc_ok) {
61 cib__clean_up_connection(cib);
62 return rc;
63 }
64 }
65
66 if (scheduler != NULL) {
67 rc = pcmk__init_scheduler(*out, NULL, NULL, scheduler);
68 if (rc != pcmk_rc_ok && cib != NULL) {
69 cib__clean_up_connection(cib);
70 return rc;
71 }
72
73 pcmk__unpack_constraints(*scheduler);
74 }
75
76 pcmk__register_lib_messages(*out);
77 return rc;
78 }