pacemaker 3.0.1-16e74fc4da
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
pcmk_setup.c
Go to the documentation of this file.
1/*
2 * Copyright 2024-2025 the Pacemaker project contributors
3 *
4 * The version control history for this file may have further details.
5 *
6 * This source code is licensed under the GNU Lesser General Public License
7 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
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>
16#include <pacemaker-internal.h>
17#include <pacemaker.h>
18
20
41int
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) {
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) {
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) {
71 return rc;
72 }
73
75 }
76
78 return rc;
79}
80
96int
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);
115 return rc;
116 }
117
120 return rc;
121}
int cib__clean_up_connection(cib_t **cib)
Definition cib_utils.c:942
cib_t * cib_new(void)
Create a new CIB connection object.
Definition cib_client.c:562
@ cib_command
Definition cib_types.h:46
char * crm_system_name
Definition utils.c:45
void stonith__api_free(stonith_t *stonith_api)
Definition st_client.c:1939
stonith_t * stonith__api_new(void)
Definition st_client.c:1866
void stonith__register_messages(pcmk__output_t *out)
Definition st_output.c:623
G_GNUC_INTERNAL int pcmk__init_scheduler(pcmk__output_t *out, xmlNodePtr input, const crm_time_t *date, pcmk_scheduler_t **scheduler)
pcmk_scheduler_t * scheduler
Control output from tools.
int pcmk__xml_output_new(pcmk__output_t **out, xmlNodePtr *xml)
Definition output.c:246
High Level API.
stonith_t * st
Definition pcmk_fence.c:30
int pcmk__setup_output_cib_sched(pcmk__output_t **out, cib_t **cib, pcmk_scheduler_t **scheduler, xmlNode **xml)
Definition pcmk_setup.c:42
int pcmk__setup_output_fencing(pcmk__output_t **out, stonith_t **st, xmlNode **xml)
Definition pcmk_setup.c:97
void pcmk__register_lib_messages(pcmk__output_t *out)
void pcmk__unpack_constraints(pcmk_scheduler_t *scheduler)
Function and executable result codes.
@ pcmk_rc_ok
Definition results.h:159
@ pcmk_rc_cib_corrupt
Definition results.h:147
int pcmk_legacy2rc(int legacy_rc)
Definition results.c:675
Scheduler API.
This structure contains everything that makes up a single output formatter.
Fencer API connection object.
Definition stonith-ng.h:657