コード例 #1
0
ファイル: wd.c プロジェクト: danfrincu/corosync
static void wd_resource_check_fn (void* resource_ref)
{
	struct resource* ref = (struct resource*)resource_ref;

	if (wd_resource_state_is_ok (ref) == CS_FALSE) {
		cs_fsm_process(&ref->fsm, WD_E_FAILURE, ref);
		return;
	}
	api->timer_add_duration(ref->check_timeout*MILLI_2_NANO_SECONDS,
		ref, wd_resource_check_fn, &ref->check_timer);
}
コード例 #2
0
ファイル: wd.c プロジェクト: douardda/corosync
static void wd_key_changed(
	int32_t event,
	const char *key_name,
	struct icmap_notify_value new_val,
	struct icmap_notify_value old_val,
	void *user_data)
{
	struct resource* ref = (struct resource*)user_data;
	char *last_key_part;

	if (ref == NULL) {
		return ;
	}

	last_key_part = strrchr(key_name, '.');
	if (last_key_part == NULL) {
		return ;
	}
	last_key_part++;

	if (event == ICMAP_TRACK_ADD || event == ICMAP_TRACK_MODIFY) {
		if (strcmp(last_key_part, "last_updated") == 0 ||
			strcmp(last_key_part, "current") == 0) {
			return;
		}

		cs_fsm_process(&ref->fsm, WD_E_CONFIG_CHANGED, ref);
	}

	if (event == ICMAP_TRACK_DELETE && ref != NULL) {
		if (strcmp(last_key_part, "state") != 0) {
			return ;
		}

		log_printf (LOGSYS_LEVEL_WARNING,
			"resource \"%s\" deleted from cmap!",
			ref->name);

		api->timer_delete(ref->check_timer);
		ref->check_timer = 0;
		icmap_track_delete(ref->icmap_track);

		free(ref);
	}
}
コード例 #3
0
ファイル: wd.c プロジェクト: danfrincu/corosync
static void wd_key_changed(object_change_type_t change_type,
	hdb_handle_t parent_object_handle,
	hdb_handle_t object_handle,
	const void *object_name_pt, size_t object_name_len,
	const void *key_name_pt, size_t key_len,
	const void *key_value_pt, size_t key_value_len,
	void *priv_data_pt)
{
	struct resource* ref = (struct resource*)priv_data_pt;

	if (strncmp(key_name_pt, "last_updated", key_len) == 0 ||
		strncmp(key_name_pt, "current", key_len) == 0) {
		return;
	}

	if (ref == NULL) {
		return;
	}
	cs_fsm_process(&ref->fsm, WD_E_CONFIG_CHANGED, ref);
}