diff --git a/src/plugins/select/bluegene/Makefile.am b/src/plugins/select/bluegene/Makefile.am index 19294766e500682f59e4f23367c91ac004f1f1a7..6f564f52b149e950d7720ebf74bee3bbc9237afc 100644 --- a/src/plugins/select/bluegene/Makefile.am +++ b/src/plugins/select/bluegene/Makefile.am @@ -11,7 +11,7 @@ INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src/common $(BG_INCLUDES) pkglib_LTLIBRARIES = select_bluegene.la -noinst_LTLIBRARIES = libba_common.la +noinst_LTLIBRARIES = libba_common.la libconfigure_api.la convenience_libs = $(top_builddir)/src/api/libslurm.o -ldl @@ -22,6 +22,7 @@ select_bluegene_la_SOURCES = select_bluegene.c \ libba_common_la_SOURCES = ba_common.c ba_common.h +libconfigure_api_la_SOURCES = configure_api.c select_bluegene_la_LDFLAGS = $(SO_LDFLAGS) $(PLUGIN_FLAGS) select_bluegene_la_LIBADD = libba_common.la diff --git a/src/plugins/select/bluegene/Makefile.in b/src/plugins/select/bluegene/Makefile.in index 4b1154d3a76bde82456ae6c3868d9c61626614ef..e8b8585469a05a0bf2038b4b3adb54ff0500b2bd 100644 --- a/src/plugins/select/bluegene/Makefile.in +++ b/src/plugins/select/bluegene/Makefile.in @@ -124,6 +124,9 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkglib_LTLIBRARIES) libba_common_la_LIBADD = am_libba_common_la_OBJECTS = ba_common.lo libba_common_la_OBJECTS = $(am_libba_common_la_OBJECTS) +libconfigure_api_la_LIBADD = +am_libconfigure_api_la_OBJECTS = configure_api.lo +libconfigure_api_la_OBJECTS = $(am_libconfigure_api_la_OBJECTS) libsched_if_la_LIBADD = am__libsched_if_la_SOURCES_DIST = libsched_if64.c @BGL_LOADED_FALSE@@BG_L_P_LOADED_TRUE@@BLUEGENE_LOADED_TRUE@am_libsched_if_la_OBJECTS = libsched_if64.lo @@ -215,12 +218,13 @@ CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(libba_common_la_SOURCES) $(libsched_if_la_SOURCES) \ - $(libsched_if64_la_SOURCES) $(runjob_plugin_la_SOURCES) \ - $(select_bluegene_la_SOURCES) \ +SOURCES = $(libba_common_la_SOURCES) $(libconfigure_api_la_SOURCES) \ + $(libsched_if_la_SOURCES) $(libsched_if64_la_SOURCES) \ + $(runjob_plugin_la_SOURCES) $(select_bluegene_la_SOURCES) \ $(nodist_EXTRA_select_bluegene_la_SOURCES) \ $(slurm_epilog_SOURCES) $(slurm_prolog_SOURCES) DIST_SOURCES = $(libba_common_la_SOURCES) \ + $(libconfigure_api_la_SOURCES) \ $(am__libsched_if_la_SOURCES_DIST) \ $(am__libsched_if64_la_SOURCES_DIST) \ $(am__runjob_plugin_la_SOURCES_DIST) \ @@ -471,13 +475,14 @@ PLUGIN_FLAGS = -module -avoid-version --export-dynamic -lm INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src/common $(BG_INCLUDES) pkglib_LTLIBRARIES = select_bluegene.la $(am__append_2) \ $(am__append_3) $(am__append_5) -noinst_LTLIBRARIES = libba_common.la +noinst_LTLIBRARIES = libba_common.la libconfigure_api.la convenience_libs = $(top_builddir)/src/api/libslurm.o -ldl # These are needed for pack/unpack of structures for cross-cluster stuff select_bluegene_la_SOURCES = select_bluegene.c bg_job_info.c \ bg_job_info.h bg_node_info.c bg_node_info.h $(am__append_6) libba_common_la_SOURCES = ba_common.c ba_common.h +libconfigure_api_la_SOURCES = configure_api.c select_bluegene_la_LDFLAGS = $(SO_LDFLAGS) $(PLUGIN_FLAGS) select_bluegene_la_LIBADD = libba_common.la $(am__append_7) @BLUEGENE_LOADED_TRUE@SUBDIRS = sfree $(am__append_1) $(am__append_4) @@ -574,6 +579,8 @@ clean-pkglibLTLIBRARIES: done libba_common.la: $(libba_common_la_OBJECTS) $(libba_common_la_DEPENDENCIES) $(LINK) $(libba_common_la_OBJECTS) $(libba_common_la_LIBADD) $(LIBS) +libconfigure_api.la: $(libconfigure_api_la_OBJECTS) $(libconfigure_api_la_DEPENDENCIES) + $(LINK) $(libconfigure_api_la_OBJECTS) $(libconfigure_api_la_LIBADD) $(LIBS) libsched_if.la: $(libsched_if_la_OBJECTS) $(libsched_if_la_DEPENDENCIES) $(libsched_if_la_LINK) $(am_libsched_if_la_rpath) $(libsched_if_la_OBJECTS) $(libsched_if_la_LIBADD) $(LIBS) libsched_if64.la: $(libsched_if64_la_OBJECTS) $(libsched_if64_la_DEPENDENCIES) @@ -650,6 +657,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bg_read_config.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bg_record_functions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bg_status.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/configure_api.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsched_if64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runjob_plugin.Plo@am__quote@ diff --git a/src/plugins/select/bluegene/bg_read_config.c b/src/plugins/select/bluegene/bg_read_config.c index d3706fa02de4e9c7ffce76518f86c5c36d1037fe..9d10dfcf6b00793784d45f0af91742f3ae7e0218 100644 --- a/src/plugins/select/bluegene/bg_read_config.c +++ b/src/plugins/select/bluegene/bg_read_config.c @@ -45,7 +45,7 @@ #include <stdlib.h> -s_p_options_t bg_conf_file_options[] = { +static s_p_options_t bg_conf_file_options[] = { #ifdef HAVE_BGL {"BlrtsImage", S_P_STRING}, {"LinuxImage", S_P_STRING}, @@ -335,9 +335,7 @@ extern int read_bg_conf(void) /* initialization */ /* bg_conf defined in bg_node_alloc.h */ - tbl = s_p_hashtbl_create(bg_conf_file_options); - - if (s_p_parse_file(tbl, NULL, bg_conf_file, false) == SLURM_ERROR) + if (!(tbl = config_make_tbl(bg_conf_file))) fatal("something wrong with opening/reading bluegene " "conf file"); xfree(bg_conf_file); @@ -782,3 +780,19 @@ no_calc: return SLURM_SUCCESS; } + +extern s_p_hashtbl_t *config_make_tbl(char *filename) +{ + s_p_hashtbl_t *tbl = NULL; + + xassert(filename); + + tbl = s_p_hashtbl_create(bg_conf_file_options); + + if (s_p_parse_file(tbl, NULL, filename, false) == SLURM_ERROR) { + s_p_hashtbl_destroy(tbl); + tbl = NULL; + } + + return tbl; +} diff --git a/src/plugins/select/bluegene/bg_read_config.h b/src/plugins/select/bluegene/bg_read_config.h index a2836bc4bc2e74a83d8098a009bfd8be90ccc7aa..041d93d11b8a7fce7b9c4637fc3836ac5aff72db 100644 --- a/src/plugins/select/bluegene/bg_read_config.h +++ b/src/plugins/select/bluegene/bg_read_config.h @@ -60,8 +60,6 @@ typedef struct { gid_t gid; } image_group_t; -extern s_p_options_t bg_conf_file_options[]; - extern void destroy_image_group_list(void *ptr); extern void destroy_image(void *ptr); @@ -76,5 +74,6 @@ extern int parse_image(void **dest, slurm_parser_enum_t type, const char *line, char **leftover); extern int read_bg_conf(void); +extern s_p_hashtbl_t *config_make_tbl(char *filename); #endif diff --git a/src/plugins/select/bluegene/configure_api.c b/src/plugins/select/bluegene/configure_api.c new file mode 100644 index 0000000000000000000000000000000000000000..a025add97c55b08f2b80ecd02f48808c9afe43d9 --- /dev/null +++ b/src/plugins/select/bluegene/configure_api.c @@ -0,0 +1,361 @@ +/*****************************************************************************\ + * configure_api.c + * + ***************************************************************************** + * Copyright (C) 2011 SchedMD LLC. + * Written by Danny Auble <da@schedmd.com> + * + * This file is part of SLURM, a resource management program. + * For details, see <http://www.schedmd.com/slurmdocs/>. + * Please also read the included file: DISCLAIMER. + * + * SLURM is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * In addition, as a special exception, the copyright holders give permission + * to link the code of portions of this program with the OpenSSL library under + * certain conditions as described in each individual source file, and + * distribute linked combinations including the two. You must obey the GNU + * General Public License in all respects for all of the code used other than + * OpenSSL. If you modify file(s) with this exception, you may extend this + * exception to your version of the file(s), but you are not obligated to do + * so. If you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files in + * the program, then also delete it here. + * + * SLURM is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along + * with SLURM; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +\*****************************************************************************/ + +#include "configure_api.h" +#include "src/common/plugin.h" +#include "src/common/plugrack.h" +#include "src/common/slurm_protocol_api.h" +#include "src/common/xstring.h" + +typedef struct { + void (*ba_init) (node_info_msg_t *node_info_ptr, + bool load_bridge); + void (*ba_fini) (void); + void (*reset_ba_system) (bool track_down_mps); + void (*destroy_ba_mp) (void *ptr); + char *(*ba_passthroughs_string)(uint16_t passthrough); + void (*ba_update_mp_state) (ba_mp_t *ba_mp, uint16_t state); + int (*ba_set_removable_mps) (bitstr_t *bitmap, bool except); + int (*ba_reset_all_removed_mps)(void); + int (*new_ba_request) (select_ba_request_t* ba_request); + int (*allocate_block) (select_ba_request_t* ba_request, + List results); + int (*remove_block) (List mps, bool is_small); + ba_mp_t *(*str2ba_mp) (const char *coords); + ba_mp_t *(*loc2ba_mp) (const char *mp_id); + ba_mp_t *(*coord2ba_mp) (const uint16_t *coord); + char *(*give_geo) (uint16_t *int_geo, int dims, + bool with_sep); + s_p_hashtbl_t *(*config_make_tbl)(char *filename); + void (*set_ba_debug_flags) (uint32_t debug_flags); +} bg_configure_api_ops_t; + +typedef struct bg_configure_context { + char *type; + plugrack_t plugin_list; + plugin_handle_t cur_plugin; + int bg_configure_errno; + bg_configure_api_ops_t ops; +} bg_configure_context_t; + +static bg_configure_context_t *bg_configure_context = NULL; +static pthread_mutex_t bg_configure_context_lock = + PTHREAD_MUTEX_INITIALIZER; + +static bg_configure_api_ops_t *_get_ops(bg_configure_context_t *c) +{ + /* + * Must be synchronized with bg_configure_api_ops_t above. + */ + static const char *syms[] = { + "ba_init", + "ba_fini", + "reset_ba_system", + "destroy_ba_mp", + "ba_passthroughs_string", + "ba_update_mp_state", + "ba_set_removable_mps", + "ba_reset_all_removed_mps", + "new_ba_request", + "allocate_block", + "remove_block", + "str2ba_mp", + "loc2ba_mp", + "coord2ba_mp", + "give_geo", + "config_make_tbl", + "set_ba_debug_flags", + }; + int n_syms = sizeof(syms) / sizeof(char *); + + /* Find the correct plugin. */ + c->cur_plugin = plugin_load_and_link(c->type, n_syms, syms, + (void **) &c->ops); + if (c->cur_plugin != PLUGIN_INVALID_HANDLE) + return &c->ops; + + if(errno != EPLUGIN_NOTFOUND) { + error("Couldn't load specified plugin name for %s: %s", + c->type, plugin_strerror(errno)); + return NULL; + } + + error("Couldn't find the specified plugin name for %s " + "looking at all files", + c->type); + + /* Get plugin list. */ + if ( c->plugin_list == NULL ) { + char *plugin_dir; + c->plugin_list = plugrack_create(); + if ( c->plugin_list == NULL ) { + error( "cannot create plugin manager" ); + return NULL; + } + plugrack_set_major_type(c->plugin_list, "select"); + plugrack_set_paranoia(c->plugin_list, + PLUGRACK_PARANOIA_NONE, + 0); + plugin_dir = slurm_get_plugin_dir(); + plugrack_read_dir(c->plugin_list, plugin_dir); + xfree(plugin_dir); + } + + c->cur_plugin = plugrack_use_by_type(c->plugin_list, c->type); + if ( c->cur_plugin == PLUGIN_INVALID_HANDLE ) { + error( "cannot find accounting_storage plugin for %s", + c->type ); + return NULL; + } + + /* Dereference the API. */ + if ( plugin_get_syms(c->cur_plugin, + n_syms, + syms, + (void **) &c->ops ) < n_syms) { + error("incomplete select plugin detected"); + return NULL; + } + + return &c->ops; +} + +/* + * Destroy a node selection context + */ +static int _context_destroy(bg_configure_context_t *c) +{ + int rc = SLURM_SUCCESS; + /* + * Must check return code here because plugins might still + * be loaded and active. + */ + if (c->plugin_list) { + if (plugrack_destroy(c->plugin_list) != SLURM_SUCCESS) + rc = SLURM_ERROR; + } else { + plugin_unload(c->cur_plugin); + } + + xfree(c->type); + + return rc; +} + + +extern int bg_configure_init(void) +{ + int rc = SLURM_SUCCESS; + slurm_mutex_lock(&bg_configure_context_lock); + + if (bg_configure_context) + goto done; + + bg_configure_context = xmalloc(sizeof(bg_configure_context_t)); + bg_configure_context->type = xstrdup("select/bluegene"); + bg_configure_context->cur_plugin = PLUGIN_INVALID_HANDLE; + bg_configure_context->bg_configure_errno = SLURM_SUCCESS; + + if (!_get_ops(bg_configure_context)) { + error("cannot resolve select plugin operations for configure"); + _context_destroy(bg_configure_context); + bg_configure_context = NULL; + rc = SLURM_ERROR; + } + +done: + slurm_mutex_unlock(&bg_configure_context_lock); + return rc; + +} + +extern int bg_configure_fini(void) +{ + int rc = SLURM_SUCCESS; + + slurm_mutex_lock(&bg_configure_context_lock); + if (!bg_configure_context) + goto fini; + + rc = _context_destroy(bg_configure_context); + bg_configure_context = NULL; +fini: + slurm_mutex_unlock(&bg_configure_context_lock); + return rc; +} + +extern void bg_configure_ba_init( + node_info_msg_t *node_info_ptr, bool load_bridge) +{ + if (bg_configure_init() < 0) + return; + + (*(bg_configure_context->ops.ba_init))(node_info_ptr, load_bridge); +} + +extern void bg_configure_ba_fini(void) +{ + if (bg_configure_init() < 0) + return; + + (*(bg_configure_context->ops.ba_fini))(); +} + +extern void bg_configure_reset_ba_system(bool track_down_mps) +{ + if (bg_configure_init() < 0) + return; + + (*(bg_configure_context->ops.reset_ba_system))(track_down_mps); +} + +extern void bg_configure_destroy_ba_mp(void *ptr) +{ + if (bg_configure_init() < 0) + return; + + (*(bg_configure_context->ops.destroy_ba_mp))(ptr); +} + +extern char *bg_configure_ba_passthroughs_string(uint16_t passthrough) +{ + if (bg_configure_init() < 0) + return NULL; + + return (*(bg_configure_context->ops.ba_passthroughs_string)) + (passthrough); +} + +extern void bg_configure_ba_update_mp_state(ba_mp_t *ba_mp, uint16_t state) +{ + if (bg_configure_init() < 0) + return; + + (*(bg_configure_context->ops.ba_update_mp_state))(ba_mp, state); +} + +extern int bg_configure_ba_set_removable_mps(bitstr_t *bitmap, bool except) +{ + if (bg_configure_init() < 0) + return SLURM_ERROR; + + return (*(bg_configure_context->ops.ba_set_removable_mps)) + (bitmap, except); +} + +extern int bg_configure_ba_reset_all_removed_mps(void) +{ + if (bg_configure_init() < 0) + return SLURM_ERROR; + + return (*(bg_configure_context->ops.ba_reset_all_removed_mps))(); +} + + +extern int bg_configure_new_ba_request(select_ba_request_t* ba_request) +{ + if (bg_configure_init() < 0) + return SLURM_ERROR; + + return (*(bg_configure_context->ops.new_ba_request))(ba_request); +} + +extern int bg_configure_allocate_block( + select_ba_request_t* ba_request, List results) +{ + if (bg_configure_init() < 0) + return SLURM_ERROR; + + return (*(bg_configure_context->ops.allocate_block)) + (ba_request, results); +} + +extern int bg_configure_remove_block(List mps, bool is_small) +{ + if (bg_configure_init() < 0) + return SLURM_ERROR; + + return (*(bg_configure_context->ops.remove_block))(mps, is_small); +} + +extern ba_mp_t *bg_configure_str2ba_mp(const char *coords) +{ + if (bg_configure_init() < 0) + return NULL; + + return (*(bg_configure_context->ops.str2ba_mp))(coords); +} + +extern ba_mp_t *bg_configure_loc2ba_mp(const char *mp_id) +{ + if (bg_configure_init() < 0) + return NULL; + + return (*(bg_configure_context->ops.loc2ba_mp))(mp_id); +} + +extern ba_mp_t *bg_configure_coord2ba_mp(const uint16_t *coord) +{ + if (bg_configure_init() < 0) + return NULL; + + return (*(bg_configure_context->ops.coord2ba_mp))(coord); +} + +extern char *bg_configure_give_geo(uint16_t *int_geo, int dims, bool with_sep) +{ + if (bg_configure_init() < 0) + return NULL; + + return (*(bg_configure_context->ops.give_geo))(int_geo, dims, with_sep); +} + +extern s_p_hashtbl_t *bg_configure_config_make_tbl(char *filename) +{ + if (bg_configure_init() < 0) + return NULL; + + return (*(bg_configure_context->ops.config_make_tbl))(filename); +} + +extern void ba_configure_set_ba_debug_flags(uint32_t debug_flags) +{ + if (bg_configure_init() < 0) + return; + + (*(bg_configure_context->ops.set_ba_debug_flags))(debug_flags); +} diff --git a/src/plugins/select/bluegene/configure_api.h b/src/plugins/select/bluegene/configure_api.h new file mode 100644 index 0000000000000000000000000000000000000000..cd916820386a9cb2916bda087403fcdef86f286e --- /dev/null +++ b/src/plugins/select/bluegene/configure_api.h @@ -0,0 +1,177 @@ +/*****************************************************************************\ + * configure_api.h + * + ***************************************************************************** + * Copyright (C) 2011 SchedMD LLC. + * Written by Danny Auble <da@schedmd.com> + * + * This file is part of SLURM, a resource management program. + * For details, see <http://www.schedmd.com/slurmdocs/>. + * Please also read the included file: DISCLAIMER. + * + * SLURM is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * In addition, as a special exception, the copyright holders give permission + * to link the code of portions of this program with the OpenSSL library under + * certain conditions as described in each individual source file, and + * distribute linked combinations including the two. You must obey the GNU + * General Public License in all respects for all of the code used other than + * OpenSSL. If you modify file(s) with this exception, you may extend this + * exception to your version of the file(s), but you are not obligated to do + * so. If you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files in + * the program, then also delete it here. + * + * SLURM is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along + * with SLURM; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +\*****************************************************************************/ + +#ifndef _BG_CONFIGURE_API_H_ +#define _BG_CONFIGURE_API_H_ + +#include "slurm/slurm.h" +#include "slurm/slurm_errno.h" + +#include "src/common/list.h" +#include "src/common/node_select.h" +#include "src/common/parse_spec.h" + +#include "ba_common.h" + +extern int bg_configure_init(void); +extern int bg_configure_fini(void); + +/* + * Initialize internal structures by either reading previous block + * configurations from a file or by running the graph solver. + * + * IN: node_info_msg_t * can be null, + * should be from slurm_load_node(). + * IN: load_bridge: whiether or not to get bridge information + * + * return: void. + */ +extern void bg_configure_ba_init( + node_info_msg_t *node_info_ptr, bool load_bridge); + +/* + * destroy all the internal (global) data structs. + */ +extern void bg_configure_ba_fini(void); + +/* + * Resets the virtual system to a virgin state. If track_down_mps is set + * then those midplanes are not set to idle, but kept in a down state. + */ +extern void bg_configure_reset_ba_system(bool track_down_mps); + +extern void bg_configure_destroy_ba_mp(void *ptr); + +/* Convert PASS_FOUND_* into equivalent string + * Caller MUST xfree() the returned value */ +extern char *bg_configure_ba_passthroughs_string(uint16_t passthrough); + +/* + * set the mp in the internal configuration as in, or not in use, + * along with the current state of the mp. + * + * IN ba_mp: ba_mp_t to update state + * IN state: new state of ba_mp_t + */ +extern void bg_configure_ba_update_mp_state(ba_mp_t *ba_mp, uint16_t state); + +/* + * Used to set all midplanes in a special used state except the ones + * we are able to use in a new allocation. + * + * IN: bitmap of midplanes we do or do not want + * IN: except - If true set all midplanes not set in the bitmap else + * set all midplanes that are set in the bitmap. + * RET: SLURM_SUCCESS on success, or SLURM_ERROR on error + * + * Note: Need to call ba_reset_all_removed_mps before starting another + * allocation attempt after + */ +extern int bg_configure_ba_set_removable_mps(bitstr_t *bitmap, bool except); + +/* + * Resets the virtual system to the pervious state before calling + * ba_set_removable_mps. + */ +extern int bg_configure_ba_reset_all_removed_mps(void); + +/* + * create a block request. Note that if the geometry is given, + * then size is ignored. If elongate is true, the algorithm will try + * to fit that a block of cubic shape and then it will try other + * elongated geometries. (ie, 2x2x2 -> 4x2x1 -> 8x1x1). + * + * IN/OUT - ba_request: structure to allocate and fill in. + * + * ALL below IN's need to be set within the ba_request before the call + * if you want them to be used. + * ALL below OUT's are set and returned within the ba_request. + * IN - avail_mp_bitmap: bitmap of usable midplanes. + * IN - blrtsimage: BlrtsImage for this block if not default + * IN - conn_type: connection type of request (TORUS or MESH or SMALL) + * IN - elongate: if true, will try to fit different geometries of + * same size requests + * IN/OUT - geometry: requested/returned geometry of block + * IN - linuximage: LinuxImage for this block if not default + * IN - mloaderimage: MLoaderImage for this block if not default + * OUT - passthroughs: if there were passthroughs used in the + * generation of the block. + * IN - procs: Number of real processors requested + * IN - RamDiskimage: RamDiskImage for this block if not default + * IN - rotate: if true, allows rotation of block during fit + * OUT - save_name: hostlist of midplanes used in block + * IN/OUT - size: requested/returned count of midplanes in block + * IN - start: geo location of where to start the allocation + * IN - start_req: if set use the start variable to start at + * return success of allocation/validation of params + */ +extern int bg_configure_new_ba_request(select_ba_request_t* ba_request); + +/* + * Try to allocate a block. + * + * IN - ba_request: allocation request + * OUT - results: List of results of the allocation request. Each + * list entry will be a coordinate. allocate_block will create the + * list, but the caller must destroy it. + * + * return: success or error of request + */ +extern int bg_configure_allocate_block( + select_ba_request_t* ba_request, List results); + +/* + * Admin wants to remove a previous allocation. + * will allow Admin to delete a previous allocation retrival by letter code. + */ +extern int bg_configure_remove_block(List mps, bool is_small); + +/* translate a string of at least AXYZ into a ba_mp_t ptr */ +extern ba_mp_t *bg_configure_str2ba_mp(const char *coords); +/* + * find a base blocks bg location (rack/midplane) + */ +extern ba_mp_t *bg_configure_loc2ba_mp(const char* mp_id); + +extern ba_mp_t *bg_configure_coord2ba_mp(const uint16_t *coord); +extern char *bg_configure_give_geo(uint16_t *int_geo, int dims, bool with_sep); + +extern s_p_hashtbl_t *bg_configure_config_make_tbl(char *filename); + +extern void ba_configure_set_ba_debug_flags(uint32_t debug_flags); + +#endif