
Currently, factory-install and enrollment are using the OEM-specific sensor type ID F0h, which falls within the reserved range (C0h–FFh). On Supermicro BMCs, this value collides with an existing OEM sensor, causing the custom events to be misinterpreted as BIOS OEM memory errors. This change updates the SEL events to use sensor type ID 12h (System Event), which is a standard value and should be interpreted consistently across different BMC implementations. This avoids collisions with vendor-specific OEM ranges and ensures correct event handling. In addition, the Factory Setup Complete and Failed events were moved from the enroll-init-reconfigure script to the run-cloud-init-from-seed.sh script. This fixes an issue in which the monitoring script times out if factory install was not completed, since run-cloud-init-from-seed.sh exits when the completion flag is not present, preventing enroll-init-reconfigure from running. Test Plan: PASS: Build a seed ISO including these changes. Run a factory install that completes successfully and verify that each stage sends the success event with the expected event data value. PASS: Run a factory install forcing a failure in one stage. Repeat for all stages and verify that the failed stage sends a failure event with the corresponding event data value. PASS: Run an enrollment and verify that each stage sends the success event with the expected event data value. Repeat, inducing a failure for each stage, and verify that the events correspond to the expected event data value. PASS: After the previous tests, verify that these events are not detected as errors by the Supermicro BMC. PASS: Run an enrollment with IPMI monitoring enabled when the factory install has not completed yet. Verify that the failure event sent by the run-cloud-init-from-seed.sh script is detected and that the failure message is logged in the System Controller. Story: 2011455 Task: 52855 Change-Id: I08ccc43f949f47a3dc36ae67740ece3b9a37a6fb Signed-off-by: Enzo Candotti <Enzo.Candotti@windriver.com>
52 lines
1.6 KiB
Bash
52 lines
1.6 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Copyright (c) 2025 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# Script to send IPMI SEL events depending on the status for each stage.
|
|
#
|
|
|
|
log_info() { echo "$(date '+%F %H:%M:%S') INFO: $*"; }
|
|
log_warn() { echo "$(date '+%F %H:%M:%S') WARN: $*"; }
|
|
|
|
declare -Ar CODES=(
|
|
[bootstrap.ok]="0x04 0x12 0xCC 0x63 0xCC 0x10 0xF6"
|
|
[bootstrap.err]="0x04 0x12 0xCC 0x63 0xCC 0x10 0xF7"
|
|
[config.ok]="0x04 0x12 0xCC 0x63 0xCC 0x10 0xF8"
|
|
[config.err]="0x04 0x12 0xCC 0x63 0xCC 0x10 0xF9"
|
|
[setup.ok]="0x04 0x12 0xCC 0x63 0xCC 0x10 0xFA"
|
|
[setup.err]="0x04 0x12 0xCC 0x63 0xCC 0x10 0xFB"
|
|
[tests.ok]="0x04 0x12 0xCC 0x63 0xCC 0x10 0xFC"
|
|
[tests.err]="0x04 0x12 0xCC 0x63 0xCC 0x10 0xFD"
|
|
[backup.ok]="0x04 0x12 0xCC 0x63 0xCC 0x10 0xFE"
|
|
[backup.err]="0x04 0x12 0xCC 0x63 0xCC 0x10 0xFF"
|
|
[finished.ok]="0x04 0x12 0xCC 0x63 0xCC 0x10 0xE0"
|
|
)
|
|
|
|
stage="${1:-}"; status="${2:-}"
|
|
key="${stage}.${status}"
|
|
|
|
if [[ -z "$stage" || -z "$status" || -z "${CODES[$key]:-}" ]]; then
|
|
echo "Usage: send-factory-sel-event <bootstrap|config|setup|tests|backup|finished> <ok|err>" >&2
|
|
exit 2
|
|
fi
|
|
|
|
ts="$(date '+%F %H:%M:%S')"
|
|
if [[ "$status" == "ok" ]]; then
|
|
log_info "Factory install '${stage}' stage completed. Sending IPMI event..."
|
|
else
|
|
log_info "Factory install '${stage}' stage failed. Sending IPMI event..."
|
|
fi
|
|
|
|
tmp_file="$(mktemp /tmp/ipmi_event_XXXXXX.txt)"
|
|
echo "${CODES[$key]}" > "$tmp_file"
|
|
|
|
if ipmitool sel add "$tmp_file" >/dev/null 2>&1; then
|
|
log_info "Factory install '${stage}' stage ${status}. IPMI SEL event sent ($key)."
|
|
else
|
|
log_warn "Failed to send IPMI SEL event ($key)."
|
|
fi
|
|
|
|
rm -f "$tmp_file"
|