static void _set_flags(GtkToggleAction *action) { char *temp = NULL; uint64_t debug_flags_plus = 0, debug_flags_minus = 0; uint64_t flag = (uint64_t)NO_VAL; const char *name; if (!action) return; name = gtk_action_get_name(GTK_ACTION(action)); if (!name) return; if (debug_str2flags((char *)name, &flag) != SLURM_SUCCESS) return; if (action && gtk_toggle_action_get_active(action)) debug_flags_plus |= flag; else debug_flags_minus |= flag; if (!slurm_set_debugflags(debug_flags_plus, debug_flags_minus)) temp = g_strdup_printf("Slurmctld DebugFlags reset"); else temp = g_strdup_printf("Problem with set DebugFlags request"); display_edit_note(temp); g_free(temp); }
static void _get_current_debug_flags(GtkToggleAction *action) { static uint64_t debug_flags = 0, tmp_flags; static slurm_ctl_conf_info_msg_t *slurm_ctl_conf_ptr = NULL; int err_code = get_new_info_config(&slurm_ctl_conf_ptr); GtkAction *debug_action = NULL; GtkToggleAction *toggle_action; gboolean orig_state, new_state; int i; if (err_code != SLURM_ERROR) debug_flags = slurm_ctl_conf_ptr->debug_flags; for (i = 0; i < debug_action_entries; i++) { debug_action = gtk_action_group_get_action( menu_action_group, debug_actions[i].name); toggle_action = GTK_TOGGLE_ACTION(debug_action); orig_state = gtk_toggle_action_get_active(toggle_action); if (debug_str2flags((char *)debug_actions[i].name, &tmp_flags) != SLURM_SUCCESS) { g_error("debug_str2flags no good: %s\n", debug_actions[i].name); continue; } new_state = debug_flags & tmp_flags; if (orig_state != new_state) gtk_toggle_action_set_active(toggle_action, new_state); } }
/* * read_slurmdbd_conf - load the SlurmDBD configuration from the slurmdbd.conf * file. Store result into global variable slurmdbd_conf. * This function can be called more than once. * RET SLURM_SUCCESS if no error, otherwise an error code */ extern int read_slurmdbd_conf(void) { s_p_options_t options[] = { {"ArchiveDir", S_P_STRING}, {"ArchiveEvents", S_P_BOOLEAN}, {"ArchiveJobs", S_P_BOOLEAN}, {"ArchiveResvs", S_P_BOOLEAN}, {"ArchiveScript", S_P_STRING}, {"ArchiveSteps", S_P_BOOLEAN}, {"ArchiveSuspend", S_P_BOOLEAN}, {"ArchiveTXN", S_P_BOOLEAN}, {"ArchiveUsage", S_P_BOOLEAN}, {"AuthInfo", S_P_STRING}, {"AuthType", S_P_STRING}, {"CommitDelay", S_P_UINT16}, {"DbdAddr", S_P_STRING}, {"DbdBackupHost", S_P_STRING}, {"DbdHost", S_P_STRING}, {"DbdPort", S_P_UINT16}, {"DebugFlags", S_P_STRING}, {"DebugLevel", S_P_STRING}, {"DebugLevelSyslog", S_P_STRING}, {"DefaultQOS", S_P_STRING}, {"JobPurge", S_P_UINT32}, {"LogFile", S_P_STRING}, {"LogTimeFormat", S_P_STRING}, {"MaxQueryTimeRange", S_P_STRING}, {"MessageTimeout", S_P_UINT16}, {"PidFile", S_P_STRING}, {"PluginDir", S_P_STRING}, {"PrivateData", S_P_STRING}, {"PurgeEventAfter", S_P_STRING}, {"PurgeJobAfter", S_P_STRING}, {"PurgeResvAfter", S_P_STRING}, {"PurgeStepAfter", S_P_STRING}, {"PurgeSuspendAfter", S_P_STRING}, {"PurgeTXNAfter", S_P_STRING}, {"PurgeUsageAfter", S_P_STRING}, {"PurgeEventMonths", S_P_UINT32}, {"PurgeJobMonths", S_P_UINT32}, {"PurgeStepMonths", S_P_UINT32}, {"PurgeSuspendMonths", S_P_UINT32}, {"PurgeTXNMonths", S_P_UINT32}, {"PurgeUsageMonths", S_P_UINT32}, {"SlurmUser", S_P_STRING}, {"StepPurge", S_P_UINT32}, {"StorageBackupHost", S_P_STRING}, {"StorageHost", S_P_STRING}, {"StorageLoc", S_P_STRING}, {"StoragePass", S_P_STRING}, {"StoragePort", S_P_UINT16}, {"StorageType", S_P_STRING}, {"StorageUser", S_P_STRING}, {"TCPTimeout", S_P_UINT16}, {"TrackWCKey", S_P_BOOLEAN}, {"TrackSlurmctldDown", S_P_BOOLEAN}, {NULL} }; s_p_hashtbl_t *tbl = NULL; char *conf_path = NULL; char *temp_str = NULL; struct stat buf; /* Set initial values */ slurm_mutex_lock(&conf_mutex); if (slurmdbd_conf == NULL) { slurmdbd_conf = xmalloc(sizeof(slurm_dbd_conf_t)); boot_time = time(NULL); } slurmdbd_conf->debug_level = LOG_LEVEL_INFO; _clear_slurmdbd_conf(); /* Get the slurmdbd.conf path and validate the file */ conf_path = get_extra_conf_path("slurmdbd.conf"); if ((conf_path == NULL) || (stat(conf_path, &buf) == -1)) { info("No slurmdbd.conf file (%s)", conf_path); } else { bool a_events = false, a_jobs = false, a_resv = false; bool a_steps = false, a_suspend = false, a_txn = false; bool a_usage = false; debug("Reading slurmdbd.conf file %s", conf_path); tbl = s_p_hashtbl_create(options); if (s_p_parse_file(tbl, NULL, conf_path, false) == SLURM_ERROR) { fatal("Could not open/read/parse slurmdbd.conf file %s", conf_path); } if (!s_p_get_string(&slurmdbd_conf->archive_dir, "ArchiveDir", tbl)) slurmdbd_conf->archive_dir = xstrdup(DEFAULT_SLURMDBD_ARCHIVE_DIR); s_p_get_boolean(&a_events, "ArchiveEvents", tbl); s_p_get_boolean(&a_jobs, "ArchiveJobs", tbl); s_p_get_boolean(&a_resv, "ArchiveResvs", tbl); s_p_get_string(&slurmdbd_conf->archive_script, "ArchiveScript", tbl); s_p_get_boolean(&a_steps, "ArchiveSteps", tbl); s_p_get_boolean(&a_suspend, "ArchiveSuspend", tbl); s_p_get_boolean(&a_txn, "ArchiveTXN", tbl); s_p_get_boolean(&a_usage, "ArchiveUsage", tbl); s_p_get_string(&slurmdbd_conf->auth_info, "AuthInfo", tbl); s_p_get_string(&slurmdbd_conf->auth_type, "AuthType", tbl); s_p_get_uint16(&slurmdbd_conf->commit_delay, "CommitDelay", tbl); s_p_get_string(&slurmdbd_conf->dbd_backup, "DbdBackupHost", tbl); s_p_get_string(&slurmdbd_conf->dbd_host, "DbdHost", tbl); s_p_get_string(&slurmdbd_conf->dbd_addr, "DbdAddr", tbl); s_p_get_uint16(&slurmdbd_conf->dbd_port, "DbdPort", tbl); if (s_p_get_string(&temp_str, "DebugFlags", tbl)) { if (debug_str2flags(temp_str, &slurmdbd_conf->debug_flags) != SLURM_SUCCESS) fatal("DebugFlags invalid: %s", temp_str); xfree(temp_str); } else /* Default: no DebugFlags */ slurmdbd_conf->debug_flags = 0; if (s_p_get_string(&temp_str, "DebugLevel", tbl)) { slurmdbd_conf->debug_level = log_string2num(temp_str); if (slurmdbd_conf->debug_level == NO_VAL16) fatal("Invalid DebugLevel %s", temp_str); xfree(temp_str); } s_p_get_string(&slurmdbd_conf->default_qos, "DefaultQOS", tbl); if (s_p_get_uint32(&slurmdbd_conf->purge_job, "JobPurge", tbl)) { if (!slurmdbd_conf->purge_job) slurmdbd_conf->purge_job = NO_VAL; else slurmdbd_conf->purge_job |= SLURMDB_PURGE_MONTHS; } s_p_get_string(&slurmdbd_conf->log_file, "LogFile", tbl); if (s_p_get_string(&temp_str, "DebugLevelSyslog", tbl)) { slurmdbd_conf->syslog_debug = log_string2num(temp_str); if (slurmdbd_conf->syslog_debug == NO_VAL16) fatal("Invalid DebugLevelSyslog %s", temp_str); xfree(temp_str); } if (s_p_get_string(&temp_str, "LogTimeFormat", tbl)) { if (xstrcasestr(temp_str, "iso8601_ms")) slurmdbd_conf->log_fmt = LOG_FMT_ISO8601_MS; else if (xstrcasestr(temp_str, "iso8601")) slurmdbd_conf->log_fmt = LOG_FMT_ISO8601; else if (xstrcasestr(temp_str, "rfc5424_ms")) slurmdbd_conf->log_fmt = LOG_FMT_RFC5424_MS; else if (xstrcasestr(temp_str, "rfc5424")) slurmdbd_conf->log_fmt = LOG_FMT_RFC5424; else if (xstrcasestr(temp_str, "clock")) slurmdbd_conf->log_fmt = LOG_FMT_CLOCK; else if (xstrcasestr(temp_str, "short")) slurmdbd_conf->log_fmt = LOG_FMT_SHORT; else if (xstrcasestr(temp_str, "thread_id")) slurmdbd_conf->log_fmt = LOG_FMT_THREAD_ID; xfree(temp_str); } else slurmdbd_conf->log_fmt = LOG_FMT_ISO8601_MS; if (s_p_get_string(&temp_str, "MaxQueryTimeRange", tbl)) { slurmdbd_conf->max_time_range = time_str2secs(temp_str); xfree(temp_str); } else { slurmdbd_conf->max_time_range = INFINITE; } if (!s_p_get_uint16(&slurmdbd_conf->msg_timeout, "MessageTimeout", tbl)) slurmdbd_conf->msg_timeout = DEFAULT_MSG_TIMEOUT; else if (slurmdbd_conf->msg_timeout > 100) { info("WARNING: MessageTimeout is too high for " "effective fault-tolerance"); } s_p_get_string(&slurmdbd_conf->pid_file, "PidFile", tbl); s_p_get_string(&slurmdbd_conf->plugindir, "PluginDir", tbl); slurmdbd_conf->private_data = 0; /* default visible to all */ if (s_p_get_string(&temp_str, "PrivateData", tbl)) { if (xstrcasestr(temp_str, "account")) slurmdbd_conf->private_data |= PRIVATE_DATA_ACCOUNTS; if (xstrcasestr(temp_str, "job")) slurmdbd_conf->private_data |= PRIVATE_DATA_JOBS; if (xstrcasestr(temp_str, "event")) slurmdbd_conf->private_data |= PRIVATE_DATA_EVENTS; if (xstrcasestr(temp_str, "node")) slurmdbd_conf->private_data |= PRIVATE_DATA_NODES; if (xstrcasestr(temp_str, "partition")) slurmdbd_conf->private_data |= PRIVATE_DATA_PARTITIONS; if (xstrcasestr(temp_str, "reservation")) slurmdbd_conf->private_data |= PRIVATE_DATA_RESERVATIONS; if (xstrcasestr(temp_str, "usage")) slurmdbd_conf->private_data |= PRIVATE_DATA_USAGE; if (xstrcasestr(temp_str, "user")) slurmdbd_conf->private_data |= PRIVATE_DATA_USERS; if (xstrcasestr(temp_str, "all")) slurmdbd_conf->private_data = 0xffff; xfree(temp_str); } if (s_p_get_string(&temp_str, "PurgeEventAfter", tbl)) { /* slurmdb_parse_purge will set SLURMDB_PURGE_FLAGS */ if ((slurmdbd_conf->purge_event = slurmdb_parse_purge(temp_str)) == NO_VAL) { fatal("Bad value \"%s\" for PurgeEventAfter", temp_str); } xfree(temp_str); } if (s_p_get_string(&temp_str, "PurgeJobAfter", tbl)) { /* slurmdb_parse_purge will set SLURMDB_PURGE_FLAGS */ if ((slurmdbd_conf->purge_job = slurmdb_parse_purge(temp_str)) == NO_VAL) { fatal("Bad value \"%s\" for PurgeJobAfter", temp_str); } xfree(temp_str); } if (s_p_get_string(&temp_str, "PurgeResvAfter", tbl)) { /* slurmdb_parse_purge will set SLURMDB_PURGE_FLAGS */ if ((slurmdbd_conf->purge_resv = slurmdb_parse_purge(temp_str)) == NO_VAL) { fatal("Bad value \"%s\" for PurgeResvAfter", temp_str); } xfree(temp_str); } if (s_p_get_string(&temp_str, "PurgeStepAfter", tbl)) { /* slurmdb_parse_purge will set SLURMDB_PURGE_FLAGS */ if ((slurmdbd_conf->purge_step = slurmdb_parse_purge(temp_str)) == NO_VAL) { fatal("Bad value \"%s\" for PurgeStepAfter", temp_str); } xfree(temp_str); } if (s_p_get_string(&temp_str, "PurgeSuspendAfter", tbl)) { /* slurmdb_parse_purge will set SLURMDB_PURGE_FLAGS */ if ((slurmdbd_conf->purge_suspend = slurmdb_parse_purge(temp_str)) == NO_VAL) { fatal("Bad value \"%s\" for PurgeSuspendAfter", temp_str); } xfree(temp_str); } if (s_p_get_string(&temp_str, "PurgeTXNAfter", tbl)) { /* slurmdb_parse_purge will set SLURMDB_PURGE_FLAGS */ if ((slurmdbd_conf->purge_txn = slurmdb_parse_purge(temp_str)) == NO_VAL) { fatal("Bad value \"%s\" for PurgeTXNAfter", temp_str); } xfree(temp_str); } if (s_p_get_string(&temp_str, "PurgeUsageAfter", tbl)) { /* slurmdb_parse_purge will set SLURMDB_PURGE_FLAGS */ if ((slurmdbd_conf->purge_usage = slurmdb_parse_purge(temp_str)) == NO_VAL) { fatal("Bad value \"%s\" for PurgeUsageAfter", temp_str); } xfree(temp_str); } if (s_p_get_uint32(&slurmdbd_conf->purge_event, "PurgeEventMonths", tbl)) { if (!slurmdbd_conf->purge_event) slurmdbd_conf->purge_event = NO_VAL; else slurmdbd_conf->purge_event |= SLURMDB_PURGE_MONTHS; } if (s_p_get_uint32(&slurmdbd_conf->purge_job, "PurgeJobMonths", tbl)) { if (!slurmdbd_conf->purge_job) slurmdbd_conf->purge_job = NO_VAL; else slurmdbd_conf->purge_job |= SLURMDB_PURGE_MONTHS; } if (s_p_get_uint32(&slurmdbd_conf->purge_step, "PurgeStepMonths", tbl)) { if (!slurmdbd_conf->purge_step) slurmdbd_conf->purge_step = NO_VAL; else slurmdbd_conf->purge_step |= SLURMDB_PURGE_MONTHS; } if (s_p_get_uint32(&slurmdbd_conf->purge_suspend, "PurgeSuspendMonths", tbl)) { if (!slurmdbd_conf->purge_suspend) slurmdbd_conf->purge_suspend = NO_VAL; else slurmdbd_conf->purge_suspend |= SLURMDB_PURGE_MONTHS; } if (s_p_get_uint32(&slurmdbd_conf->purge_txn, "PurgeTXNMonths", tbl)) { if (!slurmdbd_conf->purge_txn) slurmdbd_conf->purge_txn = NO_VAL; else slurmdbd_conf->purge_txn |= SLURMDB_PURGE_MONTHS; } if (s_p_get_uint32(&slurmdbd_conf->purge_usage, "PurgeUsageMonths", tbl)) { if (!slurmdbd_conf->purge_usage) slurmdbd_conf->purge_usage = NO_VAL; else slurmdbd_conf->purge_usage |= SLURMDB_PURGE_MONTHS; } s_p_get_string(&slurmdbd_conf->slurm_user_name, "SlurmUser", tbl); if (s_p_get_uint32(&slurmdbd_conf->purge_step, "StepPurge", tbl)) { if (!slurmdbd_conf->purge_step) slurmdbd_conf->purge_step = NO_VAL; else slurmdbd_conf->purge_step |= SLURMDB_PURGE_MONTHS; } s_p_get_string(&slurmdbd_conf->storage_backup_host, "StorageBackupHost", tbl); s_p_get_string(&slurmdbd_conf->storage_host, "StorageHost", tbl); s_p_get_string(&slurmdbd_conf->storage_loc, "StorageLoc", tbl); s_p_get_string(&slurmdbd_conf->storage_pass, "StoragePass", tbl); s_p_get_uint16(&slurmdbd_conf->storage_port, "StoragePort", tbl); s_p_get_string(&slurmdbd_conf->storage_type, "StorageType", tbl); s_p_get_string(&slurmdbd_conf->storage_user, "StorageUser", tbl); if (!s_p_get_uint16(&slurmdbd_conf->tcp_timeout, "TCPTimeout", tbl)) slurmdbd_conf->tcp_timeout = DEFAULT_TCP_TIMEOUT; if (!s_p_get_boolean((bool *)&slurmdbd_conf->track_wckey, "TrackWCKey", tbl)) slurmdbd_conf->track_wckey = false; if (!s_p_get_boolean((bool *)&slurmdbd_conf->track_ctld, "TrackSlurmctldDown", tbl)) slurmdbd_conf->track_ctld = false; if (a_events && slurmdbd_conf->purge_event) slurmdbd_conf->purge_event |= SLURMDB_PURGE_ARCHIVE; if (a_jobs && slurmdbd_conf->purge_job) slurmdbd_conf->purge_job |= SLURMDB_PURGE_ARCHIVE; if (a_resv && slurmdbd_conf->purge_resv) slurmdbd_conf->purge_resv |= SLURMDB_PURGE_ARCHIVE; if (a_steps && slurmdbd_conf->purge_step) slurmdbd_conf->purge_step |= SLURMDB_PURGE_ARCHIVE; if (a_suspend && slurmdbd_conf->purge_suspend) slurmdbd_conf->purge_suspend |= SLURMDB_PURGE_ARCHIVE; if (a_txn && slurmdbd_conf->purge_txn) slurmdbd_conf->purge_txn |= SLURMDB_PURGE_ARCHIVE; if (a_usage && slurmdbd_conf->purge_usage) slurmdbd_conf->purge_usage |= SLURMDB_PURGE_ARCHIVE; s_p_hashtbl_destroy(tbl); } xfree(conf_path); if (slurmdbd_conf->auth_type == NULL) slurmdbd_conf->auth_type = xstrdup(DEFAULT_SLURMDBD_AUTHTYPE); if (slurmdbd_conf->dbd_host == NULL) { error("slurmdbd.conf lacks DbdHost parameter, " "using 'localhost'"); slurmdbd_conf->dbd_host = xstrdup("localhost"); } if (slurmdbd_conf->dbd_addr == NULL) slurmdbd_conf->dbd_addr = xstrdup(slurmdbd_conf->dbd_host); if (slurmdbd_conf->pid_file == NULL) slurmdbd_conf->pid_file = xstrdup(DEFAULT_SLURMDBD_PIDFILE); if (slurmdbd_conf->dbd_port == 0) slurmdbd_conf->dbd_port = SLURMDBD_PORT; if (slurmdbd_conf->plugindir == NULL) slurmdbd_conf->plugindir = xstrdup(default_plugin_path); if (slurmdbd_conf->slurm_user_name) { uid_t pw_uid; if (uid_from_string (slurmdbd_conf->slurm_user_name, &pw_uid) < 0) fatal("Invalid user for SlurmUser %s, ignored", slurmdbd_conf->slurm_user_name); else slurmdbd_conf->slurm_user_id = pw_uid; } else { slurmdbd_conf->slurm_user_name = xstrdup("root"); slurmdbd_conf->slurm_user_id = 0; } if (slurmdbd_conf->storage_type == NULL) fatal("StorageType must be specified"); if (!xstrcmp(slurmdbd_conf->storage_type, "accounting_storage/slurmdbd")) { fatal("StorageType=%s is invalid in slurmdbd.conf", slurmdbd_conf->storage_type); } if (!slurmdbd_conf->storage_host) slurmdbd_conf->storage_host = xstrdup(DEFAULT_STORAGE_HOST); if (!slurmdbd_conf->storage_user) slurmdbd_conf->storage_user = xstrdup(getlogin()); if (!xstrcmp(slurmdbd_conf->storage_type, "accounting_storage/mysql")) { if (!slurmdbd_conf->storage_port) slurmdbd_conf->storage_port = DEFAULT_MYSQL_PORT; if (!slurmdbd_conf->storage_loc) slurmdbd_conf->storage_loc = xstrdup(DEFAULT_ACCOUNTING_DB); } else { if (!slurmdbd_conf->storage_port) slurmdbd_conf->storage_port = DEFAULT_STORAGE_PORT; if (!slurmdbd_conf->storage_loc) slurmdbd_conf->storage_loc = xstrdup(DEFAULT_STORAGE_LOC); } if (slurmdbd_conf->archive_dir) { if (stat(slurmdbd_conf->archive_dir, &buf) < 0) fatal("Failed to stat the archive directory %s: %m", slurmdbd_conf->archive_dir); if (!(buf.st_mode & S_IFDIR)) fatal("archive directory %s isn't a directory", slurmdbd_conf->archive_dir); if (access(slurmdbd_conf->archive_dir, W_OK) < 0) fatal("archive directory %s is not writable", slurmdbd_conf->archive_dir); } if (slurmdbd_conf->archive_script) { if (stat(slurmdbd_conf->archive_script, &buf) < 0) fatal("Failed to stat the archive script %s: %m", slurmdbd_conf->archive_dir); if (!(buf.st_mode & S_IFREG)) fatal("archive script %s isn't a regular file", slurmdbd_conf->archive_script); if (access(slurmdbd_conf->archive_script, X_OK) < 0) fatal("archive script %s is not executable", slurmdbd_conf->archive_script); } if (!slurmdbd_conf->purge_event) slurmdbd_conf->purge_event = NO_VAL; if (!slurmdbd_conf->purge_job) slurmdbd_conf->purge_job = NO_VAL; if (!slurmdbd_conf->purge_resv) slurmdbd_conf->purge_resv = NO_VAL; if (!slurmdbd_conf->purge_step) slurmdbd_conf->purge_step = NO_VAL; if (!slurmdbd_conf->purge_suspend) slurmdbd_conf->purge_suspend = NO_VAL; if (!slurmdbd_conf->purge_txn) slurmdbd_conf->purge_txn = NO_VAL; if (!slurmdbd_conf->purge_usage) slurmdbd_conf->purge_usage = NO_VAL; slurm_mutex_unlock(&conf_mutex); return SLURM_SUCCESS; }