This source file includes following definitions.
- pcmk__setup_output_cib_sched
- pcmk__setup_output_fencing
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 <crm/fencing/internal.h>
16 #include <pacemaker-internal.h>
17 #include <pacemaker.h>
18
19 #include "libpacemaker_private.h"
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 int
42 pcmk__setup_output_cib_sched(pcmk__output_t **out, cib_t **cib,
43 pcmk_scheduler_t **scheduler, xmlNode **xml)
44 {
45 int rc = pcmk_rc_ok;
46
47 rc = pcmk__xml_output_new(out, xml);
48 if (rc != pcmk_rc_ok) {
49 return rc;
50 }
51
52 if (cib != NULL) {
53 *cib = cib_new();
54 if (*cib == NULL) {
55 return pcmk_rc_cib_corrupt;
56 }
57
58 rc = (*cib)->cmds->signon(*cib, crm_system_name, cib_command);
59 rc = pcmk_legacy2rc(rc);
60
61 if (rc != pcmk_rc_ok) {
62 cib__clean_up_connection(cib);
63 return rc;
64 }
65 }
66
67 if (scheduler != NULL) {
68 rc = pcmk__init_scheduler(*out, NULL, NULL, scheduler);
69 if (rc != pcmk_rc_ok && cib != NULL) {
70 cib__clean_up_connection(cib);
71 return rc;
72 }
73
74 pcmk__unpack_constraints(*scheduler);
75 }
76
77 pcmk__register_lib_messages(*out);
78 return rc;
79 }
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96 int
97 pcmk__setup_output_fencing(pcmk__output_t **out, stonith_t **st, xmlNode **xml)
98 {
99 int rc = pcmk_rc_ok;
100
101 rc = pcmk__xml_output_new(out, xml);
102 if (rc != pcmk_rc_ok) {
103 return rc;
104 }
105
106 *st = stonith_api_new();
107 if (*st == NULL) {
108 return ENOMEM;
109 }
110
111 rc = (*st)->cmds->connect(*st, crm_system_name, NULL);
112 if (rc < 0) {
113 rc = pcmk_legacy2rc(rc);
114 stonith_api_delete(*st);
115 return rc;
116 }
117
118 pcmk__register_lib_messages(*out);
119 stonith__register_messages(*out);
120 return rc;
121 }