diff --git a/src/common/checkpoint.c b/src/common/checkpoint.c index 8c010fa51dfe4cfd5c09a3f11743f135fbaf7667..347c95f24cb6f1ced076880ec82112726ba5eb92 100644 --- a/src/common/checkpoint.c +++ b/src/common/checkpoint.c @@ -176,6 +176,12 @@ _slurm_checkpoint_get_ops( slurm_checkpoint_context_t c ) 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->checkpoint_type, plugin_strerror(errno)); + return NULL; + } + error("Couldn't find the specified plugin name for %s " "looking at all files", c->checkpoint_type); diff --git a/src/common/gres.c b/src/common/gres.c index f9e2e731163238c2aacfd05942037e34509c7621..0e190bbeb57b8fa500359431d786110b4faa1b7c 100644 --- a/src/common/gres.c +++ b/src/common/gres.c @@ -207,6 +207,12 @@ static int _load_gres_plugin(char *plugin_name, if (plugin_context->cur_plugin != PLUGIN_INVALID_HANDLE) return SLURM_SUCCESS; + if(errno != EPLUGIN_NOTFOUND) { + error("Couldn't load specified plugin name for %s: %s", + plugin_context->gres_type, plugin_strerror(errno)); + return SLURM_ERROR; + } + error("gres: Couldn't find the specified plugin name for %s " "looking at all files", plugin_context->gres_type); diff --git a/src/common/node_select.c b/src/common/node_select.c index 1c510549aa7cac4a3ea1cea892845fb19e8f3bce..095460e097b0cdd6e1ee2fb7b5515c181389e36b 100644 --- a/src/common/node_select.c +++ b/src/common/node_select.c @@ -238,6 +238,12 @@ static int _select_get_ops(char *select_type, if ( c->cur_plugin != PLUGIN_INVALID_HANDLE ) return SLURM_SUCCESS; + if(errno != EPLUGIN_NOTFOUND) { + error("Couldn't load specified plugin name for %s: %s", + c->select_type, plugin_strerror(errno)); + return SLURM_ERROR; + } + error("Couldn't find the specified plugin name for %s " "looking at all files", c->select_type); diff --git a/src/common/plugin.c b/src/common/plugin.c index 49321008bbd060e11751dc44299969f214d3f7f7..2981017526619e56e2f08b65f7add6f73fc39655 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -208,6 +208,7 @@ plugin_load_and_link(const char *type_name, int n_syms, char *head=NULL, *dir_array=NULL, *so_name = NULL, *file_name=NULL; int i=0; + plugin_err_t err = EPLUGIN_NOTFOUND; if (!type_name) return plug; @@ -240,15 +241,23 @@ plugin_load_and_link(const char *type_name, int n_syms, debug4("%s: Does not exist or not a regular file.", file_name); xfree(file_name); + err = EPLUGIN_NOTFOUND; } else { - plugin_load_from_file(&plug, file_name); - xfree(file_name); - if (plugin_get_syms(plug, n_syms, names, ptrs) >= - n_syms) { - debug3("Success."); - break; + if((err = plugin_load_from_file(&plug, file_name)) + == EPLUGIN_SUCCESS) { + if (plugin_get_syms(plug, n_syms, + names, ptrs) >= + n_syms) { + debug3("Success."); + xfree(file_name); + break; + } else { + err = EPLUGIN_MISSING_SYMBOL; + plug = PLUGIN_INVALID_HANDLE; + } } else plug = PLUGIN_INVALID_HANDLE; + xfree(file_name); } if (got_colon) { @@ -259,6 +268,7 @@ plugin_load_and_link(const char *type_name, int n_syms, xfree(dir_array); xfree(so_name); + errno = err; return plug; } /* diff --git a/src/common/slurm_accounting_storage.c b/src/common/slurm_accounting_storage.c index 2b4c4bb675c68231fb29bed043ec18d415a159cb..c8e5fd74a776234a19563bbc2a42845821ae979b 100644 --- a/src/common/slurm_accounting_storage.c +++ b/src/common/slurm_accounting_storage.c @@ -277,6 +277,12 @@ static slurm_acct_storage_ops_t * _acct_storage_get_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->acct_storage_type, plugin_strerror(errno)); + return NULL; + } + error("Couldn't find the specified plugin name for %s " "looking at all files", c->acct_storage_type); diff --git a/src/common/slurm_auth.c b/src/common/slurm_auth.c index 401914a754f7193cde0a2842ec6b28b2130c7265..6bc043af09be39bcc1b19355016dad72cfb1fcdb 100644 --- a/src/common/slurm_auth.c +++ b/src/common/slurm_auth.c @@ -146,6 +146,12 @@ slurm_auth_get_ops( slurm_auth_context_t c ) 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->auth_type, plugin_strerror(errno)); + return NULL; + } + error("Couldn't find the specified plugin name for %s " "looking at all files", c->auth_type); diff --git a/src/common/slurm_cred.c b/src/common/slurm_cred.c index 93cb804e79193b493d410c52aadf244da046d993..a382e5a7a866c2140458eb38a8560e65ca2e756b 100644 --- a/src/common/slurm_cred.c +++ b/src/common/slurm_cred.c @@ -355,6 +355,12 @@ _slurm_crypto_get_ops( slurm_crypto_context_t *c ) 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->crypto_type, plugin_strerror(errno)); + return NULL; + } + error("Couldn't find the specified plugin name for %s " "looking at all files", c->crypto_type); diff --git a/src/common/slurm_jobacct_gather.c b/src/common/slurm_jobacct_gather.c index 5a6830d6357ad5007b831e11e89b24678cfd2f7b..2cf9d23a59d75a98da5b70351dc88b355c4bb678 100644 --- a/src/common/slurm_jobacct_gather.c +++ b/src/common/slurm_jobacct_gather.c @@ -201,6 +201,12 @@ _slurm_jobacct_gather_get_ops( slurm_jobacct_gather_context_t *c ) 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->jobacct_gather_type, plugin_strerror(errno)); + return NULL; + } + error("Couldn't find the specified plugin name for %s " "looking at all files", c->jobacct_gather_type); diff --git a/src/common/slurm_jobcomp.c b/src/common/slurm_jobcomp.c index b7a3ccbd06809d48cace0bdfd039e4552cf460bd..df0da5f48246f019cec1311dff466ca6d984d09f 100644 --- a/src/common/slurm_jobcomp.c +++ b/src/common/slurm_jobcomp.c @@ -164,6 +164,12 @@ _slurm_jobcomp_get_ops( slurm_jobcomp_context_t c ) 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->jobcomp_type, plugin_strerror(errno)); + return NULL; + } + error("Couldn't find the specified plugin name for %s " "looking at all files", c->jobcomp_type); diff --git a/src/common/slurm_priority.c b/src/common/slurm_priority.c index 01237583e50afd45aa33a78409505728374bc242..f8fbd01bc16a99a84ad7f1cbf9c2dacbb621c7e8 100644 --- a/src/common/slurm_priority.c +++ b/src/common/slurm_priority.c @@ -98,6 +98,12 @@ static slurm_priority_ops_t * _priority_get_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->priority_type, plugin_strerror(errno)); + return NULL; + } + error("Couldn't find the specified plugin name for %s " "looking at all files", c->priority_type); diff --git a/src/common/slurm_topology.c b/src/common/slurm_topology.c index f93fe1b23253eb6296d9ec0c20f7dcf758ddd85d..8da99c8177ad06484d9034ef0a507395f78dcda9 100644 --- a/src/common/slurm_topology.c +++ b/src/common/slurm_topology.c @@ -96,6 +96,12 @@ slurm_topo_get_ops( slurm_topo_context_t *c ) 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->topo_type, plugin_strerror(errno)); + return NULL; + } + error("Couldn't find the specified plugin name for %s " "looking at all files", c->topo_type); diff --git a/src/common/switch.c b/src/common/switch.c index 6395284a60c232dd3cb881c63793fbd6ce1b7023..b4e2d559da079071f9b0c747b3c82ee61ea59c29 100644 --- a/src/common/switch.c +++ b/src/common/switch.c @@ -235,6 +235,12 @@ _slurm_switch_get_ops( slurm_switch_context_t *c ) 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->switch_type, plugin_strerror(errno)); + return NULL; + } + error("Couldn't find the specified plugin name for %s " "looking at all files", c->switch_type); diff --git a/src/slurmctld/job_submit.c b/src/slurmctld/job_submit.c index 8e8deacf4e6ffdddb16204878813d30ed3a7f59d..f2cc2ad1da84f8bce10d36cf7812f48a5f95984c 100644 --- a/src/slurmctld/job_submit.c +++ b/src/slurmctld/job_submit.c @@ -92,7 +92,7 @@ static slurm_submit_context_t *submit_context = NULL; static char *submit_plugin_list = NULL; static pthread_mutex_t submit_context_lock = PTHREAD_MUTEX_INITIALIZER; -static int _load_submit_plugin(char *plugin_name, +static int _load_submit_plugin(char *plugin_name, slurm_submit_context_t *plugin_context) { /* @@ -111,12 +111,19 @@ static int _load_submit_plugin(char *plugin_name, plugin_context->cur_plugin = PLUGIN_INVALID_HANDLE; plugin_context->sched_errno = SLURM_SUCCESS; - plugin_context->cur_plugin = plugin_load_and_link( - plugin_context->sched_type, + plugin_context->cur_plugin = plugin_load_and_link( + plugin_context->sched_type, n_syms, syms, (void **) &plugin_context->ops); - if (plugin_context->cur_plugin != PLUGIN_INVALID_HANDLE) - return SLURM_SUCCESS; + if (plugin_context->cur_plugin != PLUGIN_INVALID_HANDLE) + return SLURM_SUCCESS; + + if(errno != EPLUGIN_NOTFOUND) { + error("job_submit: Couldn't load specified plugin name " + "for %s: %s", + plugin_context->sched_type, plugin_strerror(errno)); + return SLURM_ERROR; + } error("job_submit: Couldn't find the specified plugin name for %s " "looking at all files", @@ -143,7 +150,7 @@ static int _load_submit_plugin(char *plugin_name, plugin_context->plugin_list, plugin_context->sched_type ); if (plugin_context->cur_plugin == PLUGIN_INVALID_HANDLE) { - error("job_submit: cannot find scheduler plugin for %s", + error("job_submit: cannot find scheduler plugin for %s", plugin_context->sched_type); return SLURM_ERROR; } @@ -200,9 +207,9 @@ extern int job_submit_plugin_init(void) names = xstrdup(submit_plugin_list); one_name = strtok_r(names, ",", &last); while (one_name) { - xrealloc(submit_context, (sizeof(slurm_submit_context_t) * + xrealloc(submit_context, (sizeof(slurm_submit_context_t) * (submit_context_cnt + 1))); - rc = _load_submit_plugin(one_name, + rc = _load_submit_plugin(one_name, submit_context + submit_context_cnt); if (rc != SLURM_SUCCESS) break; diff --git a/src/slurmctld/preempt.c b/src/slurmctld/preempt.c index 0cb509ffea9b7d23cde5ca1b2a7c2b0eefbe7d9a..50683621e9f8b799d9246d46122cd0ed6f9088af 100644 --- a/src/slurmctld/preempt.c +++ b/src/slurmctld/preempt.c @@ -94,6 +94,12 @@ static slurm_preempt_ops_t * 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->preempt_type, plugin_strerror(errno)); + return NULL; + } + error("Couldn't find the specified plugin name for %s " "looking at all files", c->preempt_type); diff --git a/src/slurmctld/sched_plugin.c b/src/slurmctld/sched_plugin.c index 6b62c5b9ee7b304cc3f76e557998802c36137642..fae4040bc4167b2ad1739ce7e6f703de67b58988 100644 --- a/src/slurmctld/sched_plugin.c +++ b/src/slurmctld/sched_plugin.c @@ -115,6 +115,12 @@ slurm_sched_get_ops( slurm_sched_context_t *c ) 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->sched_type, plugin_strerror(errno)); + return NULL; + } + error("sched: Couldn't find the specified plugin name for %s " "looking at all files", c->sched_type); diff --git a/src/slurmd/common/proctrack.c b/src/slurmd/common/proctrack.c index 5ede7e1e309c9b4de910f40df2f63e48f0eac7d9..4d3209b53e0b877a0f121fc3ee6d2c398a56667a 100644 --- a/src/slurmd/common/proctrack.c +++ b/src/slurmd/common/proctrack.c @@ -102,6 +102,12 @@ _proctrack_get_ops(slurm_proctrack_context_t * c) 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->proctrack_type, plugin_strerror(errno)); + return NULL; + } + error("Couldn't find the specified plugin name for %s " "looking at all files", c->proctrack_type); diff --git a/src/slurmd/common/task_plugin.c b/src/slurmd/common/task_plugin.c index 6fd9a09df1e96314d88b3beacd989d4eb0f752a0..d7f662a3a115d56ee1c7c6615b91447476ef1571 100644 --- a/src/slurmd/common/task_plugin.c +++ b/src/slurmd/common/task_plugin.c @@ -6,32 +6,32 @@ * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Written by Morris Jette <jette1@llnl.gov> * CODE-OCEC-09-009. All rights reserved. - * + * * This file is part of SLURM, a resource management program. * For details, see <https://computing.llnl.gov/linux/slurm/>. * 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 + * 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 + * 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. @@ -48,13 +48,13 @@ #include "src/slurmd/slurmstepd/slurmstepd_job.h" typedef struct slurmd_task_ops { - int (*slurmd_batch_request) (uint32_t job_id, + int (*slurmd_batch_request) (uint32_t job_id, batch_job_launch_msg_t *req); - int (*slurmd_launch_request) (uint32_t job_id, + int (*slurmd_launch_request) (uint32_t job_id, launch_tasks_request_msg_t *req, uint32_t node_id); - int (*slurmd_reserve_resources) (uint32_t job_id, - launch_tasks_request_msg_t *req, + int (*slurmd_reserve_resources) (uint32_t job_id, + launch_tasks_request_msg_t *req, uint32_t node_id); int (*slurmd_suspend_job) (uint32_t job_id); int (*slurmd_resume_job) (uint32_t job_id); @@ -97,15 +97,21 @@ _slurmd_task_get_ops(slurmd_task_context_t *c) int n_syms = sizeof( syms ) / sizeof( char * ); /* Find the correct plugin. */ - c->cur_plugin = plugin_load_and_link(c->task_type, n_syms, syms, + c->cur_plugin = plugin_load_and_link(c->task_type, n_syms, syms, (void **) &c->ops); - if ( c->cur_plugin != PLUGIN_INVALID_HANDLE ) - return &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->task_type, plugin_strerror(errno)); + return NULL; + } error("Couldn't find the specified plugin name for %s " "looking at all files", c->task_type); - + /* Get plugin list. */ if ( c->plugin_list == NULL ) { char *plugin_dir; @@ -191,7 +197,7 @@ extern int slurmd_task_init(void) { int retval = SLURM_SUCCESS; char *task_plugin_type = NULL; - + slurm_mutex_lock( &g_task_context_lock ); if ( g_task_context ) @@ -254,8 +260,8 @@ extern int slurmd_batch_request(uint32_t job_id, batch_job_launch_msg_t *req) * * RET - slurm error code */ -extern int slurmd_launch_request(uint32_t job_id, - launch_tasks_request_msg_t *req, +extern int slurmd_launch_request(uint32_t job_id, + launch_tasks_request_msg_t *req, uint32_t node_id) { if (slurmd_task_init()) @@ -269,8 +275,8 @@ extern int slurmd_launch_request(uint32_t job_id, * * RET - slurm error code */ -extern int slurmd_reserve_resources(uint32_t job_id, - launch_tasks_request_msg_t *req, +extern int slurmd_reserve_resources(uint32_t job_id, + launch_tasks_request_msg_t *req, uint32_t node_id ) { if (slurmd_task_init()) @@ -357,4 +363,3 @@ extern int post_term(slurmd_job_t *job) return (*(g_task_context->ops.post_term))(job); } -