13 #include <sys/types.h> 21 #include <libxml/parser.h> 22 #include <libxml/tree.h> 23 #include <libxml/xmlIO.h> 31 static xmlNode *subtract_xml_comment(xmlNode *
parent, xmlNode *left,
32 xmlNode *right, gboolean *changed);
85 add_xml_changes_to_patchset(xmlNode *xml, xmlNode *patchset)
87 xmlNode *cIter = NULL;
88 xmlAttr *pIter = NULL;
89 xmlNode *change = NULL;
91 const char *value = NULL;
106 g_string_free(xpath, TRUE);
113 for (pIter = pcmk__xe_first_attr(xml); pIter != NULL;
114 pIter = pIter->next) {
115 xmlNode *attr = NULL;
117 nodepriv = pIter->_private;
122 if (change == NULL) {
132 g_string_free(xpath, TRUE);
156 for (pIter = pcmk__xe_first_attr(xml); pIter != NULL;
157 pIter = pIter->next) {
158 nodepriv = pIter->_private;
167 for (cIter = pcmk__xml_first_child(xml); cIter != NULL;
168 cIter = pcmk__xml_next(cIter)) {
169 add_xml_changes_to_patchset(cIter, patchset);
172 nodepriv = xml->_private;
186 g_string_free(xpath, TRUE);
192 is_config_change(xmlNode *xml)
200 nodepriv = config->_private;
206 if ((xml->doc != NULL) && (xml->doc->_private != NULL)) {
207 docpriv = xml->doc->_private;
208 for (gIter = docpriv->
deleted_objs; gIter; gIter = gIter->next) {
211 if (strstr(deleted_obj->
path,
221 xml_repair_v1_diff(xmlNode *last, xmlNode *next, xmlNode *local_diff,
226 xmlNode *diff_child = NULL;
228 const char *tag = NULL;
230 const char *vfields[] = {
236 if (local_diff == NULL) {
241 tag =
"diff-removed";
243 if (diff_child == NULL) {
253 for (lpc = 0; (last != NULL) && (lpc <
PCMK__NELEM(vfields)); lpc++) {
257 if (changed || lpc == 2) {
264 if (diff_child == NULL) {
274 for (lpc = 0; next && lpc <
PCMK__NELEM(vfields); lpc++) {
280 for (xmlAttrPtr a = pcmk__xe_first_attr(next); a != NULL; a = a->next) {
283 xmlSetProp(cib, a->name, (
pcmkXmlStr) p_value);
290 xml_create_patchset_v1(xmlNode *source, xmlNode *
target,
bool config,
297 xml_repair_v1_diff(source,
target, patchset, config);
304 xml_create_patchset_v2(xmlNode *source, xmlNode *
target)
312 xmlNode *patchset = NULL;
313 const char *vfields[] = {
325 docpriv =
target->doc->_private;
352 for (gIter = docpriv->
deleted_objs; gIter; gIter = gIter->next) {
363 add_xml_changes_to_patchset(
target, patchset);
369 bool *config_changed,
bool manage_version)
373 xmlNode *patch = NULL;
382 config = is_config_change(
target);
383 if (config_changed) {
384 *config_changed = config;
387 if (manage_version && config) {
394 }
else if (manage_version) {
396 crm_trace(
"Status changed %d - %d %s", format, counter,
412 patch = xml_create_patchset_v1(source,
target, config, FALSE);
415 patch = xml_create_patchset_v2(source,
target);
418 crm_err(
"Unknown patch format: %d", format);
432 if ((patch == NULL) || (source == NULL) || (
target == NULL)) {
442 if ((format > 1) && !with_digest) {
459 xmlNode *child = NULL;
460 xmlNode *added = NULL;
461 xmlNode *removed = NULL;
462 gboolean is_first = TRUE;
464 int add[] = { 0, 0, 0 };
465 int del[] = { 0, 0, 0 };
467 const char *fmt = NULL;
468 const char *digest = NULL;
471 static struct qb_log_callsite *patchset_cs = NULL;
476 if (patchset_cs == NULL) {
477 patchset_cs = qb_log_callsite_get(
function, __FILE__,
"xml-patchset",
478 log_level, __LINE__, 0);
481 if (patchset == NULL) {
494 if ((add[2] != del[2]) || (add[1] != del[1]) || (add[0] != del[0])) {
496 "Diff: --- %d.%d.%d %s", del[0], del[1], del[2], fmt);
498 "Diff: +++ %d.%d.%d %s",
499 add[0], add[1], add[2], digest);
501 }
else if ((patchset != NULL) && (add[0] || add[1] || add[2])) {
503 "%s: Local-only Change: %d.%d.%d",
504 (
function?
function :
""), add[0], add[1], add[2]);
509 xmlNode *change = NULL;
511 for (change = pcmk__xml_first_child(patchset); change != NULL;
512 change = pcmk__xml_next(change)) {
517 }
else if (strcmp(op,
"create") == 0) {
518 int lpc = 0, max = 0;
521 max = strlen(prefix);
522 pcmk__xml_log(log_level, __FILE__,
function, __LINE__, prefix,
526 for (lpc = 2; lpc < max; lpc++) {
530 pcmk__xml_log(log_level, __FILE__,
function, __LINE__, prefix,
536 }
else if (strcmp(op,
"move") == 0) {
538 "+~ %s moved to offset %s", xpath,
541 }
else if (strcmp(op,
"modify") == 0) {
543 GString *buffer_set = NULL;
544 GString *buffer_unset = NULL;
546 for (child = pcmk__xml_first_child(clist); child != NULL;
547 child = pcmk__xml_next(child)) {
555 if (strcmp(op,
"set") == 0) {
561 }
else if (strcmp(op,
"unset") == 0) {
563 g_string_append(buffer_unset,
name);
567 if (buffer_set != NULL) {
570 (
const char *) buffer_set->str);
571 g_string_free(buffer_set, TRUE);
573 if (buffer_unset != NULL) {
576 (
const char *) buffer_unset->str);
577 g_string_free(buffer_unset, TRUE);
580 }
else if (strcmp(op,
"delete") == 0) {
586 "-- %s (%d)", xpath, position);
597 if ((log_level < LOG_DEBUG) || (
function == NULL)) {
602 for (child = pcmk__xml_first_child(removed); child != NULL;
603 child = pcmk__xml_next(child)) {
615 for (child = pcmk__xml_first_child(added); child != NULL;
616 child = pcmk__xml_next(child)) {
629 not_id(xmlAttrPtr attr,
void *user_data)
631 return strcmp((
const char *) attr->name,
XML_ATTR_ID) != 0;
636 process_v1_removals(xmlNode *
target, xmlNode *patch)
638 xmlNode *patch_child = NULL;
639 xmlNode *cIter = NULL;
642 const char *
name = NULL;
643 const char *value = NULL;
645 if ((
target == NULL) || (patch == NULL)) {
649 if (
target->type == XML_COMMENT_NODE) {
657 CRM_CHECK(pcmk__str_eq(crm_element_name(
target), crm_element_name(patch),
665 if ((value != NULL) && (strcmp(value,
"removed:top") == 0)) {
666 crm_trace(
"We are the root of the deletion: %s.id=%s",
name,
id);
676 cIter = pcmk__xml_first_child(
target);
678 xmlNode *target_child = cIter;
680 cIter = pcmk__xml_next(cIter);
682 process_v1_removals(target_child, patch_child);
689 process_v1_additions(xmlNode *
parent, xmlNode *
target, xmlNode *patch)
691 xmlNode *patch_child = NULL;
692 xmlNode *target_child = NULL;
693 xmlAttrPtr xIter = NULL;
695 const char *
id = NULL;
696 const char *
name = NULL;
697 const char *value = NULL;
707 if ((
target == NULL) && (value != NULL)
708 && (strcmp(value,
"added:top") == 0)) {
710 name = crm_element_name(patch);
711 crm_trace(
"We are the root of the addition: %s.id=%s",
name,
id);
715 }
else if (
target == NULL) {
717 name = crm_element_name(patch);
722 if (
target->type == XML_COMMENT_NODE) {
728 CRM_CHECK(pcmk__str_eq(crm_element_name(
target), crm_element_name(patch),
733 for (xIter = pcmk__xe_first_attr(patch); xIter != NULL;
734 xIter = xIter->next) {
735 const char *p_name = (
const char *) xIter->name;
743 for (patch_child = pcmk__xml_first_child(patch); patch_child != NULL;
744 patch_child = pcmk__xml_next(patch_child)) {
747 process_v1_additions(
target, target_child, patch_child);
763 find_patch_xml_node(
const xmlNode *patchset,
int format,
bool added,
764 xmlNode **patch_node)
771 label = added?
"diff-added" :
"diff-removed";
774 if (cib_node != NULL) {
775 *patch_node = cib_node;
779 label = added?
"target" :
"source";
784 crm_warn(
"Unknown patch format: %d", format);
799 const char *vfields[] = {
809 if (!find_patch_xml_node(patchset, format, FALSE, &tmp)) {
815 crm_trace(
"Got %d for del[%s]", del[lpc], vfields[lpc]);
820 if (!find_patch_xml_node(patchset, format, TRUE, &tmp)) {
826 crm_trace(
"Got %d for add[%s]", add[lpc], vfields[lpc]);
843 xml_patch_version_check(
const xmlNode *xml,
const xmlNode *patchset,
int format)
846 bool changed = FALSE;
848 int this[] = { 0, 0, 0 };
849 int add[] = { 0, 0, 0 };
850 int del[] = { 0, 0, 0 };
852 const char *vfields[] = {
860 crm_trace(
"Got %d for this[%s]",
this[lpc], vfields[lpc]);
869 add[2] =
this[2] + 1;
871 del[lpc] =
this[lpc];
877 if (
this[lpc] < del[lpc]) {
878 crm_debug(
"Current %s is too low (%d.%d.%d < %d.%d.%d --> %d.%d.%d)",
879 vfields[lpc],
this[0],
this[1],
this[2],
880 del[0], del[1], del[2], add[0], add[1], add[2]);
883 }
else if (
this[lpc] > del[lpc]) {
884 crm_info(
"Current %s is too high (%d.%d.%d > %d.%d.%d --> %d.%d.%d) %p",
885 vfields[lpc],
this[0],
this[1],
this[2],
886 del[0], del[1], del[2], add[0], add[1], add[2], patchset);
893 if (add[lpc] > del[lpc]) {
899 crm_notice(
"Versions did not change in patch %d.%d.%d",
900 add[0], add[1], add[2]);
904 crm_debug(
"Can apply patch %d.%d.%d to %d.%d.%d",
905 add[0], add[1], add[2],
this[0],
this[1],
this[2]);
919 apply_v1_patchset(xmlNode *xml,
const xmlNode *patchset)
922 int root_nodes_seen = 0;
924 xmlNode *child_diff = NULL;
925 xmlNode *added =
find_xml_node(patchset,
"diff-added", FALSE);
926 xmlNode *removed =
find_xml_node(patchset,
"diff-removed", FALSE);
930 for (child_diff = pcmk__xml_first_child(removed); child_diff != NULL;
931 child_diff = pcmk__xml_next(child_diff)) {
932 CRM_CHECK(root_nodes_seen == 0, rc = FALSE);
933 if (root_nodes_seen == 0) {
934 process_v1_removals(xml, child_diff);
939 if (root_nodes_seen > 1) {
940 crm_err(
"(-) Diffs cannot contain more than one change set... saw %d",
948 xmlNode *child_diff = NULL;
950 for (child_diff = pcmk__xml_first_child(added); child_diff != NULL;
951 child_diff = pcmk__xml_next(child_diff)) {
952 CRM_CHECK(root_nodes_seen == 0, rc = FALSE);
953 if (root_nodes_seen == 0) {
954 process_v1_additions(NULL, xml, child_diff);
960 if (root_nodes_seen > 1) {
961 crm_err(
"(+) Diffs cannot contain more than one change set... saw %d",
974 first_matching_xml_child(
const xmlNode *
parent,
const char *
name,
975 const char *
id,
int position)
977 xmlNode *cIter = NULL;
979 for (cIter = pcmk__xml_first_child(
parent); cIter != NULL;
980 cIter = pcmk__xml_next(cIter)) {
981 if (strcmp((
const char *) cIter->name,
name) != 0) {
984 const char *cid =
ID(cIter);
986 if ((cid == NULL) || (strcmp(cid,
id) != 0)) {
992 if ((cIter->type == XML_COMMENT_NODE)
1017 search_v2_xpath(
const xmlNode *top,
const char *key,
int target_position)
1019 xmlNode *
target = (xmlNode *) top->doc;
1020 const char *current = key;
1030 key_len = strlen(key);
1036 remainder = calloc(key_len,
sizeof(
char));
1039 section = calloc(key_len,
sizeof(
char));
1042 id = calloc(key_len,
sizeof(
char));
1045 tag = calloc(key_len,
sizeof(
char));
1050 rc = sscanf(current,
"/%[^/]%s", section, remainder);
1053 int f = sscanf(section,
"%[^[][@id='%[^']", tag,
id);
1054 int current_position = -1;
1059 if ((rc == 1) && (target_position >= 0)) {
1060 current_position = target_position;
1077 current = remainder;
1081 }
while ((rc == 2) &&
target);
1085 (
path = (
char *) xmlGetNodePath(
target)), key);
1098 typedef struct xml_change_obj_s {
1099 const xmlNode *change;
1104 sort_change_obj_by_position(gconstpointer a, gconstpointer b)
1108 int position_a = -1;
1109 int position_b = -1;
1114 if (position_a < position_b) {
1117 }
else if (position_a > position_b) {
1134 apply_v2_patchset(xmlNode *xml,
const xmlNode *patchset)
1137 const xmlNode *change = NULL;
1138 GList *change_objs = NULL;
1139 GList *gIter = NULL;
1141 for (change = pcmk__xml_first_child(patchset); change != NULL;
1142 change = pcmk__xml_next(change)) {
1143 xmlNode *match = NULL;
1152 crm_trace(
"Processing %s %s", change->name, op);
1155 if (strcmp(op,
"delete") == 0) {
1158 match = search_v2_xpath(xml, xpath, position);
1159 crm_trace(
"Performing %s on %s with %p", op, xpath, match);
1161 if ((match == NULL) && (strcmp(op,
"delete") == 0)) {
1162 crm_debug(
"No %s match for %s in %p", op, xpath, xml->doc);
1165 }
else if (match == NULL) {
1166 crm_err(
"No %s match for %s in %p", op, xpath, xml->doc);
1170 }
else if ((strcmp(op,
"create") == 0) || (strcmp(op,
"move") == 0)) {
1176 change_obj->change = change;
1177 change_obj->match = match;
1179 change_objs = g_list_append(change_objs, change_obj);
1181 if (strcmp(op,
"move") == 0) {
1183 if ((match->parent != NULL) && (match->parent->last != NULL)) {
1184 xmlAddNextSibling(match->parent->last, match);
1188 }
else if (strcmp(op,
"delete") == 0) {
1191 }
else if (strcmp(op,
"modify") == 0) {
1192 xmlNode *attrs = NULL;
1196 if (attrs == NULL) {
1202 for (xmlAttrPtr pIter = pcmk__xe_first_attr(attrs); pIter != NULL;
1203 pIter = pIter->next) {
1204 const char *
name = (
const char *) pIter->name;
1211 crm_err(
"Unknown operation: %s", op);
1217 change_objs = g_list_sort(change_objs, sort_change_obj_by_position);
1219 for (gIter = change_objs; gIter; gIter = gIter->next) {
1221 xmlNode *match = change_obj->match;
1222 const char *op = NULL;
1223 const char *xpath = NULL;
1225 change = change_obj->change;
1230 crm_trace(
"Continue performing %s on %s with %p", op, xpath, match);
1232 if (strcmp(op,
"create") == 0) {
1234 xmlNode *child = NULL;
1235 xmlNode *match_child = NULL;
1237 match_child = match->children;
1240 while ((match_child != NULL)
1242 match_child = match_child->next;
1245 child = xmlDocCopyNode(change->children, match->doc, 1);
1247 crm_trace(
"Adding %s at position %d", child->name, position);
1248 xmlAddPrevSibling(match_child, child);
1250 }
else if (match->last) {
1251 crm_trace(
"Adding %s at position %d (end)",
1252 child->name, position);
1253 xmlAddNextSibling(match->last, child);
1256 crm_trace(
"Adding %s at position %d (first)",
1257 child->name, position);
1259 xmlAddChild(match, child);
1263 }
else if (strcmp(op,
"move") == 0) {
1268 xmlNode *match_child = NULL;
1276 match_child = match->parent->children;
1278 while ((match_child != NULL)
1280 match_child = match_child->next;
1283 crm_trace(
"Moving %s to position %d (was %d, prev %p, %s %p)",
1284 match->name, position,
1286 match->prev, (match_child?
"next":
"last"),
1287 (match_child? match_child : match->parent->last));
1290 xmlAddPrevSibling(match_child, match);
1294 xmlAddNextSibling(match->parent->last, match);
1298 crm_trace(
"%s is already in position %d",
1299 match->name, position);
1303 crm_err(
"Moved %s.%s to position %d instead of %d (%p)",
1304 match->name,
ID(match),
1306 position, match->prev);
1312 g_list_free_full(change_objs, free);
1321 xmlNode *old = NULL;
1324 if (patchset == NULL) {
1331 if (check_version) {
1332 rc =
pcmk_rc2legacy(xml_patch_version_check(xml, patchset, format));
1352 crm_err(
"Unknown patch format: %d", format);
1357 if ((rc ==
pcmk_ok) && (digest != NULL)) {
1358 static struct qb_log_callsite *digest_cs = NULL;
1360 char *new_digest = NULL;
1363 if (digest_cs == NULL) {
1364 digest_cs = qb_log_callsite_get(__func__, __FILE__,
"diff-digest",
1371 crm_info(
"v%d digest mis-match: expected %s, calculated %s",
1372 format, digest, new_digest);
1375 if ((digest_cs != NULL) && digest_cs->targets) {
1382 ((digest_cs != NULL)? digest_cs->targets : 0));
1386 crm_trace(
"v%d digest matched: expected %s, calculated %s",
1387 format, digest, new_digest);
1399 xmlNode *child = NULL;
1404 for (child = pcmk__xml_first_child(a_node); child != NULL;
1405 child = pcmk__xml_next(child)) {
1413 xmlNode *tmp1 = NULL;
1430 if ((added->children == NULL) && (removed->children == NULL)) {
1439 subtract_xml_comment(xmlNode *
parent, xmlNode *left, xmlNode *right,
1443 CRM_CHECK(left->type == XML_COMMENT_NODE,
return NULL);
1445 if ((right == NULL) || !pcmk__str_eq((
const char *)left->content,
1446 (
const char *)right->content,
1448 xmlNode *deleted = NULL;
1461 gboolean full, gboolean *changed,
const char *marker)
1463 gboolean
dummy = FALSE;
1464 xmlNode *diff = NULL;
1465 xmlNode *right_child = NULL;
1466 xmlNode *left_child = NULL;
1467 xmlAttrPtr xIter = NULL;
1469 const char *
id = NULL;
1470 const char *
name = NULL;
1471 const char *value = NULL;
1472 const char *right_val = NULL;
1474 if (changed == NULL) {
1482 if (left->type == XML_COMMENT_NODE) {
1483 return subtract_xml_comment(
parent, left, right, changed);
1487 if (right == NULL) {
1488 xmlNode *deleted = NULL;
1490 crm_trace(
"Processing <%s id=%s> (complete copy)",
1491 crm_element_name(left),
id);
1499 name = crm_element_name(left);
1501 CRM_CHECK(pcmk__str_eq(crm_element_name(left), crm_element_name(right),
1507 if ((value != NULL) && (strcmp(value,
"removed:top") == 0)) {
1508 crm_trace(
"We are the root of the deletion: %s.id=%s",
name,
id);
1517 for (left_child = pcmk__xml_first_child(left); left_child != NULL;
1518 left_child = pcmk__xml_next(left_child)) {
1519 gboolean child_changed = FALSE;
1524 if (child_changed) {
1533 xmlAttrPtr pIter = NULL;
1535 for (pIter = pcmk__xe_first_attr(left); pIter != NULL;
1536 pIter = pIter->next) {
1537 const char *p_name = (
const char *)pIter->name;
1538 const char *p_value = pcmk__xml_attr_value(pIter);
1548 for (xIter = pcmk__xe_first_attr(left); xIter != NULL;
1549 xIter = xIter->next) {
1550 const char *prop_name = (
const char *) xIter->name;
1551 xmlAttrPtr right_attr = NULL;
1564 right_attr = xmlHasProp(right, (
pcmkXmlStr) prop_name);
1566 nodepriv = right_attr->_private;
1574 xmlAttrPtr pIter = NULL;
1576 for (pIter = pcmk__xe_first_attr(left); pIter != NULL;
1577 pIter = pIter->next) {
1578 const char *p_name = (
const char *) pIter->name;
1579 const char *p_value = pcmk__xml_attr_value(pIter);
1596 if (strcmp(left_value, right_val) == 0) {
1602 xmlAttrPtr pIter = NULL;
1604 crm_trace(
"Changes detected to %s in <%s id=%s>", prop_name,
1605 crm_element_name(left),
id);
1606 for (pIter = pcmk__xe_first_attr(left); pIter != NULL;
1607 pIter = pIter->next) {
1608 const char *p_name = (
const char *) pIter->name;
1609 const char *p_value = pcmk__xml_attr_value(pIter);
1617 crm_trace(
"Changes detected to %s (%s -> %s) in <%s id=%s>",
1618 prop_name, left_value, right_val,
1619 crm_element_name(left),
id);
1630 }
else if (!full && (
id != NULL)) {
1646 int root_nodes_seen = 0;
1647 static struct qb_log_callsite *digest_cs = NULL;
1651 xmlNode *child_diff = NULL;
1653 xmlNode *removed =
find_xml_node(diff,
"diff-removed", FALSE);
1655 CRM_CHECK(new_xml != NULL,
return FALSE);
1656 if (digest_cs == NULL) {
1657 digest_cs = qb_log_callsite_get(__func__, __FILE__,
"diff-digest",
1662 for (child_diff = pcmk__xml_first_child(removed); child_diff != NULL;
1663 child_diff = pcmk__xml_next(child_diff)) {
1665 if (root_nodes_seen == 0) {
1672 if (root_nodes_seen == 0) {
1675 }
else if (root_nodes_seen > 1) {
1676 crm_err(
"(-) Diffs cannot contain more than one change set... saw %d",
1681 root_nodes_seen = 0;
1684 xmlNode *child_diff = NULL;
1686 for (child_diff = pcmk__xml_first_child(added); child_diff != NULL;
1687 child_diff = pcmk__xml_next(child_diff)) {
1689 if (root_nodes_seen == 0) {
1696 if (root_nodes_seen > 1) {
1697 crm_err(
"(+) Diffs cannot contain more than one change set... saw %d",
1701 }
else if (
result && (digest != NULL)) {
1702 char *new_digest = NULL;
1708 crm_info(
"Digest mis-match: expected %s, calculated %s",
1709 digest, new_digest);
1712 crm_trace(
"%p %.6x", digest_cs, digest_cs ? digest_cs->targets : 0);
1713 if ((digest_cs != NULL) && digest_cs->targets) {
1720 crm_trace(
"Digest matched: expected %s, calculated %s",
1721 digest, new_digest);
#define CRM_CHECK(expr, failure_action)
#define crm_notice(fmt, args...)
G_GNUC_INTERNAL void pcmk__xml_log(int log_level, const char *file, const char *function, int line, const char *prefix, const xmlNode *data, int depth, int options)
void patchset_process_digest(xmlNode *patch, xmlNode *source, xmlNode *target, bool with_digest)
#define XML_ATTR_NUMUPDATES
int pcmk_rc2legacy(int rc)
xmlNode * first_named_child(const xmlNode *parent, const char *name)
G_GNUC_INTERNAL int pcmk__xml_position(const xmlNode *xml, enum xml_private_flags ignore_if_set)
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
Create an XML attribute with specified name and integer value.
xmlNode * find_xml_node(const xmlNode *root, const char *search_path, gboolean must_find)
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
void log_data_element(int log_level, const char *file, const char *function, int line, const char *prefix, const xmlNode *data, int depth, gboolean formatted)
void pcmk__add_separated_word(GString **list, size_t init_size, const char *word, const char *separator)
#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...)
void pcmk__g_strcat(GString *buffer,...) G_GNUC_NULL_TERMINATED
#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(const xmlNode *haystack, const xmlNode *needle, bool exact)
const xmlChar * pcmkXmlStr
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)
xmlNode * diff_xml_object(xmlNode *old, xmlNode *new, gboolean suppress)
pcmk__action_result_t result
#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
bool xml_patch_versions(const xmlNode *patchset, int add[3], int del[3])
void save_xml_to_file(xmlNode *xml, const char *desc, const char *filename)
GString * pcmk__element_xpath(const xmlNode *xml)
#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...)