예제 #1
0
/* *********************************************************************** */
extern int
slurm_topo_init( void )
{
	int retval = SLURM_SUCCESS;
	char *plugin_type = "topo";
	char *type = NULL;

	if (init_run && g_context)
		return retval;

	slurm_mutex_lock(&g_context_lock);

	if (g_context)
		goto done;

	type = slurm_get_topology_plugin();

	g_context = plugin_context_create(
		plugin_type, type, (void **)&ops, syms, sizeof(syms));

	if (!g_context) {
		error("cannot create %s context for %s", plugin_type, type);
		retval = SLURM_ERROR;
		goto done;
	}
	init_run = true;

done:
	slurm_mutex_unlock(&g_context_lock);
	xfree(type);
	return retval;
}
예제 #2
0
파일: slurm_topology.c 프로젝트: VURM/slurm
/* *********************************************************************** */
extern int
slurm_topo_init( void )
{
	int retval = SLURM_SUCCESS;
	char *topo_type = NULL;

	slurm_mutex_lock( &g_topo_context_lock );

	if ( g_topo_context )
		goto done;

	topo_type = slurm_get_topology_plugin();
	g_topo_context = slurm_topo_context_create( topo_type );
	if ( g_topo_context == NULL ) {
		error( "cannot create topology context for %s",
		       topo_type );
		retval = SLURM_ERROR;
		goto done;
	}

	if ( slurm_topo_get_ops( g_topo_context ) == NULL ) {
		error( "cannot resolve topology plugin operations" );
		slurm_topo_context_destroy( g_topo_context );
		g_topo_context = NULL;
		retval = SLURM_ERROR;
	}

done:
	slurm_mutex_unlock( &g_topo_context_lock );
	xfree(topo_type);
	return retval;
}
예제 #3
0
/*
 * init() is called when the plugin is loaded, before any other functions
 *	are called.  Put global initialization here.
 */
extern int init(void)
{
	char *topotype;
	topotype = slurm_get_topology_plugin();
	if (strcasecmp(topotype,"topology/tree") != 0) {
		fatal("ROUTE: route/topology requires topology/tree");
	}
	xfree(topotype);
	debug_flags = slurm_get_debug_flags();
	verbose("%s loaded", plugin_name);
	return SLURM_SUCCESS;
}