コード例 #1
0
ファイル: mapnotify.c プロジェクト: AnchorCat/libqb
int
main(void)
{
	qb_map_t *trie;
	int *i1, *i2, *i3;
	qb_map_iter_t *iter;
	const char *key;
	void *val;
	uint32_t revents = (QB_MAP_NOTIFY_DELETED |
			    QB_MAP_NOTIFY_REPLACED |
			    QB_MAP_NOTIFY_INSERTED |
			    QB_MAP_NOTIFY_RECURSIVE);

	trie = qb_trie_create();
	assert(trie != NULL);
	qb_trie_dump(trie);
	add_cs_keys(trie);

	i1 = malloc(sizeof(int));
	assert(i1 != NULL);
	*i1 = 1;

	i2 = malloc(sizeof(int));
	assert(i2 != NULL);
	*i2 = 2;

	i3 = malloc(sizeof(int));
	assert(i3 != NULL);
	*i3 = 3;

	qb_map_notify_add(trie, NULL, notify_fn, QB_MAP_NOTIFY_FREE, NULL);

	qb_map_put(trie, "test.key1", i1);
	qb_map_put(trie, "test.key2", i2);

	qb_map_notify_add(trie, "test.", notify_fn, revents, NULL);
	qb_trie_dump(trie);

	qb_map_put(trie, "test.key1", i3);

	iter = qb_map_pref_iter_create(trie, "test.");
	while ((key = qb_map_iter_next(iter, &val)) != NULL) {
		fprintf(stderr, "Iter %s [%d]\n", key, *(int *)val);
		qb_map_rm(trie, key);
	}
	qb_map_iter_free(iter);
	qb_map_notify_del_2(trie, "test.", notify_fn, revents, NULL);
	qb_map_destroy(trie);

	return (0);
}
コード例 #2
0
ファイル: corosync-notifyd.c プロジェクト: inouekazu/corosync
static void _cs_cmap_link_added_removed (
	cmap_handle_t cmap_handle_c,
	cmap_track_handle_t track_handle,
	int32_t event,
	const char *key_name,
	struct cmap_notify_value new_value,
	struct cmap_notify_value old_value,
	void *user_data)
{
	struct track_item *track_item;

	/* Add/remove a tracker for a new/removed knet link */
	if (strstr(key_name, ".connected")) {
		if (event == CMAP_TRACK_ADD) {

			track_item = malloc(sizeof(struct track_item));
			if (!track_item) {
				return;
			}
			cmap_track_add(stats_handle, key_name, CMAP_TRACK_MODIFY, _cs_cmap_link_faulty_key_changed, NULL, &track_handle);

			strcpy(track_item->key_name, key_name);
			track_item->track_handle = track_handle;
			qb_map_put(tracker_map, track_item->key_name, track_item);
		} else {
			track_item = qb_map_get(tracker_map, key_name);
			if (track_item) {
				cmap_track_delete(stats_handle, track_item->track_handle);
				qb_map_rm(tracker_map, track_item->key_name);
				free(track_item);
			}
		}
	}
}
コード例 #3
0
ファイル: cape.c プロジェクト: sdake/pacemaker-cloud
static void
configure_resource_create(xmlNode *rsc_node, xmlNode *params_node, struct assembly *assembly)
{
	struct resource *resource;
	char *name;
	/* 6 = rsc__ and terminator */
	char resource_name[ASSEMBLY_NAME_MAX + RESOURCE_NAME_MAX + 6];

	qb_enter();

	resource = calloc(1, sizeof (struct resource));

	name = (char*)xmlGetProp(rsc_node, BAD_CAST "name");
	snprintf(resource_name, ASSEMBLY_NAME_MAX + RESOURCE_NAME_MAX + 6,
		"cfg_%s_%s", assembly->name, name);
	resource->name = strdup(resource_name);
	resource->type = strdup("script_runner");
	resource->rclass = strdup("ocf");
	resource->rprovider = strdup("pacemaker-cloud");

	recover_init(&resource->recover,
		    "-1", "-1",
		    resource_recover_restart,
		    resource_recover_escalate,
		    resource_state_change_event);
	resource->recover.instance = resource;

	resource->assembly = assembly;
	qb_map_put(assembly->resource_map, resource->name, resource);

	resource_add_ref_params(params_node, resource);

	qb_leave();
}
コード例 #4
0
ファイル: pcmk_pe.c プロジェクト: sdake/pacemaker-cloud
static void
dup_attr(gpointer key, gpointer value, gpointer user_data)
{
	qb_enter();

	qb_map_put(user_data, strdup(key), strdup(value));

	qb_leave();
}
コード例 #5
0
ファイル: icmap.c プロジェクト: bhansaliakhil/corosync
cs_error_t icmap_fast_adjust_int(
	const char *key_name,
	int32_t step)
{
	struct icmap_item *item;
	cs_error_t err = CS_OK;

	if (key_name == NULL) {
		return (CS_ERR_INVALID_PARAM);
	}

	item = qb_map_get(icmap_map, key_name);
	if (item == NULL) {
		return (CS_ERR_NOT_EXIST);
	}

	switch (item->type) {
	case ICMAP_VALUETYPE_INT8:
	case ICMAP_VALUETYPE_UINT8:
		*(uint8_t *)item->value += step;
		break;
	case ICMAP_VALUETYPE_INT16:
	case ICMAP_VALUETYPE_UINT16:
		*(uint16_t *)item->value += step;
		break;
	case ICMAP_VALUETYPE_INT32:
	case ICMAP_VALUETYPE_UINT32:
		*(uint32_t *)item->value += step;
		break;
	case ICMAP_VALUETYPE_INT64:
	case ICMAP_VALUETYPE_UINT64:
		*(uint64_t *)item->value += step;
		break;
	case ICMAP_VALUETYPE_FLOAT:
	case ICMAP_VALUETYPE_DOUBLE:
	case ICMAP_VALUETYPE_STRING:
	case ICMAP_VALUETYPE_BINARY:
		err = CS_ERR_INVALID_PARAM;
		break;
	}

	if (err == CS_OK) {
		qb_map_put(icmap_map, item->key_name, item);
	}

	return (err);
}
コード例 #6
0
ファイル: cape.c プロジェクト: sdake/pacemaker-cloud
static void
resource_add_ref_params(xmlNode *params_node, struct resource *r)
{
	xmlNode *child_node;
	xmlNode *ref_node;
	struct reference_param *p;

	qb_enter();

	if (params_node == NULL || params_node->children == NULL) {
		return;
	}

	for (child_node = params_node->children; child_node;
		child_node = child_node->next) {
		if (child_node->type != XML_ELEMENT_NODE ||
		    strcmp((char*)child_node->name, "parameter") != 0) {
			continue;
		}

		for (ref_node = child_node->children; ref_node;
		     ref_node = ref_node->next) {
			if (ref_node->type != XML_ELEMENT_NODE ||
			    strcmp((char*)ref_node->name, "reference") != 0) {
				continue;
			}
			if (r->ref_params_map == NULL) {
				r->ref_params_map = qb_skiplist_create();
			}
			p = calloc(1, sizeof(struct reference_param));

			/* example:
			 * <parameter name="mysql_ip" type="scalar">
			 *   <reference assembly="mysql" parameter="ipaddress"/>
			 * </parameter>
			 */
			p->name = (char*)xmlGetProp(child_node, BAD_CAST "name");
			p->parameter = (char*)xmlGetProp(ref_node, BAD_CAST "parameter");
			p->assembly = (char*)xmlGetProp(ref_node, BAD_CAST "assembly");
			p->xmlnode = find_pe_parameter(r->name, p->name);
			assert(p->xmlnode);
			qb_log(LOG_INFO, "angus: adding reference_param %s to %s",
			       p->name, r->name);
			qb_map_put(r->ref_params_map, p->name, p);
		}
	}
}
コード例 #7
0
ファイル: cape.c プロジェクト: sdake/pacemaker-cloud
static void assembly_create(xmlNode *cur_node)
{
	struct assembly *assembly;
	char *name;
	char *uuid;
	xmlNode *child_node;
	char *escalation_failures;
	char *escalation_period;

	qb_enter();

	assembly = calloc(1, sizeof (struct assembly));
	name = (char*)xmlGetProp(cur_node, BAD_CAST "name");
	assembly->name = strdup(name);
	uuid = (char*)xmlGetProp(cur_node, BAD_CAST "uuid");
	assembly->uuid = strdup(uuid);
	assembly->resource_map = qb_skiplist_create();
	assembly->sw_instance_create = qb_util_stopwatch_create();
	assembly->sw_instance_connected = qb_util_stopwatch_create();
	assembly->application = application;

	escalation_failures = (char*)xmlGetProp(cur_node, BAD_CAST "escalation_failures");
	escalation_period = (char*)xmlGetProp(cur_node, BAD_CAST "escalation_period");

	recover_init(&assembly->recover,
		    escalation_failures, escalation_period,
		    node_recover_restart,
		    node_recover_escalate,
		    node_state_change_event);
	assembly->recover.instance = assembly;

	instance_create(assembly);
	qb_map_put(assembly_map, name, assembly);

	for (child_node = cur_node->children; child_node;
		child_node = child_node->next) {
		if (child_node->type != XML_ELEMENT_NODE) {
			continue;
		}
		if (strcmp((char*)child_node->name, "services") == 0) {
			resources_create(child_node->children, assembly);
		}
	}

	qb_leave();
}
コード例 #8
0
ファイル: cape.c プロジェクト: sdake/pacemaker-cloud
static void op_history_save(struct resource *resource, struct pe_operation *op,
	enum ocf_exitcode ec)
{
	struct operation_history *oh;
	/*
	 * +3 = _ _ and null terminator
	 */
	char buffer[RESOURCE_NAME_MAX + METHOD_NAME_MAX + OP_NAME_MAX + 3];

	qb_enter();

	snprintf(buffer,
		RESOURCE_NAME_MAX + METHOD_NAME_MAX + OP_NAME_MAX + 3,
		"%s_%s_%d", op->rname, op->method, op->interval);

	oh = qb_map_get(op_history_map, buffer);
	if (oh == NULL) {
		oh = (struct operation_history *)calloc(1, sizeof(struct operation_history));
		oh->resource = resource;
		oh->rsc_id = strdup(buffer);
		oh->operation = strdup(op->method);
		oh->target_outcome = op->target_outcome;
		oh->interval = op->interval;
		oh->rc = OCF_PENDING;
		oh->op_digest = strdup(op->op_digest);
		qb_map_put(op_history_map, oh->rsc_id, oh);
	} else
	if (strcmp(oh->op_digest, op->op_digest) != 0) {
		free(oh->op_digest);
		oh->op_digest = op->op_digest;
	}
        if (oh->rc != ec) {
                oh->last_rc_change = time(NULL);
                oh->rc = ec;
        }

        oh->last_run = time(NULL);
        oh->call_id = call_order++;
        oh->graph_id = op->graph_id;
        oh->action_id = op->action_id;

	qb_leave();
}
コード例 #9
0
ファイル: corosync-notifyd.c プロジェクト: inouekazu/corosync
static void track_link_updown_events(void)
{
	cmap_iter_handle_t iter_handle;
	cmap_track_handle_t track_handle;

	char key_name[CMAP_KEYNAME_MAXLEN + 1];
	size_t value_len;
	cmap_value_types_t type;
	cs_error_t err;
	struct track_item *track_item;

	err = cmap_iter_init(stats_handle, "stats.knet.", &iter_handle);
	if (err != CS_OK) {
		fprintf (stderr, "Failed to initialize knet stats iterator. Error %s\n", cs_strerror(err));
		exit (EXIT_FAILURE);
	}

	while ((err = cmap_iter_next(stats_handle, iter_handle, key_name, &value_len, &type)) == CS_OK) {
		if (strstr(key_name, ".connected")) {

			track_item = malloc(sizeof(struct track_item));
			if (!track_item) {
				return;
			}

			if ((err = cmap_track_add(stats_handle, key_name, CMAP_TRACK_MODIFY, _cs_cmap_link_faulty_key_changed, NULL, &track_handle)) != CS_OK) {
				fprintf (stderr, "Failed to add tracker for %s. Error %s\n", key_name, cs_strerror(err));
				exit (EXIT_FAILURE);
			}
			strcpy(track_item->key_name, key_name);
			track_item->track_handle = track_handle;
			qb_map_put(tracker_map, track_item->key_name, track_item);

		}
	}
	cmap_iter_finalize(stats_handle, iter_handle);
}
コード例 #10
0
ファイル: mapnotify.c プロジェクト: AnchorCat/libqb
static void
add_cs_keys(qb_map_t * m)
{
	qb_map_put(m, "compatibility", strdup("none"));
	qb_map_put(m, "totem.version", strdup("2"));
	qb_map_put(m, "totem.secauth", strdup("off"));
	qb_map_put(m, "totem.threads", strdup("0"));
	qb_map_put(m, "totem.interface.ringnumber", strdup("0"));
	qb_map_put(m, "totem.interface.bindnetaddr", strdup("192.168.122.1"));
	qb_map_put(m, "totem.interface.mcastaddr", strdup("239.255.1.1"));
	qb_map_put(m, "totem.interface.mcastport", strdup("5405"));
	qb_map_put(m, "totem.interface.ttl", strdup("1"));
	qb_map_put(m, "logging.to_stderr", strdup("yes"));
	qb_map_put(m, "logging.to_logfile", strdup("no"));
	qb_map_put(m, "logging.logfile", strdup("/var/log/cluster/corosync.log"));
	qb_map_put(m, "logging.to_syslog", strdup("no"));
	qb_map_put(m, "logging.debug", strdup("off"));
	qb_map_put(m, "logging.timestamp", strdup("on"));
	qb_map_put(m, "logging.logger_subsys.subsys", strdup("MAIN"));
	qb_map_put(m, "logging.logger_subsys.debug", strdup("on"));
	qb_map_put(m, "amf.mode", strdup("disabled"));
	qb_map_put(m, "quorum.provider", strdup("corosync_quorum_ykd"));
	qb_map_put(m, "runtime.services.evs.service_id", strdup("0"));
	qb_map_put(m, "runtime.services.evs.0.tx", strdup("0"));
	qb_map_put(m, "runtime.services.evs.0.rx", strdup("0"));
	qb_map_put(m, "runtime.services.cfg.service_id", strdup("7"));
	qb_map_put(m, "runtime.services.cfg.0.tx", strdup("0"));
	qb_map_put(m, "runtime.services.cfg.0.rx", strdup("0"));
	qb_map_put(m, "runtime.services.cfg.1.tx", strdup("0"));
	qb_map_put(m, "runtime.services.cfg.1.rx", strdup("0"));
	qb_map_put(m, "runtime.services.cfg.2.tx", strdup("0"));
	qb_map_put(m, "runtime.services.cfg.2.rx", strdup("0"));
	qb_map_put(m, "runtime.services.cfg.3.tx", strdup("0"));
	qb_map_put(m, "runtime.services.cfg.3.rx", strdup("0"));
	qb_map_put(m, "runtime.services.cpg.service_id", strdup("8"));
	qb_map_put(m, "runtime.services.cpg.0.tx", strdup("0"));
	qb_map_put(m, "runtime.services.cpg.0.rx", strdup("0"));
	qb_map_put(m, "runtime.services.cpg.1.tx", strdup("0"));
	qb_map_put(m, "runtime.services.cpg.1.rx", strdup("0"));
	qb_map_put(m, "runtime.services.cpg.2.tx", strdup("0"));
	qb_map_put(m, "runtime.services.cpg.2.rx", strdup("0"));
	qb_map_put(m, "runtime.services.cpg.3.tx", strdup("0"));
	qb_map_put(m, "runtime.services.cpg.3.rx", strdup("0"));
	qb_map_put(m, "runtime.services.cpg.4.tx", strdup("0"));
	qb_map_put(m, "runtime.services.cpg.4.rx", strdup("0"));
	qb_map_put(m, "runtime.services.cpg.5.tx", strdup("1"));
	qb_map_put(m, "runtime.services.cpg.5.rx", strdup("1"));
	qb_map_put(m, "runtime.services.confdb.service_id", strdup("11"));
	qb_map_put(m, "runtime.services.pload.service_id", strdup("13"));
	qb_map_put(m, "runtime.services.pload.0.tx", strdup("0"));
	qb_map_put(m, "runtime.services.pload.0.rx", strdup("0"));
	qb_map_put(m, "runtime.services.pload.1.tx", strdup("0"));
	qb_map_put(m, "runtime.services.pload.1.rx", strdup("0"));
	qb_map_put(m, "runtime.services.quorum.service_id", strdup("12"));
	qb_map_put(m, "runtime.connections.active", strdup("1"));
	qb_map_put(m, "runtime.connections.closed", strdup("0"));
	qb_map_put(m, "runtime.connections.corosync-objctl:24175:0x17fd2b0.service_id", strdup("0"));
	qb_map_put(m, "runtime.connections.corosync-objctl:24175:0x17fd2b0.client_pid", strdup("0"));
	qb_map_put(m, "runtime.connections.corosync-objctl:24175:0x17fd2b0.responses", strdup("0"));
	qb_map_put(m, "runtime.connections.corosync-objctl:24175:0x17fd2b0.dispatched", strdup("0"));
	qb_map_put(m, "runtime.connections.corosync-objctl:24175:0x17fd2b0.requests", strdup("0"));
	qb_map_put(m, "runtime.connections.corosync-objctl:24175:0x17fd2b0.send_retries", strdup("0"));
	qb_map_put(m, "runtime.connections.corosync-objctl:24175:0x17fd2b0.recv_retries", strdup("0"));
	qb_map_put(m, "runtime.connections.corosync-objctl:24175:0x17fd2b0.flow_control", strdup("0"));
	qb_map_put(m, "runtime.connections.corosync-objctl:24175:0x17fd2b0.flow_control_count", strdup("0"));
	qb_map_put(m, "runtime.connections.corosync-objctl:24175:0x17fd2b0.queue_size", strdup("0"));
	qb_map_put(m, "runtime.connections.corosync-objctl:24175:0x17fd2b0.invalid_request", strdup("0"));
	qb_map_put(m, "runtime.connections.corosync-objctl:24175:0x17fd2b0.overload", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.msg_reserved", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.msg_queue_avail", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.orf_token_tx", strdup("1"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.orf_token_rx", strdup("100"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.memb_merge_detect_tx", strdup("29"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.memb_merge_detect_rx", strdup("29"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.memb_join_tx", strdup("1"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.memb_join_rx", strdup("1"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.mcast_tx", strdup("13"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.mcast_retx", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.mcast_rx", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.memb_commit_token_tx", strdup("2"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.memb_commit_token_rx", strdup("2"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.token_hold_cancel_tx", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.token_hold_cancel_rx", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.operational_entered", strdup("1"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.operational_token_lost", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.gather_entered", strdup("1"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.gather_token_lost", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.commit_entered", strdup("1"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.commit_token_lost", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.recovery_entered", strdup("1"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.recovery_token_lost", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.consensus_timeouts", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.mtt_rx_token", strdup("106"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.avg_token_workload", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.avg_backlog_calc", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.rx_msg_dropped", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.continuous_gather", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.firewall_enabled_or_nic_failure", strdup("0"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.members.24815808.ip", strdup("r(0) ip(192.168.122.1) "));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.members.24815808.join_count", strdup("1"));
	qb_map_put(m, "runtime.totem.pg.mrp.srp.members.24815808.status", strdup("joined"));
	qb_map_put(m, "runtime.blackbox.dump_flight_data", strdup("no"));
	qb_map_put(m, "runtime.blackbox.dump_state", strdup("no"));
}
コード例 #11
0
ファイル: icmap.c プロジェクト: bhansaliakhil/corosync
cs_error_t icmap_set(
	const char *key_name,
	const void *value,
	size_t value_len,
	icmap_value_types_t type)
{
	struct icmap_item *item;
	struct icmap_item *new_item;
	size_t new_value_len;
	size_t new_item_size;

	if (value == NULL || key_name == NULL) {
		return (CS_ERR_INVALID_PARAM);
	}

	if (icmap_check_value_len(value, value_len, type) != 0) {
		return (CS_ERR_INVALID_PARAM);
	}

	item = qb_map_get(icmap_map, key_name);
	if (item != NULL) {
		/*
		 * Check that key is really changed
		 */
		if (icmap_item_eq(item, value, value_len, type)) {
			return (CS_OK);
		}
	} else {
		if (icmap_check_key_name(key_name) != 0) {
			return (CS_ERR_NAME_TOO_LONG);
		}
	}

	if (type == ICMAP_VALUETYPE_BINARY || type == ICMAP_VALUETYPE_STRING) {
		if (type == ICMAP_VALUETYPE_STRING) {
			new_value_len = strlen((const char *)value);
			if (new_value_len > value_len) {
				new_value_len = value_len;
			}
			new_value_len++;
		} else {
			new_value_len = value_len;
		}
	} else {
		new_value_len = icmap_get_valuetype_len(type);
	}

	new_item_size = sizeof(struct icmap_item) + new_value_len;
	new_item = malloc(new_item_size);
	if (new_item == NULL) {
		return (CS_ERR_NO_MEMORY);
	}
	memset(new_item, 0, new_item_size);

	if (item == NULL) {
		new_item->key_name = strdup(key_name);
		if (new_item->key_name == NULL) {
			free(new_item);
			return (CS_ERR_NO_MEMORY);
		}
	} else {
		new_item->key_name = item->key_name;
		item->key_name = NULL;
	}

	new_item->type = type;
	new_item->value_len = new_value_len;

	memcpy(new_item->value, value, new_value_len);

	if (new_item->type == ICMAP_VALUETYPE_STRING) {
		((char *)new_item->value)[new_value_len - 1] = 0;
	}

	qb_map_put(icmap_map, new_item->key_name, new_item);

	return (CS_OK);
}
コード例 #12
0
ファイル: cape.c プロジェクト: sdake/pacemaker-cloud
static void resource_create(xmlNode *cur_node, struct assembly *assembly)
{
	struct resource *resource;
	xmlNode *child_node;
	xmlNode *params_node = NULL;
	char *name;
	char *type;
	char *rclass;
	char *rprovider;
	/* 6 = rsc__ and terminator */
	char resource_name[ASSEMBLY_NAME_MAX + RESOURCE_NAME_MAX + 6];
	char *escalation_failures;
	char *escalation_period;

	qb_enter();


	for (child_node = cur_node->children; child_node;
		child_node = child_node->next) {
		if (child_node->type != XML_ELEMENT_NODE) {
			continue;
		}
		if (strcmp((char*)child_node->name, "parameters") == 0) {
			params_node = child_node;
			break;
		}
	}


	for (child_node = cur_node->children; child_node;
		child_node = child_node->next) {
		if (child_node->type != XML_ELEMENT_NODE) {
			continue;
		}
		if (strcmp((char*)child_node->name, "configure_executable") == 0) {
			configure_resource_create(cur_node, params_node, assembly);
			break;
		}
	}

	resource = calloc(1, sizeof (struct resource));
	name = (char*)xmlGetProp(cur_node, BAD_CAST "name");
	snprintf(resource_name, ASSEMBLY_NAME_MAX + RESOURCE_NAME_MAX + 6,
		"rsc_%s_%s", assembly->name, name);
	resource->name = strdup(resource_name);
	type = (char*)xmlGetProp(cur_node, BAD_CAST "type");
	resource->type = strdup(type);
	rclass = (char*)xmlGetProp(cur_node, BAD_CAST "class");
	resource->rclass = strdup(rclass);

	rprovider = (char*)xmlGetProp(cur_node, BAD_CAST "provider");
	if (rprovider) {
		resource->rprovider = strdup(rprovider);
	} else {
		resource->rprovider = NULL;
	}
	escalation_failures = (char*)xmlGetProp(cur_node, BAD_CAST "escalation_failures");
	escalation_period = (char*)xmlGetProp(cur_node, BAD_CAST "escalation_period");

	recover_init(&resource->recover,
		    escalation_failures, escalation_period,
		    resource_recover_restart,
		    resource_recover_escalate,
		    resource_state_change_event);
	resource->recover.instance = resource;

	resource->assembly = assembly;
	qb_map_put(assembly->resource_map, resource->name, resource);

	if (strcmp(resource->rclass, "ocf") == 0) {
		resource_add_ref_params(params_node, resource);
	}

	qb_leave();
}