diff --git a/doc/man/man5/slurm.conf.5 b/doc/man/man5/slurm.conf.5 index dc61cb71c7eb216d418781c8a926a55a551bc3a8..3c78afd8669cbbf146eef076e008763c5896e87b 100644 --- a/doc/man/man5/slurm.conf.5 +++ b/doc/man/man5/slurm.conf.5 @@ -213,6 +213,15 @@ The \fBscontrol\fR command can be used to change job priorities. The \fBslurmctld\fR daemon must be restarted for a change in scheduler type to become effective. .TP +\fBSelectType\fR +Identifies the type of node selection algorithm to be used. +Acceptable values include +"select/linear" for a one-dimentional array of nodes in which +sequentially ordered nodes are preferable, and +"select/bluegene" for a three-dimentional Blue Gene system. +The default value is "select/bgl" for Blue Gene systems +and "select/linear" for all other systems. +.TP \fBSlurmUser\fR The name of the user that the \fBslurmctld\fR daemon executes as. For security purposes, a user other than "root" is recommended. diff --git a/slurm/slurm.h.in b/slurm/slurm.h.in index 4a33cad7da757946364cab841498399153fe92f0..61d4263a29458273e4b9756c1cdea439e48c5998 100644 --- a/slurm/slurm.h.in +++ b/slurm/slurm.h.in @@ -447,6 +447,7 @@ typedef struct slurm_ctl_conf { char *schedtype; /* type of scheduler to use */ char *schedauth; /* credential for scheduler (if needed) */ uint16_t schedport; /* port for scheduler connection */ + char *select_type; /* type of node selector to use */ uint16_t slurm_user_id; /* uid of slurm_user_name */ char *slurm_user_name; /* user that slurmctld runs as */ uint16_t slurmctld_debug; /* slurmctld logging level */ diff --git a/slurm/slurm_errno.h b/slurm/slurm_errno.h index befbbdd24dbfb463f51fba4011e4e9a8a7cf307c..398d80e9ff1f692c41dc64e777b59ba844238a43 100644 --- a/slurm/slurm_errno.h +++ b/slurm/slurm_errno.h @@ -127,6 +127,7 @@ enum { ESLURM_INVALID_AUTHTYPE_CHANGE, ESLURM_INVALID_CHECKPOINT_TYPE_CHANGE, ESLURM_INVALID_SCHEDTYPE_CHANGE, + ESLURM_INVALID_SELECTTYPE_CHANGE, ESLURM_INVALID_SWITCHTYPE_CHANGE, ESLURM_FRAGMENTATION, ESLURM_NOT_SUPPORTED, diff --git a/src/api/config_info.c b/src/api/config_info.c index 31caf68fe919ac49c005fe5bb30837e493307e53..5071d01b5c877bc092373f0b7b8ab568e17704b3 100644 --- a/src/api/config_info.c +++ b/src/api/config_info.c @@ -115,6 +115,8 @@ void slurm_print_ctl_conf ( FILE* out, slurm_ctl_conf_ptr->schedport); fprintf(out, "SchedulerType = %s\n", slurm_ctl_conf_ptr->schedtype); + fprintf(out, "SelectType = %s\n", + slurm_ctl_conf_ptr->select_type); fprintf(out, "SlurmUser = %s(%u)\n", slurm_ctl_conf_ptr->slurm_user_name, slurm_ctl_conf_ptr->slurm_user_id); diff --git a/src/common/read_config.c b/src/common/read_config.c index 89df213f743a9fb2e7ad7a3360dbeca449db9c3d..a73bba69f0684fc90ed84851b0c861f1a8b1515f 100644 --- a/src/common/read_config.c +++ b/src/common/read_config.c @@ -108,6 +108,7 @@ free_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr) xfree (ctl_conf_ptr->prolog); xfree (ctl_conf_ptr->schedauth); xfree (ctl_conf_ptr->schedtype); + xfree (ctl_conf_ptr->select_type); xfree (ctl_conf_ptr->slurm_conf); xfree (ctl_conf_ptr->slurm_user_name); xfree (ctl_conf_ptr->slurmctld_logfile); @@ -155,6 +156,7 @@ init_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr) xfree( ctl_conf_ptr->schedauth ); ctl_conf_ptr->schedport = (uint16_t) NO_VAL; xfree( ctl_conf_ptr->schedtype ); + xfree( ctl_conf_ptr->select_type ); ctl_conf_ptr->slurm_user_id = (uint16_t) NO_VAL; xfree (ctl_conf_ptr->slurm_user_name); ctl_conf_ptr->slurmctld_debug = (uint16_t) NO_VAL; @@ -205,6 +207,7 @@ parse_config_spec (char *in_line, slurm_ctl_conf_t *ctl_conf_ptr) char *control_machine = NULL, *epilog = NULL; char *prolog = NULL; char *sched_type = NULL, *sched_auth = NULL; + char *select_type = NULL; char *state_save_location = NULL, *tmp_fs = NULL; char *slurm_user = NULL, *slurmctld_pidfile = NULL; char *slurmctld_logfile = NULL; @@ -243,6 +246,7 @@ parse_config_spec (char *in_line, slurm_ctl_conf_t *ctl_conf_ptr) "SchedulerAuth=", 's', &sched_auth, "SchedulerPort=", 'd', &sched_port, "SchedulerType=", 's', &sched_type, + "SelectType=", 's', &select_type, "SlurmUser=", 's', &slurm_user, "SlurmctldDebug=", 'd', &slurmctld_debug, "SlurmctldLogFile=", 's', &slurmctld_logfile, @@ -454,7 +458,14 @@ parse_config_spec (char *in_line, slurm_ctl_conf_t *ctl_conf_ptr) } ctl_conf_ptr->schedtype = sched_type; } - + + if ( select_type ) { + if ( ctl_conf_ptr->select_type ) { + xfree( ctl_conf_ptr->select_type ); + } + ctl_conf_ptr->select_type = select_type; + } + if ( slurm_user ) { struct passwd *slurm_passwd; slurm_passwd = getpwnam(slurm_user); @@ -881,6 +892,9 @@ validate_config (slurm_ctl_conf_t *ctl_conf_ptr) if (ctl_conf_ptr->schedtype == NULL) ctl_conf_ptr->schedtype = xstrdup(DEFAULT_SCHEDTYPE); + if (ctl_conf_ptr->select_type == NULL) + ctl_conf_ptr->select_type = xstrdup(DEFAULT_SELECT_TYPE); + if (ctl_conf_ptr->slurm_user_name == NULL) { ctl_conf_ptr->slurm_user_name = xstrdup("root"); ctl_conf_ptr->slurm_user_id = 0; diff --git a/src/common/read_config.h b/src/common/read_config.h index 22bda944df389eb05f6bf55ca14430907aa593ba..3eda63edbf941523cfd85dab4029f2fa065ab23d 100644 --- a/src/common/read_config.h +++ b/src/common/read_config.h @@ -45,6 +45,7 @@ #define DEFAULT_RETURN_TO_SERVICE 0 #define DEFAULT_SAVE_STATE_LOC "/tmp" #define DEFAULT_SCHEDTYPE "sched/builtin" +#define DEFAULT_SELECT_TYPE "select/linear" #define DEFAULT_SLURMCTLD_PIDFILE "/var/run/slurmctld.pid" #define DEFAULT_SLURMCTLD_TIMEOUT 120 #define DEFAULT_SLURMD_PIDFILE "/var/run/slurmd.pid" diff --git a/src/common/slurm_errno.c b/src/common/slurm_errno.c index 35967e9f6dae4667198e673af05247be1468d92d..41d3426ce2f4acaaf752baadf817c0f1e61e921d 100644 --- a/src/common/slurm_errno.c +++ b/src/common/slurm_errno.c @@ -158,6 +158,8 @@ static slurm_errtab_t slurm_errtab[] = { "Invalid change in CheckpointType requested" }, { ESLURM_INVALID_SCHEDTYPE_CHANGE, "Invalid change in SchedulerType requested" }, + { ESLURM_INVALID_SELECTTYPE_CHANGE, + "Invalid change in SelectType requested" }, { ESLURM_INVALID_SWITCHTYPE_CHANGE, "SwitchType change requires restart of all SLURM daemons and jobs"}, { ESLURM_FRAGMENTATION, diff --git a/src/common/slurm_protocol_api.c b/src/common/slurm_protocol_api.c index c6353b6ca2ac0245fee89470ed2fd68537f6e4a2..68a3eaea134c88c2542cdebcfc99089973dcb506 100644 --- a/src/common/slurm_protocol_api.c +++ b/src/common/slurm_protocol_api.c @@ -282,6 +282,20 @@ char *slurm_get_sched_type(void) return sched_type; } +/* slurm_get_select_type + * get select_type from slurmctld_conf object + * RET char * - select_type, MUST be xfreed by caller + */ +char *slurm_get_select_type(void) +{ + char *select_type; + + _lock_update_config(); + select_type = xstrdup(slurmctld_conf.select_type); + slurm_mutex_unlock(&config_lock); + return select_type; +} + /* slurm_get_switch_type * get switch type from slurmctld_conf object * RET char * - switch type, MUST be xfreed by caller diff --git a/src/common/slurm_protocol_api.h b/src/common/slurm_protocol_api.h index 9be86e7ede48fdd4ff153df1182b918a0278799b..386c4181e4f5ccedc2d9cf9b3a4ce855984d892a 100644 --- a/src/common/slurm_protocol_api.h +++ b/src/common/slurm_protocol_api.h @@ -143,6 +143,12 @@ uint32_t slurm_get_slurm_user_id(void); */ char *slurm_get_sched_type(void); +/* slurm_get_select_type + * get select_type from slurmctld_conf object + * RET char * - select_type, MUST be xfreed by caller + */ +char *slurm_get_select_type(void); + /* slurm_get_switch_type * get switch type from slurmctld_conf object * RET char * - switch type, MUST be xfreed by caller diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c index f63d670c8c611b4e3f9fe77411e28126b6d98499..29eab7c2f8ffe3ca3b5c28dd04e25eccc7deb30f 100644 --- a/src/common/slurm_protocol_pack.c +++ b/src/common/slurm_protocol_pack.c @@ -1698,6 +1698,7 @@ _pack_slurm_ctl_conf_msg(slurm_ctl_conf_info_msg_t * build_ptr, Buf buffer) packstr(build_ptr->schedauth, buffer); pack16(build_ptr->schedport, buffer); packstr(build_ptr->schedtype, buffer); + packstr(build_ptr->select_type, buffer); pack16(build_ptr->slurm_user_id, buffer); packstr(build_ptr->slurm_user_name, buffer); pack16(build_ptr->slurmctld_debug, buffer); @@ -1760,6 +1761,7 @@ _unpack_slurm_ctl_conf_msg(slurm_ctl_conf_info_msg_t ** safe_unpackstr_xmalloc(&build_ptr->schedauth, &uint16_tmp, buffer); safe_unpack16(&build_ptr->schedport, buffer); safe_unpackstr_xmalloc(&build_ptr->schedtype, &uint16_tmp, buffer); + safe_unpackstr_xmalloc(&build_ptr->select_type, &uint16_tmp, buffer); safe_unpack16(&build_ptr->slurm_user_id, buffer); safe_unpackstr_xmalloc(&build_ptr->slurm_user_name, &uint16_tmp, buffer); diff --git a/src/slurmctld/proc_req.c b/src/slurmctld/proc_req.c index f8a30329e61b2bccb989350a1f4ca025311fa7c5..6547f3ea1908c1df80bbbfdc0e07ed40a24a8628 100644 --- a/src/slurmctld/proc_req.c +++ b/src/slurmctld/proc_req.c @@ -270,6 +270,7 @@ void _fill_ctld_conf(slurm_ctl_conf_t * conf_ptr) conf_ptr->schedauth = xstrdup(slurmctld_conf.schedauth); conf_ptr->schedport = slurmctld_conf.schedport; conf_ptr->schedtype = xstrdup(slurmctld_conf.schedtype); + conf_ptr->select_type = xstrdup(slurmctld_conf.select_type); conf_ptr->slurm_user_id = slurmctld_conf.slurm_user_id; conf_ptr->slurm_user_name = xstrdup(slurmctld_conf. slurm_user_name); diff --git a/src/slurmctld/read_config.c b/src/slurmctld/read_config.c index 6b0c132e058f57e676543ae285d6a6e1bc8871b4..7953eb415c4db6d2b67d89d5baafd9068d65d1af 100644 --- a/src/slurmctld/read_config.c +++ b/src/slurmctld/read_config.c @@ -66,7 +66,8 @@ static void _restore_node_state(struct node_record *old_node_table_ptr, int old_node_record_count); static int _preserve_plugins(slurm_ctl_conf_t * ctl_conf_ptr, char *old_auth_type, char *old_checkpoint_type, - char *old_sched_type, char *old_switch_type); + char *old_sched_type, char *old_select_type, + char *old_switch_type); static int _sync_nodes_to_comp_job(void); static int _sync_nodes_to_jobs(void); static int _sync_nodes_to_active_job(struct job_record *job_ptr); @@ -728,6 +729,7 @@ int read_slurm_conf(int recover) char *old_auth_type = xstrdup(slurmctld_conf.authtype); char *old_checkpoint_type = xstrdup(slurmctld_conf.checkpoint_type); char *old_sched_type = xstrdup(slurmctld_conf.schedtype); + char *old_select_type = xstrdup(slurmctld_conf.select_type); char *old_switch_type = xstrdup(slurmctld_conf.switch_type); /* initialization */ @@ -864,7 +866,8 @@ int read_slurm_conf(int recover) /* Update plugins as possible */ error_code = _preserve_plugins(&slurmctld_conf, old_auth_type, old_checkpoint_type, - old_sched_type, old_switch_type); + old_sched_type, old_select_type, + old_switch_type); slurmctld_conf.last_update = time(NULL); END_TIMER; @@ -918,7 +921,8 @@ static void _purge_old_node_state(struct node_record *old_node_table_ptr, */ static int _preserve_plugins(slurm_ctl_conf_t * ctl_conf_ptr, char *old_auth_type, char *old_checkpoint_type, - char *old_sched_type, char *old_switch_type) + char *old_sched_type, char *old_select_type, + char *old_switch_type) { int rc = SLURM_SUCCESS; @@ -950,6 +954,16 @@ static int _preserve_plugins(slurm_ctl_conf_t * ctl_conf_ptr, xfree(old_sched_type); } + + if (old_select_type) { + if (strcmp(old_select_type, ctl_conf_ptr->select_type)) { + xfree(ctl_conf_ptr->select_type); + ctl_conf_ptr->select_type = old_select_type; + rc = ESLURM_INVALID_SELECTTYPE_CHANGE; + } else /* free duplicate value */ + xfree(old_select_type); + } + if (old_switch_type) { if (strcmp(old_switch_type, ctl_conf_ptr->switch_type)) { xfree(ctl_conf_ptr->switch_type);