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

Function cib_process_query

lib/cib/cib_ops.c:37–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35#include <crm/common/xml.h>
36
37int
38cib_process_query(const char *op, int options, const char *section, xmlNode * req, xmlNode * input,
39 xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer)
40{
41 xmlNode *obj_root = NULL;
42 int result = pcmk_ok;
43
44 crm_trace("Processing \"%s\" event for section=%s", op, crm_str(section));
45
46 if (options & cib_xpath) {
47 return cib_process_xpath(op, options, section, req, input,
48 existing_cib, result_cib, answer);
49 }
50
51 CRM_CHECK(*answer == NULL, free_xml(*answer));
52 *answer = NULL;
53
54 if (safe_str_eq(XML_CIB_TAG_SECTION_ALL, section)) {
55 section = NULL;
56 }
57
58 obj_root = get_object_root(section, existing_cib);
59
60 if (obj_root == NULL) {
61 result = -ENXIO;
62
63 } else if (options & cib_no_children) {
64 const char *tag = TYPE(obj_root);
65 xmlNode *shallow = create_xml_node(*answer, tag);
66
67 copy_in_properties(shallow, obj_root);
68 *answer = shallow;
69
70 } else {
71 *answer = obj_root;
72 }
73
74 if (result == pcmk_ok && *answer == NULL) {
75 crm_err("Error creating query response");
76 result = -ENOMSG;
77 }
78
79 return result;
80}
81
82int
83cib_process_erase(const char *op, int options, const char *section, xmlNode * req, xmlNode * input,

Callers

nothing calls this directly

Calls 5

cib_process_xpathFunction · 0.85
free_xmlFunction · 0.85
get_object_rootFunction · 0.85
create_xml_nodeFunction · 0.85
copy_in_propertiesFunction · 0.85

Tested by

no test coverage detected