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

Function cib_process_modify

lib/cib/cib_ops.c:302–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302int
303cib_process_modify(const char *op, int options, const char *section, xmlNode * req, xmlNode * input,
304 xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer)
305{
306 xmlNode *obj_root = NULL;
307
308 crm_trace("Processing \"%s\" event", op);
309
310 if (options & cib_xpath) {
311 return cib_process_xpath(op, options, section, req, input,
312 existing_cib, result_cib, answer);
313 }
314
315 if (input == NULL) {
316 crm_err("Cannot perform modification with no data");
317 return -EINVAL;
318 }
319
320 obj_root = get_object_root(section, *result_cib);
321 if (obj_root == NULL) {
322 xmlNode *tmp_section = NULL;
323 const char *path = get_object_parent(section);
324
325 if (path == NULL) {
326 return -EINVAL;
327 }
328
329 tmp_section = create_xml_node(NULL, section);
330 cib_process_xpath(CIB_OP_CREATE, 0, path, NULL, tmp_section, NULL, result_cib, answer);
331 free_xml(tmp_section);
332
333 obj_root = get_object_root(section, *result_cib);
334 }
335
336 CRM_CHECK(obj_root != NULL, return -EINVAL);
337
338 if (update_xml_child(obj_root, input) == FALSE) {
339 if (options & cib_can_create) {
340 add_node_copy(obj_root, input);
341 } else {
342 return -ENXIO;
343 }
344 }
345
346 return pcmk_ok;
347}
348
349static int
350update_cib_object(xmlNode * parent, xmlNode * update)

Callers 1

cib_process_createFunction · 0.85

Calls 7

cib_process_xpathFunction · 0.85
get_object_rootFunction · 0.85
get_object_parentFunction · 0.85
create_xml_nodeFunction · 0.85
free_xmlFunction · 0.85
update_xml_childFunction · 0.85
add_node_copyFunction · 0.85

Tested by

no test coverage detected