Blame SOURCES/bz720543-pcmk-cib_allow_values_to_be_added_updated_and_removed_in_a_single_update.patch

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