xml_root_node = wrapUpdate(new_xml_node, section_name, "update");
xml_root_node = wrapUpdate(new_xml_node, section_name, CRM_OPERATION_UPDATE);
handleModify(void){	CRM_DEBUG("Modifying existing CIB object");	if (obj_type == NULL) {		cl_log(LOG_ERR,		       "You must specify an object type.  Use the -o option.");		return NULL;		}	xmlNodePtr xml_root_node, new_xml_node = NULL;	const char *section_name = NULL;	if (strcmp("node", obj_type) == 0) {		section_name = XML_CIB_TAG_NODES;		CRM_DEBUG3("Modifing existing %s (%s) object",			   section_name,			   id);				if (id == NULL) return NULL;				new_xml_node = create_xml_node(NULL, XML_CIB_TAG_NODE);		set_xml_property_copy(new_xml_node, XML_ATTR_ID, id);		if (subtype != NULL)			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_NODETYPE,					      subtype);			} else if (strcmp("resource", obj_type) == 0) {		section_name = XML_CIB_TAG_RESOURCES;		CRM_DEBUG3("Modifing existing %s (%s) object",			   section_name,			   id);		if (id == NULL) return NULL;		new_xml_node = create_xml_node(NULL, XML_CIB_TAG_RESOURCE);		set_xml_property_copy(new_xml_node, XML_ATTR_ID, id);		if (subtype != NULL)			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_RESTYPE,					      subtype);		if (description != NULL)			set_xml_property_copy(new_xml_node,					      XML_ATTR_DESC,					      description);		if (max_instances != NULL)			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_MAXINSTANCE,					      max_instances);		if (priority != NULL)			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_PRIORITY,					      priority);		if (res_timeout != NULL)			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_RESTIMEOUT,					      res_timeout);		set_node_tstamp(new_xml_node);		// TODO: need to handle add/remove of allowed nodes		// add Nodes To Resources		if (list_del->num_items > 0) {			str_list_t *iter = list_del;			while (list_del != list_del_last) {				char *name = NULL;				char *value = NULL;				if (decodeNVpair(iter->value, '=',						 &name,						 &value)) {										xmlNodePtr node_entry =						create_xml_node(							NULL,							XML_CIB_ATTR_NODEREF);					set_xml_property_copy(						node_entry,						XML_ATTR_ID,						name);										set_xml_property_copy(						node_entry,						XML_CIB_ATTR_WEIGHT,						value);										set_node_tstamp(node_entry);										set_xml_property_copy(						node_entry,						XML_CIB_ATTR_ACTION,						"del");										xmlAddChild(new_xml_node,						    node_entry);				}				iter = iter->next;			}		}		// add Nodes To Resources		if (list_add->num_items > 0) {			str_list_t *iter = list_add;			while (list_add != list_add_last) {				char *name = NULL;				char *value = NULL;				if (decodeNVpair(iter->value, '=',						 &name,						 &value)) {										xmlNodePtr node_entry =						create_xml_node(							NULL,							XML_CIB_ATTR_NODEREF);					set_xml_property_copy(node_entry,							      XML_ATTR_ID,							      name);										set_xml_property_copy(						node_entry,						XML_CIB_ATTR_WEIGHT,						value);										set_node_tstamp(node_entry);										set_xml_property_copy(						node_entry,						XML_CIB_ATTR_ACTION,						"add");										xmlAddChild(new_xml_node,						    node_entry);				}				iter = iter->next;			}		}	} else if (strcmp("constraint", obj_type) == 0) {		section_name = XML_CIB_TAG_CONSTRAINTS;		CRM_DEBUG3("Modifing existing %s (%s) object", section_name, id);		if (id == NULL)			return NULL;		new_xml_node = create_xml_node(NULL,					       XML_CIB_TAG_CONSTRAINT);		set_xml_property_copy(new_xml_node,				      XML_ATTR_ID,				      id);		if (subtype != NULL)			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_CONTYPE,					      subtype);		if (description != NULL)			set_xml_property_copy(new_xml_node,					      XML_ATTR_DESC,					      description);		if (resource[0] != NULL)			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_RESID1,					      resource[0]);		if (resource[1] != NULL)			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_RESID2,					      resource[1]);		if (clear != NULL)			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_CLEAR,					      clear);		// del Name Value pairs To constraint s		if (list_del->num_items > 0) {			str_list_t *iter = list_del;			while (list_del != list_del_last) {				char *name = NULL;				char *value = NULL;				if (decodeNVpair(iter->value, '=', &name, &value)) {					xmlNodePtr node_entry =						create_xml_node(							NULL,							XML_CIB_TAG_NVPAIR);					set_xml_property_copy(						node_entry,						XML_ATTR_ID,						name);					set_xml_property_copy(						node_entry,						XML_CIB_ATTR_VARVALUE,						value);					set_xml_property_copy (						node_entry,						XML_CIB_ATTR_ACTION,						"del");					xmlAddChild(new_xml_node,						    node_entry);				}				iter = iter->next;			}		}		// add Name Value pairs To constraint s		if (list_add->num_items > 0) {			str_list_t *iter = list_add;			while (list_add != list_add_last) {				char *name = NULL;				char *value = NULL;				if (decodeNVpair(iter->value, '=', &name, &value)) {					xmlNodePtr node_entry =						create_xml_node(							NULL,							XML_CIB_ATTR_NODEREF);					set_xml_property_copy(						node_entry,						XML_ATTR_ID,						name);					set_xml_property_copy(						node_entry,						XML_CIB_ATTR_VARVALUE,						value);					set_xml_property_copy(						node_entry,						XML_CIB_ATTR_ACTION,						"add");					xmlAddChild(						new_xml_node,						node_entry);				}				iter = iter->next;			}		}		set_node_tstamp(new_xml_node);	} else {		cl_log(LOG_INFO,		       "Object Type (%s) not supported",		       obj_type);		return NULL;	}	// create the cib request	xml_root_node = wrapUpdate(new_xml_node, section_name, "update");	CRM_DEBUG("Creation of modify request complete");	return xml_root_node;}