ClusterLabs/pacemaker — pull request #542 by gao-yan (2014-06-12 12:58:18+00:00)
Title: Fix: xml: Prevent incorrect xml diffs from corrupting the cib

This is found on v1.1.11 by developer's experiment:

cibadmin --query -o resources > cib-old.xml
cibadmin --query -o resources > cib-new.xml
vim cib-new.xml # change Started to Stopped

# generate patch
crm_diff --original cib-old.xml --new cib-new.xml > cib-diff.xml

Resulting patch:

# cat cib-diff.xml

Applying this patch succeeds:
# cibadmin --patch --scope resources --xml-file cib-diff.xml
# echo #?
0

But the resulting CIB is broken: The patch has been applied on the root tag:

# cibadmin -Q --xpath "/cib/group"

-- As we know, in v1.1.12, it starts using xml_apply_patchset*() and __*_xml_object() functions for applying cib diffs. While it seems to still make sense add these for subtract_xml_object() and add_xml_object().