diff options
author | Vincent Chou <vincent.chou@fii-na.com> | 2023-07-27 23:19:56 +0300 |
---|---|---|
committer | Vincent Chou <vincent.chou@fii-na.com> | 2024-01-18 20:09:25 +0300 |
commit | f528fa431e650c1084b2faeae5e6abce97a051b0 (patch) | |
tree | 58363505eb6db6635faad2f5fdd9d00d3efa2d50 /meta-fii | |
parent | f26f2883a23706ef133ccf07f71893459be256cb (diff) | |
download | openbmc-f528fa431e650c1084b2faeae5e6abce97a051b0.tar.xz |
meta-fii: meta-mori: Assert LED group upon OS and power state change
* Replace the polling style OS state monitor with the event-driven style
monitor to detect state change and assert/deassert the led groups if the
condition is met.
* Change the target OS state from Standby to BootComplete for the "on"
state of boot-status-led.
- The led group would be assert upon the OS and power state change in
dbus instead of waiting for 10s polling interval.
- A monitor can be added/removed by its own yaml, which makes it easy
to maintain.
Change-Id: I838e8d688305fe5d5aa6053f4544173a7fe9a652
Signed-off-by: Vincent Chou <vincent.chou@fii-na.com>
Diffstat (limited to 'meta-fii')
11 files changed, 203 insertions, 73 deletions
diff --git a/meta-fii/meta-mori/recipes-mori/boot-status-led/files/boot-status-led.service b/meta-fii/meta-mori/recipes-mori/boot-status-led/files/boot-status-led.service deleted file mode 100644 index dc41a1d4a9..0000000000 --- a/meta-fii/meta-mori/recipes-mori/boot-status-led/files/boot-status-led.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Boot Status LED Manager -After=xyz.openbmc_project.LED.GroupManager.service -Wants=xyz.openbmc_project.LED.GroupManager.service - -[Service] -ExecStart=/usr/bin/boot-status-led.sh -Type=simple -Restart=on-failure - -[Install] -WantedBy=multi-user.target diff --git a/meta-fii/meta-mori/recipes-mori/boot-status-led/files/boot-status-led.sh b/meta-fii/meta-mori/recipes-mori/boot-status-led/files/boot-status-led.sh deleted file mode 100644 index e08e1785ef..0000000000 --- a/meta-fii/meta-mori/recipes-mori/boot-status-led/files/boot-status-led.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -BOOT_SERVICE_NAME="xyz.openbmc_project.State.Host" -BOOT_STATUS_OBJPATH="/xyz/openbmc_project/state/host0" -BOOT_INTERFACE_NAME="xyz.openbmc_project.State.OperatingSystem.Status" -BOOT_Property="OperatingSystemState" - -LED_SERVICE_NAME="xyz.openbmc_project.LED.GroupManager" -LED_INACTIVE_OBJPATH="/xyz/openbmc_project/led/groups/boot_status_inactive" -LED_STANDBY_OBJPATH="/xyz/openbmc_project/led/groups/boot_status_standby" -LED_INTERFACE_NAME="xyz.openbmc_project.Led.Group" -LED_Property="Asserted" - -boot_status="" -led_status="" - -while true; do - boot_status="$(busctl get-property $BOOT_SERVICE_NAME $BOOT_STATUS_OBJPATH $BOOT_INTERFACE_NAME $BOOT_Property | awk '{print $2}')" - - if [[ $boot_status != "\"xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Standby\"" ]] && [[ $led_status != "BLINKING" ]];then - busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b true - busctl set-property $LED_SERVICE_NAME $LED_STANDBY_OBJPATH $LED_INTERFACE_NAME $LED_Property b false - led_status="BLINKING" - elif [[ $boot_status == "\"xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Standby\"" ]] && [[ $led_status != "ON" ]];then - busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b false - busctl set-property $LED_SERVICE_NAME $LED_STANDBY_OBJPATH $LED_INTERFACE_NAME $LED_Property b true - led_status="ON" - fi - - sleep 10 - -done - -exit 0 diff --git a/meta-fii/meta-mori/recipes-mori/boot-status-led/mori-boot-status-led.bb b/meta-fii/meta-mori/recipes-mori/boot-status-led/mori-boot-status-led.bb deleted file mode 100644 index 4641e7f11e..0000000000 --- a/meta-fii/meta-mori/recipes-mori/boot-status-led/mori-boot-status-led.bb +++ /dev/null @@ -1,25 +0,0 @@ -SUMMARY = "OpenBMC Mori Boot Status LED Service" -DESCRIPTION = "OpenBMC Mori Boot Status LED Daemon." -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" -DEPENDS:append = " systemd" -PR = "r1" - -SRC_URI = " \ - file://boot-status-led.sh \ - file://boot-status-led.service \ -" - -SYSTEMD_SERVICE:${PN} = "boot-status-led.service" - -inherit systemd - -do_install() { - install -d ${D}${bindir} - install -m 0755 ${WORKDIR}/boot-status-led.sh ${D}${bindir}/ - install -d ${D}${systemd_system_unitdir} - install -m 0644 ${WORKDIR}/boot-status-led.service \ - ${D}${systemd_system_unitdir} -} - -RDEPENDS:${PN}:append = " bash" diff --git a/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori.bb b/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori.bb new file mode 100644 index 0000000000..8f07ed3a86 --- /dev/null +++ b/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori.bb @@ -0,0 +1,21 @@ +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit allarch +inherit phosphor-dbus-monitor + +SRC_URI:append = "file://led-config.yaml \ + file://boot_status_led_on.service \ + file://boot_status_led_blink.service \ + file://boot_status_led_off.service" + +do_install:append () { + install -d ${D}/${datadir}/phosphor-dbus-monitor + install -m 0644 ${WORKDIR}/led-config.yaml \ + ${D}/${datadir}/phosphor-dbus-monitor/led-config.yaml + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/*.service ${D}${systemd_system_unitdir} +} + +FILES:${PN}:append = " ${datadir}/phosphor-dbus-monitor/led-config.yaml ${systemd_system_unitdir}/*" diff --git a/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori/boot_status_led_blink.service b/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori/boot_status_led_blink.service new file mode 100644 index 0000000000..c8cb86852f --- /dev/null +++ b/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori/boot_status_led_blink.service @@ -0,0 +1,8 @@ +[Unit] +Description=Mori boot status led blink service + +[Service] +Type=oneshot +ExecStart=/bin/sh -c "busctl set-property xyz.openbmc_project.LED.GroupManager /xyz/openbmc_project/led/groups/boot_status_inactive xyz.openbmc_project.Led.Group Asserted b true && \ +busctl set-property xyz.openbmc_project.LED.GroupManager /xyz/openbmc_project/led/groups/boot_status_bootcomplete xyz.openbmc_project.Led.Group Asserted b false" +SyslogIdentifier=phosphor-dbus-monitor diff --git a/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori/boot_status_led_off.service b/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori/boot_status_led_off.service new file mode 100644 index 0000000000..9822359860 --- /dev/null +++ b/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori/boot_status_led_off.service @@ -0,0 +1,8 @@ +[Unit] +Description=Mori boot status led off service + +[Service] +Type=oneshot +ExecStart=/bin/sh -c "busctl set-property xyz.openbmc_project.LED.GroupManager /xyz/openbmc_project/led/groups/boot_status_inactive xyz.openbmc_project.Led.Group Asserted b false && \ +busctl set-property xyz.openbmc_project.LED.GroupManager /xyz/openbmc_project/led/groups/boot_status_bootcomplete xyz.openbmc_project.Led.Group Asserted b false" +SyslogIdentifier=phosphor-dbus-monitor diff --git a/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori/boot_status_led_on.service b/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori/boot_status_led_on.service new file mode 100644 index 0000000000..8e24c7e5ea --- /dev/null +++ b/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori/boot_status_led_on.service @@ -0,0 +1,8 @@ +[Unit] +Description=Mori boot status led on service + +[Service] +Type=oneshot +ExecStart=/bin/sh -c "busctl set-property xyz.openbmc_project.LED.GroupManager /xyz/openbmc_project/led/groups/boot_status_inactive xyz.openbmc_project.Led.Group Asserted b false && \ +busctl set-property xyz.openbmc_project.LED.GroupManager /xyz/openbmc_project/led/groups/boot_status_bootcomplete xyz.openbmc_project.Led.Group Asserted b true" +SyslogIdentifier=phosphor-dbus-monitor diff --git a/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori/led-config.yaml b/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori/led-config.yaml new file mode 100644 index 0000000000..6e49542f40 --- /dev/null +++ b/meta-fii/meta-mori/recipes-phosphor/dbus/led-policy-mori/led-config.yaml @@ -0,0 +1,153 @@ +- name: OS state path group + class: group + group: path + members: + - meta: PATH + path: /xyz/openbmc_project/state/host0 + +- name: Chassis power state path group + class: group + group: path + members: + - meta: PATH + path: /xyz/openbmc_project/state/chassis0 + +- name: OS state property group + class: group + group: property + type: string + members: + - interface: xyz.openbmc_project.State.OperatingSystem.Status + meta: PROPERTY + property: OperatingSystemState + +- name: Chassis power state property group + class: group + group: property + type: string + members: + - interface: xyz.openbmc_project.State.Chassis + meta: PROPERTY + property: CurrentPowerState + +- name: watch OS state + class: watch + watch: property + paths: OS state path group + properties: OS state property group + callback: OS state callback group + ignore_start_callback: true + +- name: watch power state + class: watch + watch: property + paths: Chassis power state path group + properties: Chassis power state property group + callback: Chassis power state callback group + ignore_start_callback: true + +- name: OS BootComplete condition + class: condition + condition: count + paths: OS state path group + properties: OS state property group + callback: turn on boot status led callback + countop: ">=" + countbound: 1 + op: "==" + bound: "xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.BootComplete" + +- name: OS Inactive condition + class: condition + condition: count + paths: OS state path group + properties: OS state property group + callback: blink boot status led callback + countop: ">=" + countbound: 1 + op: "==" + bound: "xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Inactive" + +- name: OS state callback group + class: callback + callback: group + members: + - OS BootComplete condition + - OS Inactive condition + - OS journal callback + +- name: Chassis power on condition + class: condition + condition: count + paths: Chassis power state path group + properties: Chassis power state property group + callback: OS Inactive condition + countop: ">=" + countbound: 1 + op: "==" + bound: "xyz.openbmc_project.State.Chassis.PowerState.On" + +- name: Chassis power off condition + class: condition + condition: count + paths: Chassis power state path group + properties: Chassis power state property group + callback: turn off boot status led callback + countop: ">=" + countbound: 1 + op: "==" + bound: "xyz.openbmc_project.State.Chassis.PowerState.Off" + +- name: Chassis power state callback group + class: callback + callback: group + members: + - Chassis power on condition + - Chassis power off condition + +- name: turn on boot status led callback + class: callback + callback: method + service: org.freedesktop.systemd1 + path: /org/freedesktop/systemd1 + interface: org.freedesktop.systemd1.Manager + method: StartUnit + args: + - value: boot_status_led_on.service + type: string + - value: replace + type: string + +- name: turn off boot status led callback + class: callback + callback: method + service: org.freedesktop.systemd1 + path: /org/freedesktop/systemd1 + interface: org.freedesktop.systemd1.Manager + method: StartUnit + args: + - value: boot_status_led_off.service + type: string + - value: replace + type: string + +- name: blink boot status led callback + class: callback + callback: method + service: org.freedesktop.systemd1 + path: /org/freedesktop/systemd1 + interface: org.freedesktop.systemd1.Manager + method: StartUnit + args: + - value: boot_status_led_blink.service + type: string + - value: replace + type: string + +- name: OS journal callback + class: callback + callback: journal + paths: OS state path group + properties: OS state property group + severity: INFO + message: OS state change received! diff --git a/meta-fii/meta-mori/recipes-phosphor/dbus/phosphor-dbus-monitor-config.bbappend b/meta-fii/meta-mori/recipes-phosphor/dbus/phosphor-dbus-monitor-config.bbappend new file mode 100644 index 0000000000..3a8c200238 --- /dev/null +++ b/meta-fii/meta-mori/recipes-phosphor/dbus/phosphor-dbus-monitor-config.bbappend @@ -0,0 +1 @@ +PHOSPHOR_DBUS_MONITOR_CONFIGS:append:mori = " led-policy-mori" diff --git a/meta-fii/meta-mori/recipes-phosphor/image/obmc-phosphor-image.bbappend b/meta-fii/meta-mori/recipes-phosphor/image/obmc-phosphor-image.bbappend index 41cf101e3d..3c09c3158f 100644 --- a/meta-fii/meta-mori/recipes-phosphor/image/obmc-phosphor-image.bbappend +++ b/meta-fii/meta-mori/recipes-phosphor/image/obmc-phosphor-image.bbappend @@ -48,6 +48,8 @@ OBMC_IMAGE_EXTRA_INSTALL:append:mori = " virtual-obmc-host-ipmi-hw" OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-software-manager-download-mgr" OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-software-manager-version" OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-software-manager-updater" -OBMC_IMAGE_EXTRA_INSTALL:append:mori = " mori-boot-status-led" OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-led-manager" OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-led-sysfs" +OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-dbus-monitor" +OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-dbus-monitor-config" +OBMC_IMAGE_EXTRA_INSTALL:append:mori = " led-policy-mori" diff --git a/meta-fii/meta-mori/recipes-phosphor/leds/mori-led-manager-config/led.yaml b/meta-fii/meta-mori/recipes-phosphor/leds/mori-led-manager-config/led.yaml index d2ff97d3e7..d9ffd3714c 100644 --- a/meta-fii/meta-mori/recipes-phosphor/leds/mori-led-manager-config/led.yaml +++ b/meta-fii/meta-mori/recipes-phosphor/leds/mori-led-manager-config/led.yaml @@ -8,6 +8,6 @@ boot_status_inactive: DutyOn: 50 Period: 1000 -boot_status_standby: +boot_status_bootcomplete: boot_status_led: Action: 'On' |