set_xml_property_copy(options, XML_ATTR_OP, "update");
processCibRequest(xmlNodePtr command){	const char *status         = "failed";	const char *op             = NULL;	const char *verbose        = NULL;	const char *section        = NULL;	const char *output_section = NULL;	xmlNodePtr failed          = NULL;	xmlNodePtr cib_answer      = NULL;	xmlNodePtr cib_section     = NULL;	xmlNodePtr options	   = NULL;	gboolean update_the_cib = FALSE;	int cib_update_op = CIB_OP_NONE;	FNIN();		options = find_xml_node(command, XML_TAG_OPTIONS);		op         = xmlGetProp(options, XML_ATTR_OP);	verbose    = xmlGetProp(options, XML_ATTR_VERBOSE);	section    = xmlGetProp(options, XML_ATTR_FILTER_TYPE);	failed     = create_xml_node(NULL, XML_TAG_FAILED);//	cib_answer = create_xml_node(NULL, XML_MSG_TAG);//	add_node_copy(cib_answer, options);	// sanity checks	if (command == NULL) {		cl_log(LOG_INFO,		       "The (%s) received an empty message",		       CRM_SYSTEM_CIB);		FNRET(NULL);	}	if(op == NULL)		cl_log(LOG_WARNING, "No operation specified\n");	else if(strcmp("noop", op) == 0) ;	else if (strcmp("ping", op) == 0) {		CRM_DEBUG("Handling a ping");		status = "ok";		cib_answer = createPingAnswerFragment(CRM_SYSTEM_CIB,						      status);	} else if (strcmp("query", op) == 0) {		CRM_DEBUG2("Handling a query for section=%s of the cib",			   section);		/* force a pick-up of the relevant section before		 * returning		 */		verbose = "true"; 		status = "ok";			} else if (strcmp("erase", op) == 0) {		xmlNodePtr new_cib = createEmptyCib();		if (activateCibXml(new_cib) < 0)			status = "erase of CIB failed";		else			status = "ok";			} else if (strcmp("create", op) == 0) {		update_the_cib = TRUE;		cib_update_op = CIB_OP_ADD;			} else if (strcmp("update", op) == 0) {		update_the_cib = TRUE;		cib_update_op = CIB_OP_MODIFY;			} else if (strcmp("delete", op) == 0) {		update_the_cib = TRUE;		cib_update_op = CIB_OP_DELETE;	} else if (strcmp("forward", op) == 0) {		/* force a pick-up of the /entire/ CIB before		 * returning		 */		section = NULL;		verbose = "true"; 		status = "ok";		/* change the op to "store" so that when a reply is created		 * the other end will do the right thing with it.		 * and change sysfrom to cib so it gets sent there.		 */		// cheat		set_xml_property_copy(options, XML_ATTR_OP, "store");	} else if (strcmp("store", op) == 0) {		CRM_DEBUG("Storing DC copy of the cib");		xmlNodePtr tmpCib = copy_xml_node_recursive(get_the_CIB(), 1);		/* replace the following sections verbatum */		replace_section(XML_CIB_TAG_NODES,       tmpCib, command);		replace_section(XML_CIB_TAG_RESOURCES,   tmpCib, command);		replace_section(XML_CIB_TAG_CONSTRAINTS, tmpCib, command);		/* incorporate the info from the DC and then send it back */		updateList(tmpCib, command, failed, cib_update_op,			   XML_CIB_TAG_STATUS);				if (activateCibXml(tmpCib) < 0)			status = "dc update failed";		else			status = "ok";		/* Force a pick-up of the merged status section and send it		 * back to the DC		 */		verbose = "true"; 		section = XML_CIB_TAG_STATUS;		/* change the op to "update" so that when a reply is created		 * the other end will do the right thing with it.		 */		// cheat		set_xml_property_copy(options, XML_ATTR_OP, "update");			} else if (strcmp("replace", op) == 0) {		CRM_DEBUG2("Replacing section=%s of the cib", section);		xmlNodePtr tmpCib = find_xml_node(command, XML_TAG_CIB);				if (strcmp("all", section) == 0) {			replace_section(XML_CIB_TAG_NODES,    tmpCib,command);			replace_section(XML_CIB_TAG_RESOURCES,tmpCib,command);			replace_section(XML_CIB_TAG_STATUS,   tmpCib,command);			replace_section(XML_CIB_TAG_CONSTRAINTS,tmpCib,command);		} else {			replace_section(section, tmpCib, command);		}		if (activateCibXml(tmpCib) < 0)				status = "replacement failed";		else			status = "ok";	} else {		status = "not supported";		cl_log(LOG_ERR, "Action [%s] is not supported by the CIB", op);	}    	if (update_the_cib) {		CRM_DEBUG("Backing up CIB");		xmlNodePtr tmpCib = copy_xml_node_recursive(get_the_CIB(), 1);		CRM_DEBUG("Updating temporary CIB");		CRM_DEBUG3("Updating section=%s of the cib (op=%s)",			   section, op);			// should we be doing this?			// do logging						// make changes to a temp copy then activate		if(section == NULL) {			cl_log(LOG_ERR, "No section specified in %s",			       XML_ATTR_FILTER_TYPE);			status = "no section specified";		} else if(strcmp("all", section) == 0			  && cib_update_op == CIB_OP_DELETE) {			// delete			/* order is very important here */			updateList(tmpCib, command, failed, cib_update_op,				   XML_CIB_TAG_STATUS);			updateList(tmpCib, command, failed, cib_update_op,				   XML_CIB_TAG_CONSTRAINTS);			updateList(tmpCib, command, failed, cib_update_op,				   XML_CIB_TAG_RESOURCES);			updateList(tmpCib, command, failed, cib_update_op,				   XML_CIB_TAG_NODES);		} else if(strcmp("all", section) == 0) {			/* order is very important here */			updateList(tmpCib, command, failed, cib_update_op,				   XML_CIB_TAG_NODES);			updateList(tmpCib, command, failed, cib_update_op,				   XML_CIB_TAG_RESOURCES);			updateList(tmpCib, command, failed, cib_update_op,				   XML_CIB_TAG_CONSTRAINTS);			updateList(tmpCib, command, failed, cib_update_op,				   XML_CIB_TAG_STATUS);		} else {			status = updateList(tmpCib, command, failed, cib_update_op, section);		}				CRM_DEBUG("Activating temporary CIB");		if (activateCibXml(tmpCib) < 0)			status = "update activation failed";		else if (failed->children != NULL)			status = "some updates failed";		else			status = "ok";		CRM_DEBUG2("CIB update status: %s", status);	}	output_section = section;	CRM_DEBUG2("Playing with cib: %p", get_the_CIB());		/* dont de-allocate cib_section, its the real thing */	if (failed->children != NULL || strcmp("ok", status) != 0) {		output_section = "all";		cib_section = get_object_root(NULL, get_the_CIB());	} else if (strcmp("true", verbose) == 0) {		cib_section = get_object_root(output_section, get_the_CIB());	}	if(cib_section != NULL) {		cib_answer = createCibFragmentAnswer(output_section,						     cib_section,						     failed);	}    /* 	set_xml_property_copy(cib_answer, XML_ATTR_SECTION, section); */ 	set_xml_property_copy(options, XML_ATTR_RESULT, status);	free_xml(failed);	FNRET(cib_answer);}