fix(easy_bee): fall back to bundled NVIDIA bug report without bee-audit.json
BEE-SP v14.08 bundles from Dell R7715 were captured while bee-audit.service was still running (stuck in ipmitool sensor), so bee-audit.json was missing and import failed with "easy-bee snapshot not found". Rebuild board, CPU, DIMM, GPU and NIC inventory from export/gpu/nvidia-bug-report.txt, add an Incomplete Audit warning, and name the audit service state in the error when no fallback source exists. ADL-076. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
29371f69ee
commit
9f5f7a98be
5 files changed
+236
-3
No files matched your search
+98
@@ -0,0 +1,98 @@
|
||||
package easy_bee
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"git.mchus.pro/mchus/logpile/internal/models"
|
||||
"git.mchus.pro/mchus/logpile/internal/parser"
|
||||
"git.mchus.pro/mchus/logpile/internal/parser/vendors/nvidia_bug_report"
|
||||
)
|
||||
|
||||
// parseWithoutSnapshot handles bundles captured before bee-audit finished
|
||||
// writing bee-audit.json. The NVIDIA bug report bundled under export/gpu/
|
||||
// carries dmidecode, lspci and nvidia-smi output for the whole host, so it
|
||||
// is used to rebuild a reduced inventory instead of failing the import.
|
||||
func parseWithoutSnapshot(files []parser.ExtractedFile, manifest manifestMetadata) (*models.AnalysisResult, error) {
|
||||
auditState := beeAuditServiceState(files)
|
||||
|
||||
report := findNvidiaBugReport(files)
|
||||
if report == nil {
|
||||
return nil, fmt.Errorf("easy-bee snapshot not found: %s", describeMissingSnapshot(auditState))
|
||||
}
|
||||
|
||||
result, err := (&nvidia_bug_report.Parser{}).Parse([]parser.ExtractedFile{*report})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("easy-bee snapshot not found, fallback to %s failed: %w", report.Path, err)
|
||||
}
|
||||
if result.Hardware == nil || (result.Hardware.BoardInfo.SerialNumber == "" &&
|
||||
len(result.Hardware.CPUs) == 0 &&
|
||||
len(result.Hardware.Memory) == 0 &&
|
||||
len(result.Hardware.GPUs) == 0) {
|
||||
return nil, fmt.Errorf("easy-bee snapshot not found: %s; %s has no inventory", describeMissingSnapshot(auditState), report.Path)
|
||||
}
|
||||
|
||||
result.TargetHost = firstNonEmpty(result.TargetHost, manifest.Host)
|
||||
if result.CollectedAt.IsZero() && !manifest.GeneratedAtUTC.IsZero() {
|
||||
result.CollectedAt = manifest.GeneratedAtUTC.UTC()
|
||||
}
|
||||
result.TopologyEvidence = collectTopologyEvidence(files)
|
||||
|
||||
if pn := chassisProductPartNumber(files, result.Hardware.BoardInfo.ProductName); pn != "" {
|
||||
result.Hardware.BoardInfo.PartNumber = pn
|
||||
}
|
||||
if len(result.FRU) == 0 {
|
||||
if boardFRU, ok := buildBoardFRU(result.Hardware.BoardInfo); ok {
|
||||
result.FRU = append(result.FRU, boardFRU)
|
||||
}
|
||||
}
|
||||
|
||||
result.Events = append(result.Events, models.Event{
|
||||
Source: "Bee Audit",
|
||||
EventType: "Incomplete Audit",
|
||||
Severity: models.SeverityWarning,
|
||||
Description: fmt.Sprintf("%s; inventory reconstructed from %s (storage, PSU and sensors unavailable)", describeMissingSnapshot(auditState), pathBase(report.Path)),
|
||||
})
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func findNvidiaBugReport(files []parser.ExtractedFile) *parser.ExtractedFile {
|
||||
for i := range files {
|
||||
name := strings.ToLower(pathBase(files[i].Path))
|
||||
if strings.HasPrefix(name, "nvidia-bug-report") &&
|
||||
(strings.HasSuffix(name, ".txt") || strings.HasSuffix(name, ".log")) &&
|
||||
len(files[i].Content) > 0 {
|
||||
return &files[i]
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// beeAuditServiceState returns the systemd "Active:" line of bee-audit.service
|
||||
// captured in the bundle, e.g. "activating (start) since ... ; 2min 22s ago".
|
||||
func beeAuditServiceState(files []parser.ExtractedFile) string {
|
||||
for _, f := range files {
|
||||
if !strings.EqualFold(pathBase(f.Path), "bee-audit.service.status.txt") {
|
||||
continue
|
||||
}
|
||||
for _, line := range strings.Split(string(f.Content), "\n") {
|
||||
line = strings.TrimSpace(line)
|
||||
if state, ok := strings.CutPrefix(line, "Active:"); ok {
|
||||
return strings.TrimSpace(state)
|
||||
}
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func describeMissingSnapshot(auditState string) string {
|
||||
switch {
|
||||
case auditState == "":
|
||||
return "bee-audit.json is missing from the bundle"
|
||||
case strings.HasPrefix(auditState, "activating"):
|
||||
return "bee-audit.json is missing: bee-audit.service had not finished when the bundle was captured (" + auditState + ")"
|
||||
default:
|
||||
return "bee-audit.json is missing (bee-audit.service: " + auditState + ")"
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
package easy_bee
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.mchus.pro/mchus/logpile/internal/models"
|
||||
"git.mchus.pro/mchus/logpile/internal/parser"
|
||||
)
|
||||
|
||||
const incompleteAuditPrefix = "bee-support-stage-easy-bee-nvidia-v14-08-20260917-211720"
|
||||
|
||||
func incompleteAuditFiles(withReport bool) []parser.ExtractedFile {
|
||||
files := []parser.ExtractedFile{
|
||||
{
|
||||
Path: incompleteAuditPrefix + "/manifest.txt",
|
||||
Content: []byte("bee_version=14.08\nhost=easy-bee-nvidia-v14-08\ngenerated_at_utc=2026-09-17T21:17:37Z\nexport_dir=/appdata/bee/export\n"),
|
||||
},
|
||||
{
|
||||
Path: incompleteAuditPrefix + "/status/runtime-health.json",
|
||||
Content: []byte(`{"status":"OK"}`),
|
||||
},
|
||||
{
|
||||
Path: incompleteAuditPrefix + "/tasks/_services/bee-audit.service.status.txt",
|
||||
Content: []byte("● bee-audit.service - Bee: hardware audit\n" +
|
||||
" Loaded: loaded (/etc/systemd/system/bee-audit.service; enabled; preset: enabled)\n" +
|
||||
" Active: activating (start) since Thu 2026-09-17 21:14:58 UTC; 2min 22s ago\n"),
|
||||
},
|
||||
}
|
||||
if withReport {
|
||||
files = append(files, parser.ExtractedFile{
|
||||
Path: incompleteAuditPrefix + "/export/gpu/nvidia-bug-report.txt",
|
||||
Content: []byte(`NVIDIA bug report log file
|
||||
nvidia-bug-report.sh Version: 1
|
||||
Date: Thu Sep 17 21:17:21 UTC 2026
|
||||
System Information
|
||||
Manufacturer: Dell Inc.
|
||||
Product Name: PowerEdge R7715
|
||||
Serial Number: 3VVFYL4
|
||||
|
||||
Processor Information
|
||||
Version: AMD EPYC 9255 24-Core Processor
|
||||
Core Count: 24
|
||||
Thread Count: 48
|
||||
Status: Populated, Enabled
|
||||
|
||||
Memory Device
|
||||
Size: 32 GB
|
||||
Locator: A1
|
||||
Type: DDR5
|
||||
Manufacturer: Samsung
|
||||
Serial Number: 01C12D98
|
||||
Part Number: M321R4GA3EB2-CCPKF
|
||||
`),
|
||||
})
|
||||
}
|
||||
return files
|
||||
}
|
||||
|
||||
// Bundles captured while bee-audit.service was still running have no
|
||||
// bee-audit.json; inventory is rebuilt from the bundled NVIDIA bug report.
|
||||
func TestParseFallsBackToNvidiaBugReportWhenAuditIncomplete(t *testing.T) {
|
||||
p := &Parser{}
|
||||
files := incompleteAuditFiles(true)
|
||||
if got := p.Detect(files); got < 50 {
|
||||
t.Fatalf("expected easy-bee detection without snapshot, got %d", got)
|
||||
}
|
||||
|
||||
result, err := p.Parse(files)
|
||||
if err != nil {
|
||||
t.Fatalf("parse: %v", err)
|
||||
}
|
||||
if result.Hardware.BoardInfo.SerialNumber != "3VVFYL4" || result.Hardware.BoardInfo.ProductName != "PowerEdge R7715" {
|
||||
t.Fatalf("unexpected board: %+v", result.Hardware.BoardInfo)
|
||||
}
|
||||
if len(result.Hardware.CPUs) != 1 || len(result.Hardware.Memory) != 1 {
|
||||
t.Fatalf("expected 1 CPU and 1 DIMM, got %d/%d", len(result.Hardware.CPUs), len(result.Hardware.Memory))
|
||||
}
|
||||
if result.TargetHost != "easy-bee-nvidia-v14-08" {
|
||||
t.Fatalf("unexpected target host %q", result.TargetHost)
|
||||
}
|
||||
if got := result.CollectedAt.Format("2006-01-02T15:04:05Z"); got != "2026-09-17T21:17:21Z" {
|
||||
t.Fatalf("unexpected collected_at %s", got)
|
||||
}
|
||||
|
||||
var notice *models.Event
|
||||
for i := range result.Events {
|
||||
if result.Events[i].EventType == "Incomplete Audit" {
|
||||
notice = &result.Events[i]
|
||||
}
|
||||
}
|
||||
if notice == nil {
|
||||
t.Fatalf("expected incomplete audit event, got %+v", result.Events)
|
||||
}
|
||||
if !notice.Timestamp.IsZero() || notice.Severity != models.SeverityWarning ||
|
||||
!strings.Contains(notice.Description, "had not finished") {
|
||||
t.Fatalf("unexpected incomplete audit event: %+v", notice)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseWithoutSnapshotOrFallbackExplainsAuditState(t *testing.T) {
|
||||
_, err := (&Parser{}).Parse(incompleteAuditFiles(false))
|
||||
if err == nil {
|
||||
t.Fatal("expected error")
|
||||
}
|
||||
if msg := err.Error(); !strings.Contains(msg, "bee-audit.service had not finished") ||
|
||||
!strings.Contains(msg, "activating (start)") {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -11,7 +11,7 @@ import (
|
||||
"git.mchus.pro/mchus/logpile/internal/parser"
|
||||
)
|
||||
|
||||
const parserVersion = "1.1"
|
||||
const parserVersion = "1.2"
|
||||
|
||||
func init() {
|
||||
parser.Register(&Parser{})
|
||||
@@ -90,7 +90,7 @@ func (p *Parser) Detect(files []parser.ExtractedFile) int {
|
||||
func (p *Parser) Parse(files []parser.ExtractedFile) (*models.AnalysisResult, error) {
|
||||
snapshotFile := findSnapshotFile(files)
|
||||
if snapshotFile == nil {
|
||||
return nil, fmt.Errorf("easy-bee snapshot not found")
|
||||
return parseWithoutSnapshot(files, parseManifest(files))
|
||||
}
|
||||
|
||||
var snapshot beeSnapshot
|
||||
|
||||
Reference in new issue
Block a user