From 242786b6c062f2ff96ef9dced69f533def6040e8 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 4 Sep 2024 21:27:13 -0700 Subject: [PATCH] scheduler: fix WSL plan class admin web: fix bug in opening DB --- html/inc/boinc_db.inc | 2 +- html/ops/db_update.php | 4 ++-- sched/plan_class_spec.cpp | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/html/inc/boinc_db.inc b/html/inc/boinc_db.inc index ff3b4c20d4..9c0d328621 100644 --- a/html/inc/boinc_db.inc +++ b/html/inc/boinc_db.inc @@ -108,7 +108,7 @@ class BoincDb { if (self::$dbnum == $dbnum) { return self::$instance; } - close(); + self::close(); } if (web_stopped()) { if ($generating_xml) { diff --git a/html/ops/db_update.php b/html/ops/db_update.php index 509eb10fcf..943d66521d 100644 --- a/html/ops/db_update.php +++ b/html/ops/db_update.php @@ -22,9 +22,9 @@ $cli_only = true; require_once("../inc/util_ops.inc"); -$db = BoincDb::get_aux(false); +$db = BoincDb::get(0); if (!$db) { - echo "Can't open database\n"; + echo "db_update.php: Can't open database\n"; exit; } diff --git a/sched/plan_class_spec.cpp b/sched/plan_class_spec.cpp index da66de9c90..5b93ef2d0e 100644 --- a/sched/plan_class_spec.cpp +++ b/sched/plan_class_spec.cpp @@ -157,6 +157,8 @@ static bool wu_is_infeasible_for_plan_class( return false; } +// parse plan_class_spec.xml +// int PLAN_CLASS_SPECS::parse_file(const char* path) { FILE* f = boinc::fopen(path, "r"); if (!f) return ERR_FOPEN; @@ -544,7 +546,7 @@ bool PLAN_CLASS_SPEC::check( } if (wsl) { - if (!sreq.host.wsl_available) { + if (sreq.host.wsl_distros.distros.empty()) { add_no_work_message("WSL is not available on this host"); return false; } @@ -1106,6 +1108,7 @@ int PLAN_CLASS_SPEC::parse(XML_PARSER& xp) { if (xp.parse_bool("cal", cal)) continue; if (xp.parse_bool("opencl", opencl)) continue; if (xp.parse_bool("virtualbox", virtualbox)) continue; + if (xp.parse_bool("wsl", wsl)) continue; if (xp.parse_bool("is64bit", is64bit)) continue; if (xp.parse_str("cpu_feature", buf, sizeof(buf))) { cpu_features.push_back(" " + (string)buf + " "); @@ -1244,7 +1247,6 @@ int PLAN_CLASS_SPECS::parse_specs(FILE* f) { return ERR_XML_PARSE; } - PLAN_CLASS_SPEC::PLAN_CLASS_SPEC() { strcpy(name, ""); strcpy(gpu_type, ""); @@ -1252,6 +1254,7 @@ PLAN_CLASS_SPEC::PLAN_CLASS_SPEC() { cal = false; opencl = false; virtualbox = false; + wsl = false; is64bit = false; min_ncpus = 0; max_threads = 1;