void rf_memdb_event_node_init(void)
{
	libjsonrpcapi_init(JSONRPCINIT_MEMDB, 0);
	libdb_is_ready(DB_RMM, LOCK_ID_NULL, -1);
	memdb_integer nid = get_rf_node_id();

	if (nid == 0) {
		create_memdb_rf_event_nodes();
	}

	node_msg_id_map_size = gen_node_msg_id_map(g_rf_node_msg_id_map);
}
Example #2
0
int rmm_modules_init(unsigned int modules, unsigned int jipmi_port_attr, unsigned int jsonrpcapi_bitmap)
{
#define INIT_MAX_RETRY    10

	int port = 0;
	int ret = -1;
	
	if (modules | MODULEINIT_LOG) {
		ret = rmm_log_init();
		if (ret == -1)
			return -1;
	}

	if (modules | MODULEINIT_COREDUMP)
		enable_core_dump();

	if (modules | MODULEINIT_REDFISHD) {
		port = rmm_cfg_get_port(REDFISHD_PORT);
		ret = rf_connect(INADDR_LOOPBACK, port);
		if (ret == -1)
			return -1;
		port = rmm_cfg_get_port(SNMPAGENTD_PORT);
		ret = snmp_subagentd_connect(INADDR_LOOPBACK, port);
		if (ret == -1)
			return -1;
	}

	if (modules | MODULEINIT_GAMI_REG) {
		ret = is_gami_reg_ready(INIT_MAX_RETRY);
		if (ret == -1)
			return -1;
	}

	if (modules | MODULEINIT_ASSETD) {
		ret = is_assetd_ready(INIT_MAX_RETRY);
		if (ret == -1)
			return -1;
	}

	if (jsonrpcapi_bitmap) {
		port  = rmm_cfg_get_port(jipmi_port_attr);
		libjsonrpcapi_init(JSONRPCINIT_MEMDB | JSONRPCINIT_JIPMI, port);
		if (jsonrpcapi_bitmap | JSONRPCINIT_MEMDB)
			ret = libdb_is_ready(DB_RMM, LOCK_ID_NULL, -1);

		if (ret == -1)
			return -1; 
	}

	return 0;
}