commit | 760053d8a9a840ce92628f50275daae8eed51a6f | [log] [tgz] |
---|---|---|
author | Faisal Awada <faisal@us.ibm.com> | Thu May 16 13:31:32 2024 -0500 |
committer | George Liu <liuxiwei@ieisystem.com> | Tue Jun 25 01:12:38 2024 +0000 |
tree | 27d7b709d45aa195527a6a4543c2db142d54aa68 | |
parent | 33cf9f08755eee80498ee5b2e0056263d1ed00bc [diff] |
Waiting for PSUs to be available during startup Modified the Software PSU Updater Service to wait until inventory service available. Updated ItemUpdater::scanDirectory to search for the installed PSU model directory. For example, the PSU model 2B1E should have a directory named /usr/share/obmc/psu/2B1E. The firmware file and the MANIFEST reside in the model directory. Added a new function, `onInterfacesAdded`, processes D-Bus messages to update the internal state of PSU devices. It performs the following steps: - Read D-Bus message to extract the object path and interfaces. - Check for PSU Interface. - Retrieve all PSUs inventory paths from the D-Bus. - Update PSU present status and model. If the PSU is present and has valid version, process FW update to latest version. Fixed the issue with version comparison when there is no firmware to compare with. Tested: Tested the code in simulation module and verified it waits for all PSUs to be discovered. Verified phosphor-psu-code-manager invokes psutils to get the PSU version, compare and update. Change-Id: Ic26e215baffd56fc070cc0cf6d3fff92fdfb914c Signed-off-by: Faisal Awada <faisal@us.ibm.com>
phosphor-psu-code-mgmt is a service to provide management for PSU code, including:
meson build/ && ninja -C build
meson -Doe-sdk=enabled -Dtests=enabled build/ ninja -C build/ test # Meson skips running the case due to it thinks it's cross compiling # Manually run the tests for t in `find build/test/ -maxdepth 1 -name "test_*"`; do ./$t || break ; done
This repo contains generic code to handle the PSU versions and updates. It depends on vendor-specific tools to provide the below functions on the real PSU hardware:
It provides configure options for vendor-specific tools for the above functions:
PSU_VERSION_UTIL
: It shall be defined as a command-line tool that accepts the PSU inventory path as input, and outputs the PSU version string to stdout.PSU_VERSION_COMPARE_UTIL
: It shall be defined as a command-line tool that accepts one or more PSU version strings, and outputs the latest version string to stdout.PSU_UPDATE_SERVICE
: It shall be defined as a systemd service that accepts two arguments:For example:
meson -Dtests=disabled \ '-DPSU_VERSION_UTIL=/usr/bin/psutils --raw --get-version' \ '-DPSU_VERSION_COMPARE_UTIL=/usr/bin/psutils --raw --compare' \ '-DPSU_UPDATE_SERVICE=psu-update@.service' \ build
The above configures the vendor-specific tools to use psutils
from phosphor-power to get and compare the PSU versions, and use psu-update@.service
to perform the PSU firmware update, where internally it invokes psutils
as well.
When the service starts, it queries the inventory to get all the PSU inventory paths, invokes the vendor-specific tool to get the versions, and creates version objects under /xyz/openbmc_project/software
that are associated with the PSU inventory path. If multiple PSUs are using the same version, multiple PSU inventory paths are associated.
E.g.
"/xyz/openbmc_project/software/02572429": { "Activation": "xyz.openbmc_project.Software.Activation.Activations.Active", "Associations": [ [ "inventory", "activation", "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1" ] ], "ExtendedVersion": "", "Path": "", "Purpose": "xyz.openbmc_project.Software.Version.VersionPurpose.PSU", "RequestedActivation": "xyz.openbmc_project.Software.Activation.RequestedActivations.None", "Version": "01120114" }, "/xyz/openbmc_project/software/7094f612": { "Activation": "xyz.openbmc_project.Software.Activation.Activations.Active", "Associations": [ [ "inventory", "activation", "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" ] ], "ExtendedVersion": "", "Path": "", "Purpose": "xyz.openbmc_project.Software.Version.VersionPurpose.PSU", "RequestedActivation": "xyz.openbmc_project.Software.Activation.RequestedActivations.None", "Version": "00000110" },
"/xyz/openbmc_project/software/9463c2ad": { "Activation": "xyz.openbmc_project.Software.Activation.Activations.Active", "Associations": [ [ "inventory", "activation", "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" ], [ "inventory", "activation", "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1" ] ], "ExtendedVersion": "", "Path": "", "Purpose": "xyz.openbmc_project.Software.Version.VersionPurpose.PSU", "RequestedActivation": "xyz.openbmc_project.Software.Activation.RequestedActivations.None", "Version": "01100110" },
./generate-psu-tar --image <psu-image> --version <version> --model <model> --manufacturer \ <manufacturer> --machineName <machineName> --outfile <psu.tar> --sign
IMG_DIR_PERSIST
. When a PSU is replaced, the PSU's firmware version will be checked and updated if it's older than the one stored in BMC.IMG_DIR_BUILTIN
. When the service starts, it will compare the versions of the built-in image, the stored image (after PSU update), and the existing PSUs, if there is any PSU that has an older firmware, it will be updated to the newest one.