if(equiv_node != NULL) {
if(equiv_node == NULL) { crm_debug("No node to update, creating %s instead", new_obj->name); if(parent == NULL) { crm_warn("Failed to add <%s id=%s> (NULL parent)", object_name, object_id); return CIBRES_FAILED_NODECOPY;  } else if(add_node_copy(parent, new_obj) == NULL) { crm_warn("Failed to add  <%s id=%s>", object_name, object_id); return CIBRES_FAILED_NODECOPY; }  } else { crm_verbose("Found node <%s id=%s> to update", object_name, object_id);
update_cib_object(xmlNodePtr parent, xmlNodePtr new_obj, gboolean force){	const char *object_name = NULL;	const char *object_id = NULL;	xmlNodePtr equiv_node = NULL;	xmlNodePtr children = NULL;	int result = CIBRES_OK;		if(new_obj == NULL) {		return CIBRES_FAILED_NOOBJECT;	} else if(parent == NULL) {		return CIBRES_FAILED_NOPARENT;	}	object_name = new_obj->name;	object_id = xmlGetProp(new_obj, XML_ATTR_ID);	children = new_obj->children;		if(object_id == NULL) {		// placeholder object		equiv_node = find_xml_node(parent, object_name);	} else {		equiv_node = find_entity(parent, object_name, object_id,FALSE);	}		if(equiv_node != NULL) {		const char *replace = xmlGetProp(new_obj, "replace");				if(force == FALSE) {			const char *ts_existing  = NULL;			const char *ts_new       = NULL;			/* default to false?			 *			 * that would mean every node would have to			 * carry a timestamp			 */			gboolean is_update = TRUE;						ts_existing  = TSTAMP(equiv_node);			ts_new       = TSTAMP(new_obj);						if(ts_new != NULL && ts_existing != NULL) {				is_update = (strcmp(ts_new, ts_existing) > 0);			}						if(is_update == FALSE) {				crm_err(				       "Ignoring old update to <%s id=\"%s\">"				       "(%s vs. %s)",				       object_name, object_id,				       ts_new, ts_existing);				return CIBRES_FAILED_STALE;			}		}		if(replace != NULL) {			xmlNodePtr remove = find_xml_node(equiv_node, replace);			if(remove != NULL) {				xmlUnlinkNode(remove);				remove->doc = NULL;				free_xml(remove);				}			xmlUnsetProp(new_obj, "replace");		}				if(safe_str_eq(XML_CIB_TAG_STATE, object_name)){			update_node_state(equiv_node, new_obj);					} else {			copy_in_properties(equiv_node, new_obj);					}				while(children != NULL) {			int tmp_result =				update_cib_object(equiv_node, children,force);			// only the first error is likely to be interesting			if(tmp_result != CIBRES_OK			   && result == CIBRES_OK) {				result = tmp_result;			}			children = children->next;		}			} else if(add_node_copy(parent, new_obj) == NULL) {		return CIBRES_FAILED_NODECOPY;			}		return result;}