commit fc48cd10b4daca72217d7be42cd8eb71984d454a Author: Andrew Beekhof Date: Fri Aug 30 17:51:06 2013 +1000 Feature: cib: Allow values to be added/updated and removed in a single update (cherry picked from commit 9819039f15277c05011c6100934167227cfd135d) Conflicts: attrd/commands.c diff --git a/include/crm/cib.h b/include/crm/cib.h index 7a694ac..5ff57eb 100644 --- a/include/crm/cib.h +++ b/include/crm/cib.h @@ -63,6 +63,7 @@ enum cib_call_options { cib_discard_reply = 0x00000010, cib_no_children = 0x00000020, cib_xpath_address = 0x00000040, + cib_mixed_update = 0x00000080, cib_scope_local = 0x00000100, cib_dryrun = 0x00000200, cib_sync_call = 0x00001000, diff --git a/lib/cib/cib_ops.c b/lib/cib/cib_ops.c index 4e1196b..26ae373 100644 --- a/lib/cib/cib_ops.c +++ b/lib/cib/cib_ops.c @@ -354,6 +354,23 @@ cib_process_modify(const char *op, int options, const char *section, xmlNode * r } } + if(options & cib_mixed_update) { + int max = 0, lpc; + xmlXPathObjectPtr xpathObj = xpath_search(*result_cib, "//@__delete__"); + + if (xpathObj) { + max = numXpathResults(xpathObj); + crm_log_xml_info(*result_cib, "Mixed result"); + } + + for (lpc = 0; lpc < max; lpc++) { + xmlNode *match = getXpathResult(xpathObj, lpc); + crm_debug("Destroying %s", (char *)xmlGetNodePath(match)); + free_xml(match); + } + + freeXpathObject(xpathObj); + } return pcmk_ok; }