MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / clone_unpack

Function clone_unpack

lib/pengine/clone.c:166–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166gboolean
167clone_unpack(resource_t * rsc, pe_working_set_t * data_set)
168{
169 int lpc = 0;
170 const char *type = NULL;
171 resource_t *self = NULL;
172 int num_xml_children = 0;
173 xmlNode *a_child = NULL;
174 xmlNode *xml_tmp = NULL;
175 xmlNode *xml_self = NULL;
176 xmlNode *xml_obj = rsc->xml;
177 clone_variant_data_t *clone_data = NULL;
178
179 const char *ordered = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_ORDERED);
180 const char *interleave = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_INTERLEAVE);
181 const char *max_clones = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_INCARNATION_MAX);
182 const char *max_clones_node = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_INCARNATION_NODEMAX);
183
184 pe_rsc_trace(rsc, "Processing resource %s...", rsc->id);
185
186 clone_data = calloc(1, sizeof(clone_variant_data_t));
187 rsc->variant_opaque = clone_data;
188 clone_data->interleave = FALSE;
189 clone_data->ordered = FALSE;
190
191 clone_data->active_clones = 0;
192 clone_data->xml_obj_child = NULL;
193 clone_data->clone_node_max = crm_parse_int(max_clones_node, "1");
194
195 if (max_clones) {
196 clone_data->clone_max = crm_parse_int(max_clones, "1");
197
198 } else if (g_list_length(data_set->nodes) > 0) {
199 clone_data->clone_max = g_list_length(data_set->nodes);
200
201 } else {
202 clone_data->clone_max = 1; /* Handy during crm_verify */
203 }
204
205 if (crm_is_true(interleave)) {
206 clone_data->interleave = TRUE;
207 }
208 if (crm_is_true(ordered)) {
209 clone_data->ordered = TRUE;
210 }
211 if ((rsc->flags & pe_rsc_unique) == 0 && clone_data->clone_node_max > 1) {
212 crm_config_err("Anonymous clones (%s) may only support one copy" " per node", rsc->id);
213 clone_data->clone_node_max = 1;
214 }
215
216 pe_rsc_trace(rsc, "Options for %s", rsc->id);
217 pe_rsc_trace(rsc, "\tClone max: %d", clone_data->clone_max);
218 pe_rsc_trace(rsc, "\tClone node max: %d", clone_data->clone_node_max);
219 pe_rsc_trace(rsc, "\tClone is unique: %s", is_set(rsc->flags, pe_rsc_unique) ? "true" : "false");
220
221 clone_data->xml_obj_child = find_xml_node(xml_obj, XML_CIB_TAG_GROUP, FALSE);
222
223 if (clone_data->xml_obj_child == NULL) {

Callers 1

master_unpackFunction · 0.85

Calls 12

crm_parse_intFunction · 0.85
crm_is_trueFunction · 0.85
is_setFunction · 0.85
find_xml_nodeFunction · 0.85
__xml_first_childFunction · 0.85
__xml_nextFunction · 0.85
crm_str_eqFunction · 0.85
copy_xmlFunction · 0.85
add_node_copyFunction · 0.85
add_hash_paramFunction · 0.85
common_unpackFunction · 0.85
create_child_cloneFunction · 0.85

Tested by

no test coverage detected