xml_root_node = wrapUpdate(new_xml_node, section_name, "create");
xml_root_node = wrapUpdate(new_xml_node, section_name, CRM_OPERATION_CREATE);
handleCreate(void){	CRM_DEBUG2("Creating new CIB object (%s)", obj_type);	if (obj_type == NULL) {		cl_log(LOG_ERR,		       "You must specify an object type.  Use the -o option.");		return NULL;		// error	}	xmlNodePtr xml_root_node, new_xml_node;	const char *section_name = NULL;	if (strcmp("node", obj_type) == 0) {		section_name = XML_CIB_TAG_NODES;		CRM_DEBUG2("Creating new %s object", section_name);		if (id == NULL || description == NULL)			return NULL;		new_xml_node = newHaNode(id, subtype);		if (description != NULL)			set_xml_property_copy(new_xml_node,					      XML_ATTR_DESC,					      description);	} else if (strcmp("resource", obj_type) == 0) {		section_name = XML_CIB_TAG_RESOURCES;		CRM_DEBUG2("Creating new %s object", section_name);		if (id == NULL || subtype == NULL || description == NULL)			return NULL;		new_xml_node =			newResource(id, subtype, description, 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);		// 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;			}		}	}	// move somewhere else... this could get big	else if (strcmp("constraint", obj_type) == 0) {		section_name = XML_CIB_TAG_CONSTRAINTS;		CRM_DEBUG2("Creating new %s object", section_name);		if (subtype == NULL) {			cl_log(LOG_ERR,			       "You must specify a subtype for %s objects.  Use the -s option.",			       section_name);			return NULL;		}		if (strcmp(CIB_VAL_CONTYPE_BLOCK, subtype) == 0) {			CRM_DEBUG3("Creating new %s (%s) object", section_name,				   CIB_VAL_CONTYPE_BLOCK);			if (clear == NULL			    || description == NULL			    || resource[0] == NULL			    || id == NULL) {				cl_log(LOG_ERR,				       "Not all required args were filled in."				       "  -c [%s] -D [%s] -r [%s] -i [%s] ",				       clear, description, resource[0], id);				return NULL;			}			id =(char *) ha_malloc(256 *(sizeof(char)));			sprintf(id, "failed-%s-%s", node, resource[0]);			new_xml_node = newConstraint(id);			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_CONTYPE,					      CIB_VAL_CONTYPE_BLOCK);			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_RESID1,					      resource[0]);			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_CLEAR,					      clear);			xmlNodePtr node_entry = create_xml_node(				NULL,				XML_CIB_TAG_NVPAIR);						set_xml_property_copy(node_entry,					      XML_ATTR_ID,					      "blockHost");			set_xml_property_copy(node_entry,					      XML_CIB_ATTR_VARVALUE,					      node);			set_xml_property_copy(node_entry,					      XML_CIB_ATTR_ACTION,					      "add");						xmlAddChild(new_xml_node, node_entry);		} else if (strcmp(CIB_VAL_CONTYPE_VAR, subtype) == 0) {			CRM_DEBUG3("Creating new %s (%s) object",				   section_name,				   CIB_VAL_CONTYPE_VAR);			if (list_add->num_items == 1			    || description == NULL			    || id == NULL			    || num_resources != 1) {				cl_log(LOG_ERR,				       "Not all required args were filled in."				       "  -a [# %d] -D [%s] -r [# %d] -i [%s] ",				       list_add->num_items,				       description,				       num_resources,				       id);				return NULL;			}			new_xml_node = newConstraint(id);			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_CONTYPE,					      subtype);			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_RESID1,					      resource[0]);						// 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_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,								      "add");						xmlAddChild(new_xml_node, node_entry);					}					iter = iter->next;				}			}		} else {			CRM_DEBUG3("Creating new %s (%s)[any] object",				   section_name,				   subtype);			if (id == NULL || description == NULL || num_resources != 2) {				cl_log(LOG_ERR,				       "Not all required args were filled in."				       "  -i [%s] -D [%s] -r [# %d] ",				       id, description, num_resources);				return NULL;			}			new_xml_node = newConstraint(id);			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_CONTYPE,					      subtype);			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_RESID1,					      resource[0]);			set_xml_property_copy(new_xml_node,					      XML_CIB_ATTR_RESID2,					      resource[1]);		}		if (description != NULL)			set_xml_property_copy(new_xml_node,					      XML_ATTR_DESC,					      description);	} else {		cl_log(LOG_INFO,		       "Object Type (%s) not supported",		       obj_type);		return NULL;	}	CRM_DEBUG("Object creation complete");	// create the cib request	xml_root_node = wrapUpdate(new_xml_node, section_name, "create");	return xml_root_node;}