13 #include <sys/types.h> 21 #include <libxml/parser.h> 22 #include <libxml/tree.h> 23 #include <libxml/xmlIO.h> 32 static xmlNode *subtract_xml_comment(xmlNode *parent, xmlNode *left,
33 xmlNode *right, gboolean *changed);
86 add_xml_changes_to_patchset(xmlNode *xml, xmlNode *patchset)
88 xmlNode *cIter = NULL;
89 xmlAttr *pIter = NULL;
90 xmlNode *change = NULL;
92 const char *value = NULL;
100 sizeof(buffer)) > 0) {
115 for (pIter = pcmk__xe_first_attr(xml); pIter != NULL;
116 pIter = pIter->next) {
117 xmlNode *attr = NULL;
124 if (change == NULL) {
129 sizeof(buffer)) > 0) {
154 xmlNode *result = NULL;
159 for (pIter = pcmk__xe_first_attr(xml); pIter != NULL;
160 pIter = pIter->next) {
164 crm_xml_add(result, (
const char *)pIter->name, value);
170 for (cIter = pcmk__xml_first_child(xml); cIter != NULL;
171 cIter = pcmk__xml_next(cIter)) {
172 add_xml_changes_to_patchset(cIter, patchset);
183 sizeof(buffer)) > 0) {
195 is_config_change(xmlNode *xml)
202 p = config->_private;
208 if ((xml->doc != NULL) && (xml->doc->_private != NULL)) {
209 p = xml->doc->_private;
210 for (gIter = p->
deleted_objs; gIter; gIter = gIter->next) {
213 if (strstr(deleted_obj->
path,
223 xml_repair_v1_diff(xmlNode *last, xmlNode *next, xmlNode *local_diff,
228 xmlNode *diff_child = NULL;
230 const char *tag = NULL;
232 const char *vfields[] = {
238 if (local_diff == NULL) {
243 tag =
"diff-removed";
245 if (diff_child == NULL) {
255 for (lpc = 0; (last != NULL) && (lpc <
PCMK__NELEM(vfields)); lpc++) {
259 if (changed || lpc == 2) {
266 if (diff_child == NULL) {
276 for (lpc = 0; next && lpc <
PCMK__NELEM(vfields); lpc++) {
282 for (xmlAttrPtr a = pcmk__xe_first_attr(next); a != NULL; a = a->next) {
285 xmlSetProp(cib, a->name, (
pcmkXmlStr) p_value);
292 xml_create_patchset_v1(xmlNode *source, xmlNode *
target,
bool config,
299 xml_repair_v1_diff(source,
target, patchset, config);
306 xml_create_patchset_v2(xmlNode *source, xmlNode *
target)
314 xmlNode *patchset = NULL;
315 const char *vfields[] = {
327 doc =
target->doc->_private;
354 for (gIter = doc->
deleted_objs; gIter; gIter = gIter->next) {
365 add_xml_changes_to_patchset(
target, patchset);
371 bool *config_changed,
bool manage_version)
375 xmlNode *patch = NULL;
384 config = is_config_change(
target);
385 if (config_changed) {
386 *config_changed = config;
389 if (manage_version && config) {
396 }
else if (manage_version) {
398 crm_trace(
"Status changed %d - %d %s", format, counter,
414 patch = xml_create_patchset_v1(source,
target, config, FALSE);
417 patch = xml_create_patchset_v2(source,
target);
420 crm_err(
"Unknown patch format: %d", format);
434 if ((patch == NULL) || (source == NULL) || (
target == NULL)) {
444 if ((format > 1) && !with_digest) {
461 xmlNode *child = NULL;
462 xmlNode *added = NULL;
463 xmlNode *removed = NULL;
464 gboolean is_first = TRUE;
466 int add[] = { 0, 0, 0 };
467 int del[] = { 0, 0, 0 };
469 const char *fmt = NULL;
470 const char *digest = NULL;
473 static struct qb_log_callsite *patchset_cs = NULL;
478 if (patchset_cs == NULL) {
479 patchset_cs = qb_log_callsite_get(
function, __FILE__,
"xml-patchset",
480 log_level, __LINE__, 0);
483 if (patchset == NULL) {
496 if ((add[2] != del[2]) || (add[1] != del[1]) || (add[0] != del[0])) {
498 "Diff: --- %d.%d.%d %s", del[0], del[1], del[2], fmt);
500 "Diff: +++ %d.%d.%d %s",
501 add[0], add[1], add[2], digest);
503 }
else if ((patchset != NULL) && (add[0] || add[1] || add[2])) {
505 "%s: Local-only Change: %d.%d.%d",
506 (
function?
function :
""), add[0], add[1], add[2]);
511 xmlNode *change = NULL;
513 for (change = pcmk__xml_first_child(patchset); change != NULL;
514 change = pcmk__xml_next(change)) {
519 }
else if (strcmp(op,
"create") == 0) {
520 int lpc = 0, max = 0;
523 max = strlen(prefix);
524 pcmk__xe_log(log_level, __FILE__,
function, __LINE__, prefix,
528 for (lpc = 2; lpc < max; lpc++) {
532 pcmk__xe_log(log_level, __FILE__,
function, __LINE__, prefix,
538 }
else if (strcmp(op,
"move") == 0) {
540 "+~ %s moved to offset %s", xpath,
543 }
else if (strcmp(op,
"modify") == 0) {
552 for (child = pcmk__xml_first_child(clist); child != NULL;
553 child = pcmk__xml_next(child)) {
558 }
else if (strcmp(op,
"set") == 0) {
562 o_set += snprintf(buffer_set + o_set,
565 o_set += snprintf(buffer_set + o_set,
569 }
else if (strcmp(op,
"unset") == 0) {
571 o_unset += snprintf(buffer_unset + o_unset,
575 o_unset += snprintf(buffer_unset + o_unset,
582 "+ %s: %s", xpath, buffer_set);
586 "-- %s: %s", xpath, buffer_unset);
589 }
else if (strcmp(op,
"delete") == 0) {
595 "-- %s (%d)", xpath, position);
606 if ((log_level < LOG_DEBUG) || (
function == NULL)) {
611 for (child = pcmk__xml_first_child(removed); child != NULL;
612 child = pcmk__xml_next(child)) {
624 for (child = pcmk__xml_first_child(added); child != NULL;
625 child = pcmk__xml_next(child)) {
638 not_id(xmlAttrPtr attr,
void *user_data)
640 return strcmp((
const char *) attr->name,
XML_ATTR_ID) != 0;
645 process_v1_removals(xmlNode *
target, xmlNode *patch)
647 xmlNode *patch_child = NULL;
648 xmlNode *cIter = NULL;
651 const char *
name = NULL;
652 const char *value = NULL;
654 if ((
target == NULL) || (patch == NULL)) {
658 if (
target->type == XML_COMMENT_NODE) {
661 subtract_xml_comment(
target->parent,
target, patch, &dummy);
666 CRM_CHECK(pcmk__str_eq(crm_element_name(
target), crm_element_name(patch),
674 if ((value != NULL) && (strcmp(value,
"removed:top") == 0)) {
675 crm_trace(
"We are the root of the deletion: %s.id=%s",
name,
id);
685 cIter = pcmk__xml_first_child(
target);
687 xmlNode *target_child = cIter;
689 cIter = pcmk__xml_next(cIter);
691 process_v1_removals(target_child, patch_child);
698 process_v1_additions(xmlNode *parent, xmlNode *
target, xmlNode *patch)
700 xmlNode *patch_child = NULL;
701 xmlNode *target_child = NULL;
702 xmlAttrPtr xIter = NULL;
704 const char *
id = NULL;
705 const char *
name = NULL;
706 const char *value = NULL;
710 }
else if ((parent == NULL) && (
target == NULL)) {
716 if ((
target == NULL) && (value != NULL)
717 && (strcmp(value,
"added:top") == 0)) {
719 name = crm_element_name(patch);
720 crm_trace(
"We are the root of the addition: %s.id=%s",
name,
id);
724 }
else if (
target == NULL) {
726 name = crm_element_name(patch);
731 if (
target->type == XML_COMMENT_NODE) {
737 CRM_CHECK(pcmk__str_eq(crm_element_name(
target), crm_element_name(patch),
742 for (xIter = pcmk__xe_first_attr(patch); xIter != NULL;
743 xIter = xIter->next) {
744 const char *p_name = (
const char *) xIter->name;
752 for (patch_child = pcmk__xml_first_child(patch); patch_child != NULL;
753 patch_child = pcmk__xml_next(patch_child)) {
756 process_v1_additions(
target, target_child, patch_child);
772 find_patch_xml_node(xmlNode *patchset,
int format,
bool added,
773 xmlNode **patch_node)
780 label = added?
"diff-added" :
"diff-removed";
783 if (cib_node != NULL) {
784 *patch_node = cib_node;
788 label = added?
"target" :
"source";
793 crm_warn(
"Unknown patch format: %d", format);
808 const char *vfields[] = {
818 if (!find_patch_xml_node(patchset, format, FALSE, &tmp)) {
824 crm_trace(
"Got %d for del[%s]", del[lpc], vfields[lpc]);
829 if (!find_patch_xml_node(patchset, format, TRUE, &tmp)) {
835 crm_trace(
"Got %d for add[%s]", add[lpc], vfields[lpc]);
852 xml_patch_version_check(xmlNode *xml, xmlNode *patchset,
int format)
855 bool changed = FALSE;
857 int this[] = { 0, 0, 0 };
858 int add[] = { 0, 0, 0 };
859 int del[] = { 0, 0, 0 };
861 const char *vfields[] = {
869 crm_trace(
"Got %d for this[%s]",
this[lpc], vfields[lpc]);
878 add[2] =
this[2] + 1;
880 del[lpc] =
this[lpc];
886 if (
this[lpc] < del[lpc]) {
887 crm_debug(
"Current %s is too low (%d.%d.%d < %d.%d.%d --> %d.%d.%d)",
888 vfields[lpc],
this[0],
this[1],
this[2],
889 del[0], del[1], del[2], add[0], add[1], add[2]);
892 }
else if (
this[lpc] > del[lpc]) {
893 crm_info(
"Current %s is too high (%d.%d.%d > %d.%d.%d --> %d.%d.%d) %p",
894 vfields[lpc],
this[0],
this[1],
this[2],
895 del[0], del[1], del[2], add[0], add[1], add[2], patchset);
902 if (add[lpc] > del[lpc]) {
908 crm_notice(
"Versions did not change in patch %d.%d.%d",
909 add[0], add[1], add[2]);
913 crm_debug(
"Can apply patch %d.%d.%d to %d.%d.%d",
914 add[0], add[1], add[2],
this[0],
this[1],
this[2]);
928 apply_v1_patchset(xmlNode *xml, xmlNode *patchset)
931 int root_nodes_seen = 0;
933 xmlNode *child_diff = NULL;
934 xmlNode *added =
find_xml_node(patchset,
"diff-added", FALSE);
935 xmlNode *removed =
find_xml_node(patchset,
"diff-removed", FALSE);
939 for (child_diff = pcmk__xml_first_child(removed); child_diff != NULL;
940 child_diff = pcmk__xml_next(child_diff)) {
942 if (root_nodes_seen == 0) {
943 process_v1_removals(xml, child_diff);
948 if (root_nodes_seen > 1) {
949 crm_err(
"(-) Diffs cannot contain more than one change set... saw %d",
957 xmlNode *child_diff = NULL;
959 for (child_diff = pcmk__xml_first_child(added); child_diff != NULL;
960 child_diff = pcmk__xml_next(child_diff)) {
962 if (root_nodes_seen == 0) {
963 process_v1_additions(NULL, xml, child_diff);
969 if (root_nodes_seen > 1) {
970 crm_err(
"(+) Diffs cannot contain more than one change set... saw %d",
983 first_matching_xml_child(xmlNode *parent,
const char *
name,
const char *
id,
986 xmlNode *cIter = NULL;
988 for (cIter = pcmk__xml_first_child(parent); cIter != NULL;
989 cIter = pcmk__xml_next(cIter)) {
990 if (strcmp((
const char *) cIter->name,
name) != 0) {
993 const char *cid =
ID(cIter);
995 if ((cid == NULL) || (strcmp(cid,
id) != 0)) {
1001 if ((cIter->type == XML_COMMENT_NODE)
1026 search_v2_xpath(xmlNode *top,
const char *key,
int target_position)
1028 xmlNode *
target = (xmlNode *) top->doc;
1029 const char *current = key;
1039 key_len = strlen(key);
1045 remainder = calloc(key_len,
sizeof(
char));
1048 section = calloc(key_len,
sizeof(
char));
1051 id = calloc(key_len,
sizeof(
char));
1054 tag = calloc(key_len,
sizeof(
char));
1059 rc = sscanf(current,
"/%[^/]%s", section, remainder);
1062 int f = sscanf(section,
"%[^[][@id='%[^']", tag,
id);
1063 int current_position = -1;
1068 if ((
rc == 1) && (target_position >= 0)) {
1069 current_position = target_position;
1086 current = remainder;
1094 (path = (
char *) xmlGetNodePath(
target)), key);
1107 typedef struct xml_change_obj_s {
1113 sort_change_obj_by_position(gconstpointer a, gconstpointer b)
1117 int position_a = -1;
1118 int position_b = -1;
1123 if (position_a < position_b) {
1126 }
else if (position_a > position_b) {
1143 apply_v2_patchset(xmlNode *xml, xmlNode *patchset)
1146 xmlNode *change = NULL;
1147 GList *change_objs = NULL;
1148 GList *gIter = NULL;
1150 for (change = pcmk__xml_first_child(patchset); change != NULL;
1151 change = pcmk__xml_next(change)) {
1152 xmlNode *match = NULL;
1161 crm_trace(
"Processing %s %s", change->name, op);
1164 if (strcmp(op,
"delete") == 0) {
1167 match = search_v2_xpath(xml, xpath, position);
1168 crm_trace(
"Performing %s on %s with %p", op, xpath, match);
1170 if ((match == NULL) && (strcmp(op,
"delete") == 0)) {
1171 crm_debug(
"No %s match for %s in %p", op, xpath, xml->doc);
1174 }
else if (match == NULL) {
1175 crm_err(
"No %s match for %s in %p", op, xpath, xml->doc);
1179 }
else if ((strcmp(op,
"create") == 0) || (strcmp(op,
"move") == 0)) {
1185 change_obj->change = change;
1186 change_obj->match = match;
1188 change_objs = g_list_append(change_objs, change_obj);
1190 if (strcmp(op,
"move") == 0) {
1192 if ((match->parent != NULL) && (match->parent->last != NULL)) {
1193 xmlAddNextSibling(match->parent->last, match);
1197 }
else if (strcmp(op,
"delete") == 0) {
1200 }
else if (strcmp(op,
"modify") == 0) {
1201 xmlNode *attrs = NULL;
1205 if (attrs == NULL) {
1211 for (xmlAttrPtr pIter = pcmk__xe_first_attr(attrs); pIter != NULL;
1212 pIter = pIter->next) {
1213 const char *
name = (
const char *) pIter->name;
1220 crm_err(
"Unknown operation: %s", op);
1226 change_objs = g_list_sort(change_objs, sort_change_obj_by_position);
1228 for (gIter = change_objs; gIter; gIter = gIter->next) {
1230 xmlNode *match = change_obj->match;
1231 const char *op = NULL;
1232 const char *xpath = NULL;
1234 change = change_obj->change;
1239 crm_trace(
"Continue performing %s on %s with %p", op, xpath, match);
1241 if (strcmp(op,
"create") == 0) {
1243 xmlNode *child = NULL;
1244 xmlNode *match_child = NULL;
1246 match_child = match->children;
1249 while ((match_child != NULL)
1251 match_child = match_child->next;
1254 child = xmlDocCopyNode(change->children, match->doc, 1);
1256 crm_trace(
"Adding %s at position %d", child->name, position);
1257 xmlAddPrevSibling(match_child, child);
1259 }
else if (match->last) {
1260 crm_trace(
"Adding %s at position %d (end)",
1261 child->name, position);
1262 xmlAddNextSibling(match->last, child);
1265 crm_trace(
"Adding %s at position %d (first)",
1266 child->name, position);
1268 xmlAddChild(match, child);
1272 }
else if (strcmp(op,
"move") == 0) {
1277 xmlNode *match_child = NULL;
1285 match_child = match->parent->children;
1287 while ((match_child != NULL)
1289 match_child = match_child->next;
1292 crm_trace(
"Moving %s to position %d (was %d, prev %p, %s %p)",
1293 match->name, position,
1295 match->prev, (match_child?
"next":
"last"),
1296 (match_child? match_child : match->parent->last));
1299 xmlAddPrevSibling(match_child, match);
1303 xmlAddNextSibling(match->parent->last, match);
1307 crm_trace(
"%s is already in position %d",
1308 match->name, position);
1312 crm_err(
"Moved %s.%s to position %d instead of %d (%p)",
1313 match->name,
ID(match),
1315 position, match->prev);
1321 g_list_free_full(change_objs, free);
1330 xmlNode *old = NULL;
1333 if (patchset == NULL) {
1340 if (check_version) {
1361 crm_err(
"Unknown patch format: %d", format);
1366 if ((
rc ==
pcmk_ok) && (digest != NULL)) {
1367 static struct qb_log_callsite *digest_cs = NULL;
1369 char *new_digest = NULL;
1372 if (digest_cs == NULL) {
1373 digest_cs = qb_log_callsite_get(__func__, __FILE__,
"diff-digest",
1380 crm_info(
"v%d digest mis-match: expected %s, calculated %s",
1381 format, digest, new_digest);
1384 if ((digest_cs != NULL) && digest_cs->targets) {
1391 ((digest_cs != NULL)? digest_cs->targets : 0));
1395 crm_trace(
"v%d digest matched: expected %s, calculated %s",
1396 format, digest, new_digest);
1408 xmlNode *child = NULL;
1413 for (child = pcmk__xml_first_child(a_node); child != NULL;
1414 child = pcmk__xml_next(child)) {
1422 xmlNode *tmp1 = NULL;
1439 if ((added->children == NULL) && (removed->children == NULL)) {
1448 subtract_xml_comment(xmlNode *parent, xmlNode *left, xmlNode *right,
1452 CRM_CHECK(left->type == XML_COMMENT_NODE,
return NULL);
1454 if ((right == NULL) || !pcmk__str_eq((
const char *)left->content,
1455 (
const char *)right->content,
1457 xmlNode *deleted = NULL;
1470 gboolean full, gboolean *changed,
const char *marker)
1472 gboolean dummy = FALSE;
1473 xmlNode *diff = NULL;
1474 xmlNode *right_child = NULL;
1475 xmlNode *left_child = NULL;
1476 xmlAttrPtr xIter = NULL;
1478 const char *
id = NULL;
1479 const char *
name = NULL;
1480 const char *value = NULL;
1481 const char *right_val = NULL;
1483 if (changed == NULL) {
1491 if (left->type == XML_COMMENT_NODE) {
1492 return subtract_xml_comment(parent, left, right, changed);
1496 if (right == NULL) {
1497 xmlNode *deleted = NULL;
1499 crm_trace(
"Processing <%s id=%s> (complete copy)",
1500 crm_element_name(left),
id);
1508 name = crm_element_name(left);
1510 CRM_CHECK(pcmk__str_eq(crm_element_name(left), crm_element_name(right),
1516 if ((value != NULL) && (strcmp(value,
"removed:top") == 0)) {
1517 crm_trace(
"We are the root of the deletion: %s.id=%s",
name,
id);
1526 for (left_child = pcmk__xml_first_child(left); left_child != NULL;
1527 left_child = pcmk__xml_next(left_child)) {
1528 gboolean child_changed = FALSE;
1533 if (child_changed) {
1542 xmlAttrPtr pIter = NULL;
1544 for (pIter = pcmk__xe_first_attr(left); pIter != NULL;
1545 pIter = pIter->next) {
1546 const char *p_name = (
const char *)pIter->name;
1547 const char *p_value = pcmk__xml_attr_value(pIter);
1557 for (xIter = pcmk__xe_first_attr(left); xIter != NULL;
1558 xIter = xIter->next) {
1559 const char *prop_name = (
const char *) xIter->name;
1560 xmlAttrPtr right_attr = NULL;
1573 right_attr = xmlHasProp(right, (
pcmkXmlStr) prop_name);
1575 p = right_attr->_private;
1583 xmlAttrPtr pIter = NULL;
1585 for (pIter = pcmk__xe_first_attr(left); pIter != NULL;
1586 pIter = pIter->next) {
1587 const char *p_name = (
const char *) pIter->name;
1588 const char *p_value = pcmk__xml_attr_value(pIter);
1605 if (strcmp(left_value, right_val) == 0) {
1611 xmlAttrPtr pIter = NULL;
1613 crm_trace(
"Changes detected to %s in <%s id=%s>", prop_name,
1614 crm_element_name(left),
id);
1615 for (pIter = pcmk__xe_first_attr(left); pIter != NULL;
1616 pIter = pIter->next) {
1617 const char *p_name = (
const char *) pIter->name;
1618 const char *p_value = pcmk__xml_attr_value(pIter);
1626 crm_trace(
"Changes detected to %s (%s -> %s) in <%s id=%s>",
1627 prop_name, left_value, right_val,
1628 crm_element_name(left),
id);
1639 }
else if (!full && (
id != NULL)) {
1653 gboolean result = TRUE;
1654 int root_nodes_seen = 0;
1655 static struct qb_log_callsite *digest_cs = NULL;
1659 xmlNode *child_diff = NULL;
1661 xmlNode *removed =
find_xml_node(diff,
"diff-removed", FALSE);
1663 CRM_CHECK(new_xml != NULL,
return FALSE);
1664 if (digest_cs == NULL) {
1665 digest_cs = qb_log_callsite_get(__func__, __FILE__,
"diff-digest",
1670 for (child_diff = pcmk__xml_first_child(removed); child_diff != NULL;
1671 child_diff = pcmk__xml_next(child_diff)) {
1672 CRM_CHECK(root_nodes_seen == 0, result = FALSE);
1673 if (root_nodes_seen == 0) {
1680 if (root_nodes_seen == 0) {
1683 }
else if (root_nodes_seen > 1) {
1684 crm_err(
"(-) Diffs cannot contain more than one change set... saw %d",
1689 root_nodes_seen = 0;
1692 xmlNode *child_diff = NULL;
1694 for (child_diff = pcmk__xml_first_child(added); child_diff != NULL;
1695 child_diff = pcmk__xml_next(child_diff)) {
1696 CRM_CHECK(root_nodes_seen == 0, result = FALSE);
1697 if (root_nodes_seen == 0) {
1704 if (root_nodes_seen > 1) {
1705 crm_err(
"(+) Diffs cannot contain more than one change set... saw %d",
1709 }
else if (result && (digest != NULL)) {
1710 char *new_digest = NULL;
1716 crm_info(
"Digest mis-match: expected %s, calculated %s",
1717 digest, new_digest);
1720 crm_trace(
"%p %.6x", digest_cs, digest_cs ? digest_cs->targets : 0);
1721 if ((digest_cs != NULL) && digest_cs->targets) {
1728 crm_trace(
"Digest matched: expected %s, calculated %s",
1729 digest, new_digest);
1733 }
else if (result) {
#define CRM_CHECK(expr, failure_action)
xmlNode * find_xml_node(xmlNode *cib, const char *node_path, gboolean must_find)
#define crm_notice(fmt, args...)
void patchset_process_digest(xmlNode *patch, xmlNode *source, xmlNode *target, bool with_digest)
#define XML_ATTR_NUMUPDATES
int pcmk_rc2legacy(int rc)
bool xml_patch_versions(xmlNode *patchset, int add[3], int del[3])
void log_data_element(int log_level, const char *file, const char *function, int line, const char *prefix, xmlNode *data, int depth, gboolean formatted)
G_GNUC_INTERNAL int pcmk__element_xpath(const char *prefix, xmlNode *xml, char *buffer, int offset, size_t buffer_size)
xmlNode * first_named_child(const xmlNode *parent, const char *name)
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
Create an XML attribute with specified name and integer value.
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
#define XML_NVPAIR_ATTR_NAME
#define CRM_LOG_ASSERT(expr)
#define do_crm_log_alias(level, file, function, line, fmt, args...)
Log a message as if it came from a different code location.
unsigned int crm_trace_nonlog
int crm_element_value_int(const xmlNode *data, const char *name, int *dest)
Retrieve the integer value of an XML attribute.
Deprecated Pacemaker XML API.
#define XML_ATTR_GENERATION
void xml_log_patchset(uint8_t log_level, const char *function, xmlNode *patchset)
xmlNode * copy_xml(xmlNode *src_node)
#define crm_warn(fmt, args...)
#define pcmk_err_diff_failed
G_GNUC_INTERNAL void pcmk__xc_update(xmlNode *parent, xmlNode *target, xmlNode *update)
#define crm_debug(fmt, args...)
char * crm_element_value_copy(const xmlNode *data, const char *name)
Retrieve a copy of the value of an XML attribute.
struct xml_change_obj_s xml_change_obj_t
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
void pcmk__xe_remove_matching_attrs(xmlNode *element, bool(*match)(xmlAttrPtr, void *), void *user_data)
#define crm_trace(fmt, args...)
#define crm_log_xml_explicit(xml, text)
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
xmlNode * add_node_copy(xmlNode *new_parent, xmlNode *xml_node)
Wrappers for and extensions to libxml2.
bool xml_document_dirty(xmlNode *xml)
xmlNode * create_xml_node(xmlNode *parent, const char *name)
#define XML_DIFF_POSITION
void purge_diff_markers(xmlNode *a_node)
void free_xml(xmlNode *child)
xmlNode * xml_create_patchset(int format, xmlNode *source, xmlNode *target, bool *config_changed, bool manage_version)
G_GNUC_INTERNAL xmlNode * pcmk__xml_match(xmlNode *haystack, xmlNode *needle, bool exact)
const xmlChar * pcmkXmlStr
G_GNUC_INTERNAL void pcmk__xe_log(int log_level, const char *file, const char *function, int line, const char *prefix, xmlNode *data, int depth, int options)
G_GNUC_INTERNAL bool pcmk__xa_filterable(const char *name)
gboolean crm_is_callsite_active(struct qb_log_callsite *cs, uint8_t level, uint32_t tags)
gboolean apply_xml_diff(xmlNode *old_xml, xmlNode *diff, xmlNode **new_xml)
#define PCMK__BUFFER_SIZE
xmlNode * diff_xml_object(xmlNode *old, xmlNode *new, gboolean suppress)
#define crm_err(fmt, args...)
void xml_remove_prop(xmlNode *obj, const char *name)
char * calculate_xml_versioned_digest(xmlNode *input, gboolean sort, gboolean do_filter, const char *version)
Calculate and return digest of XML tree.
gboolean can_prune_leaf(xmlNode *xml_node)
void xml_acl_disable(xmlNode *xml)
int compare_version(const char *version1, const char *version2)
#define crm_log_xml_info(xml, text)
#define XML_ATTR_GENERATION_ADMIN
#define XML_NVPAIR_ATTR_VALUE
#define XML_ATTR_CRM_VERSION
void save_xml_to_file(xmlNode *xml, const char *desc, const char *filename)
#define XML_CIB_TAG_CONFIGURATION
xmlNode * subtract_xml_object(xmlNode *parent, xmlNode *left, xmlNode *right, gboolean full, gboolean *changed, const char *marker)
int xml_apply_patchset(xmlNode *xml, xmlNode *patchset, bool check_version)
G_GNUC_INTERNAL void pcmk__mark_xml_created(xmlNode *xml)
G_GNUC_INTERNAL void pcmk__xml_update(xmlNode *parent, xmlNode *target, xmlNode *update, bool as_diff)
#define crm_info(fmt, args...)
G_GNUC_INTERNAL int pcmk__xml_position(xmlNode *xml, enum xml_private_flags ignore_if_set)