platform/app/webui: ship the power-watch scenario baked into the image

platform.LocalScenariosDir (/usr/share/bee/scenarios, populated from
iso/overlay/usr/share/bee/scenarios/ by build.sh's overlay rsync) is now
checked before removable media for both `bee run <name>` and the "6.
Scenario" page — a scenario shipped with the image works with no USB
stick required. ReadScenario/ListAvailableScenarios merge local + USB;
the removable-media-only functions from the previous commit are kept
as-is (still used directly where that's actually what's wanted) rather
than renamed out from under existing callers/tests.

iso/overlay/usr/share/bee/scenarios/nvbandwidth-all-gpu-power-watch.json
is a copy of scenarios/nvbandwidth-all-gpu-power-watch.json — the two
aren't auto-synced (documented in scenarios/README.md), so shipping a
scenario baked-in means checking it into both places.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Mikhail Chusavitin
2026-07-28 19:10:35 +03:00
co-authored by Claude Sonnet 5
parent bcf02e0515
commit 5a780e96b4
11 changed files with 276 additions and 27 deletions
+7 -5
View File
@@ -485,10 +485,12 @@ func runSAT(args []string, stdout, stderr io.Writer) int {
const scenarioUsage = `usage: bee run <file.json | scenario-name>
A path (contains "/" or ends in ".json") is read directly from local disk.
A bare name is instead looked up as scenarios/<name>.json on any mounted
removable media (e.g. the same USB stick already plugged in for
blackbox) — lets an air-gapped engineer author a scenario on another
machine and drop it there without needing a network path onto the host.
A bare name is instead resolved as scenarios/<name>.json, checked first
against the scenarios shipped with this image (always available) and
then against any mounted removable media (e.g. the same USB stick
already plugged in for blackbox) — lets an air-gapped engineer author a
scenario on another machine and drop it there without needing a network
path onto the host.
See ParseScenarioJSON in audit/internal/platform/scenario.go for the file
format and a worked example (per-GPU/all-GPU load with concurrent IPMI/
@@ -525,7 +527,7 @@ func runScenario(args []string, stdout, stderr io.Writer) int {
if strings.Contains(arg, "/") || strings.HasSuffix(arg, ".json") {
data, err = os.ReadFile(arg)
} else {
data, err = sys.ReadScenarioFromRemovableMedia(arg)
data, err = sys.ReadScenario(arg)
}
if err != nil {
fmt.Fprintf(stderr, "bee run: %v\n", err)