Display EVE application status using LEDs
A customer uses Siemens IPC127 which has 4 LEDs (one power plus three under software control) and has observed that they get the EVE connected/onboarding status on the first programmable LED and is asking about seeing the status of their application (running, halted, etc) on one of the other LEDs.
That customer is deploying a single application but in EVE we need to generalize that to multiple applications.
IPC127 LEDs
The IPC127 has the following in /sys/class/leds:
ipc127:green:1 ipc127:green:3 ipc127:red:2
ipc127:green:2 ipc127:red:1 ipc127:red:3
Enabling both red and green makes orange.
NOTE: the use of different colors has been observed to be flaky; color might change for unknown reasons.
The labels on the enclosure are:
0: PC ON/WD
1: L1 RUN/STOP
2: L2 ERROR
3: L3 MAINT
EVE (in ledmanager.go) is currently using ipc127:green:1 for blinking the device status.
As a related RFE we could potentially make count 10 and above blink red since those are indications of failure of some sort. (See https://github.com/lf-edge/eve/blob/master/pkg/pillar/types/ledmanagertypes.go )
Proposed semantics of application status
When there are multiple applications it probably makes sense to represent the worst case. Thus if all applications are running we represent that as “running”. If one application is in error or is halting, we represent that as “error” or “halting”. And if none of the applications have even started booting we represent that as “init”.
Mapping to IPC127
Suggestion is to use LED 3 (the one labeled as L3 MAINT) for application state.
If no application has even started booting that LED will be off.
If one or more applications is in error state, then the LED will be solid red.
If there is no error
If EVE has moved all of the applications to the booted or running state, then solid green
If some applications are in the halting state, then blinking orange.
If some applications are in the init state, then blinking green.
Implementation notes
Zedmanager is the best to track the application status since it has both the intended state in the AppInstanceConfig.Activate and the current state in the AppInstanceStatus (in the Activated, State, and Error fields). Zedmanager can calculate the counts of AppInstanceConfig.Activate, count of AppInstanceStatus.Error, AppInstanceStatus.State == halting, and AppInstanceStatus.Activated to determine a summary status..
Might make sense to have zedmanager publish a new struct which actually gives the total number of apps configured, booting, halting, error and those values will help the subscribers to make any decisions.
Ledmanger can then subscribe to this and, depending on the hardware, light up or blink the appropriate LED.