Line data Source code
1 : /*
2 : * Copyright 2024 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 :
12 : #include <libxml/tree.h> // xmlNode
13 :
14 : #include <pacemaker.h>
15 : #include <pacemaker-internal.h>
16 :
17 : /*!
18 : * \internal
19 : * \brief List all available cluster options
20 : *
21 : * These are options that affect the entire cluster.
22 : *
23 : * \param[in,out] out Output object
24 : * \param[in] all If \c true, include advanced and deprecated options (this
25 : * is always treated as true for XML output objects)
26 : *
27 : * \return Standard Pacemaker return code
28 : */
29 : int
30 0 : pcmk__list_cluster_options(pcmk__output_t *out, bool all)
31 : {
32 0 : const char *name = "cluster-options";
33 0 : const char *desc_short = "Pacemaker cluster options";
34 0 : const char *desc_long = NULL;
35 :
36 : // Can't use string constants because desc_long may be translated by gettext
37 0 : desc_long = "Also known as properties, these are options that affect "
38 : "behavior across the entire cluster. They are configured "
39 : "within cluster_property_set elements inside the crm_config "
40 : "subsection of the CIB configuration section.";
41 :
42 0 : return pcmk__output_cluster_options(out, name, desc_short, desc_long,
43 : pcmk__opt_none, all);
44 : }
45 :
46 : // Documented in header
47 : int
48 0 : pcmk_list_cluster_options(xmlNode **xml, bool all)
49 : {
50 0 : pcmk__output_t *out = NULL;
51 0 : int rc = pcmk_rc_ok;
52 :
53 0 : rc = pcmk__xml_output_new(&out, xml);
54 0 : if (rc != pcmk_rc_ok) {
55 0 : return rc;
56 : }
57 :
58 0 : pcmk__register_lib_messages(out);
59 :
60 0 : rc = pcmk__list_cluster_options(out, all);
61 :
62 0 : pcmk__xml_output_finish(out, pcmk_rc2exitc(rc), xml);
63 0 : return rc;
64 : }
65 :
66 : /*!
67 : * \internal
68 : * \brief List common fencing resource parameters
69 : *
70 : * These are parameters that are available for all fencing resources, regardless
71 : * of type. They are processed by Pacemaker, rather than by the fence agent or
72 : * the fencing library.
73 : *
74 : * \param[in,out] out Output object
75 : * \param[in] all If \c true, include advanced and deprecated options (this
76 : * is always treated as true for XML output objects)
77 : *
78 : * \return Standard Pacemaker return code
79 : */
80 : int
81 0 : pcmk__list_fencing_params(pcmk__output_t *out, bool all)
82 : {
83 0 : const char *name = "fence-attributes";
84 0 : const char *desc_short = "Fencing resource common parameters";
85 0 : const char *desc_long = NULL;
86 :
87 0 : desc_long = "Special parameters that are available for all fencing "
88 : "resources, regardless of type. They are processed by "
89 : "Pacemaker, rather than by the fence agent or the fencing "
90 : "library.";
91 :
92 0 : return pcmk__output_fencing_params(out, name, desc_short, desc_long, all);
93 : }
94 :
95 : // Documented in header
96 : int
97 0 : pcmk_list_fencing_params(xmlNode **xml, bool all)
98 : {
99 0 : pcmk__output_t *out = NULL;
100 0 : int rc = pcmk_rc_ok;
101 :
102 0 : rc = pcmk__xml_output_new(&out, xml);
103 0 : if (rc != pcmk_rc_ok) {
104 0 : return rc;
105 : }
106 :
107 0 : pcmk__register_lib_messages(out);
108 :
109 0 : rc = pcmk__list_fencing_params(out, all);
110 :
111 0 : pcmk__xml_output_finish(out, pcmk_rc2exitc(rc), xml);
112 0 : return rc;
113 : }
114 :
115 : /*!
116 : * \internal
117 : * \brief List meta-attributes applicable to primitive resources as OCF-like XML
118 : *
119 : * \param[in,out] out Output object
120 : * \param[in] all If \c true, include advanced and deprecated options (this
121 : * is always treated as true for XML output objects)
122 : *
123 : * \return Standard Pacemaker return code
124 : */
125 : int
126 0 : pcmk__list_primitive_meta(pcmk__output_t *out, bool all)
127 : {
128 0 : const char *name = "primitive-meta";
129 0 : const char *desc_short = "Primitive meta-attributes";
130 0 : const char *desc_long = "Meta-attributes applicable to primitive resources";
131 :
132 0 : return pcmk__output_primitive_meta(out, name, desc_short, desc_long, all);
133 : }
134 :
135 : // Documented in header
136 : int
137 0 : pcmk_list_primitive_meta(xmlNode **xml, bool all)
138 : {
139 0 : pcmk__output_t *out = NULL;
140 0 : int rc = pcmk_rc_ok;
141 :
142 0 : rc = pcmk__xml_output_new(&out, xml);
143 0 : if (rc != pcmk_rc_ok) {
144 0 : return rc;
145 : }
146 :
147 0 : pcmk__register_lib_messages(out);
148 :
149 0 : rc = pcmk__list_primitive_meta(out, all);
150 :
151 0 : pcmk__xml_output_finish(out, pcmk_rc2exitc(rc), xml);
152 0 : return rc;
153 : }
|