#
487e2e19 |
| 25-Nov-2024 |
Shawn McCarney <shawnmm@us.ibm.com> |
Improve error handling for exceptions and asserts
The phosphor-psu-code-manager application currently exits abnormally due to the following conditions: * Uncaught exception * False assert() statemen
Improve error handling for exceptions and asserts
The phosphor-psu-code-manager application currently exits abnormally due to the following conditions: * Uncaught exception * False assert() statement
An abnormal exit can result in a core dump and/or a BMC dump. It also causes the service to be restarted. If the failure condition remains, the restarts will fail repeatedly, and systemd will stop trying to start the service.
Improve error handling for exceptions in the following ways: * Add try/catch blocks to the following locations: * Code that calls functions that throw and needs to handle exceptions. * For example, code looping over PSU objects may need to handle an exception for one PSU and then continue to the remaining PSUs. * D-Bus PropertiesChanged and InterfacesAdded event handlers. * Do not allow exceptions to escape to the sdbusplus stack frames. * main() * Last line of defense; catching avoids a core dump. * Write exception error message to the journal if appropriate
Replace assert statements with exceptions or error messages to the journal.
Tested: * Tested all modified functions/methods. * Verified that all exceptions were caught and logged to the journal if appropriate. * Verified that asserts were replaced by exceptions and logging. * See complete test plan at https://gist.github.com/smccarney/b4bf568639fedd269c9737234fa2803d
Change-Id: I933386e94f43a915b301d6aef7d91691816a0548 Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
show more ...
|
#
783406e6 |
| 17-Nov-2024 |
Shawn McCarney <shawnmm@us.ibm.com> |
Get model using command line tool
Get the PSU model using a command line tool specified in the meson options. The default tool is 'psutils --get-model'. The tool should get the model data directly
Get model using command line tool
Get the PSU model using a command line tool specified in the meson options. The default tool is 'psutils --get-model'. The tool should get the model data directly from the PSU.
This is more accurate than getting the Model property of the Asset interface on D-Bus. Inventory Manager saves its state to files. When the BMC is booted, Inventory Manager initializes itself using the saved state. This is necessary to handle the scenario where the BMC is rebooted while the rest of the system is powered on (such as a concurrent BMC code update).
However, if all power was removed from the system, a PSU may have been added/removed/replaced while the BMC was offline. When the BMC boots, the Inventory Manager saved state is not correct.
Eventually the PSU monitoring application will update the model on D-Bus, but this can take a non-trivial amount of time. This is especially true if EntityManager is used to provide the PSU bus and address information to the PSU monitoring application.
Tested: * Verified all automated tests build and run successfully * Verified application uses command line tool to obtain model * Verified command line tool was returning the correct model * Test where command line tool fails with non-zero exit code * Tested where all PSU information available when application starts * Tested where PSU information is obtained after application starts using the InterfacesAdded handler * Tested where PSU presence changes and is obtained by the PropertiesChanged handler * Full test plan is available at https://gist.github.com/smccarney/87bd821a6d317ec0915d1f162028ff01
Change-Id: Ia9d35850aa6ac27dd006679991272232d67390ff Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
show more ...
|
#
73a6f0d8 |
| 30-Oct-2024 |
Shawn McCarney <shawnmm@us.ibm.com> |
Update PSU if version cannot be obtained
Currently this application will ignore a PSU if the PSU code version cannot be obtained.
However, there are several scenarios where this could occur: * A co
Update PSU if version cannot be obtained
Currently this application will ignore a PSU if the PSU code version cannot be obtained.
However, there are several scenarios where this could occur: * A code update was previously attempted on the PSU, and the update failed. The PSU is now in a bad state, and the update needs to be performed again. * The PSU is running old code that does not support reading the code version.
In these scenarios performing a code update on the PSU is desired.
Enhance this application so that a PSU with an unknown code version will be updated provided that it is the correct model.
Tested: * Verified code update was still performed if version could not be obtained. * Tested where PSU information is found at start of application * Tested where PSU information is found from InterfacesAdded event * Tested where PSU information is found from PropertiesChanged event * For the complete test plan, see https://gist.github.com/smccarney/3846a97fef590eb69181edc669555a00
Change-Id: I6e60761fa20eeb4500529c00f33de16d69a8d84d Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
show more ...
|
#
fb86e794 |
| 11-Sep-2024 |
Faisal Awada <faisal@us.ibm.com> |
Retrieve FW version from IMG_BUILTIN_DIR
Added method to retrieve firmware level found in IMG_BUILTIN_DIR. This is required behavior on some systems types.
Tested: Installed openbmc image on syst
Retrieve FW version from IMG_BUILTIN_DIR
Added method to retrieve firmware level found in IMG_BUILTIN_DIR. This is required behavior on some systems types.
Tested: Installed openbmc image on system and verified the function returns the version available in IMG_BUILT_DIR.
Change-Id: I10166a1412fb9de421bd304c40916a81c1ca0558 Signed-off-by: Faisal Awada <faisal@us.ibm.com>
show more ...
|
#
80c2daae |
| 23-Aug-2024 |
George Liu <liuxiwei@ieisystem.com> |
clang-tidy: Enable readability-convert-member-functions-to-static
This check finds non-static member functions that can be made static because the functions don’t use this. This check also triggers
clang-tidy: Enable readability-convert-member-functions-to-static
This check finds non-static member functions that can be made static because the functions don’t use this. This check also triggers readability-static-accessed-through -instance check as we are trying to access a static member function through an instance.
Signed-off-by: George Liu <liuxiwei@ieisystem.com> Change-Id: I6c06c61e8f199247e74aca3443741683e3853274
show more ...
|
#
bab5ed99 |
| 16-Aug-2024 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we need to reformat the code with the latest version. The way clang-18 handles lambda forma
clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we need to reformat the code with the latest version. The way clang-18 handles lambda formatting also changed, so we have made changes to the organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style. See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: I08efc0671773edfae814ebcda5c01389155e2cac Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
#
760053d8 |
| 16-May-2024 |
Faisal Awada <faisal@us.ibm.com> |
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 PS
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>
show more ...
|
#
33cf9f08 |
| 17-Jun-2024 |
Manojkiran Eda <manojkiran.eda@gmail.com> |
Fix spelling mistakes using codespell
This commit corrects various spelling mistakes throughout the repository. The corrections were made automatically using `codespell`[1] tool.
[1]: https://githu
Fix spelling mistakes using codespell
This commit corrects various spelling mistakes throughout the repository. The corrections were made automatically using `codespell`[1] tool.
[1]: https://github.com/codespell-project/codespell
Change-Id: Icafafe827d67c9b6cc5c3f6bfb204fe425e91a32 Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
show more ...
|
#
5670b188 |
| 10-May-2023 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require additional settings for best compatibility and re-running the formatter. Copy the latest
clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require additional settings for best compatibility and re-running the formatter. Copy the latest .clang-format from the docs repository and reformat the repository.
Change-Id: Idb72665dbadfa8afd569a2e0e254d84f0a2108d3 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
#
374fae56 |
| 22-Jul-2022 |
Patrick Williams <patrick@stwcx.xyz> |
sdbusplus: use shorter type aliases
The sdbusplus headers provide shortened aliases for many types. Switch to using them to provide better code clarity and shorter lines. Possible replacements are
sdbusplus: use shorter type aliases
The sdbusplus headers provide shortened aliases for many types. Switch to using them to provide better code clarity and shorter lines. Possible replacements are for: * bus_t * exception_t * manager_t * match_t * message_t * object_t * slot_t
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ie530f2c63000bbfac7c5fbbc74ebe6bc8c07fb1a
show more ...
|
#
a8b966f1 |
| 17-Mar-2020 |
Lei YU <mine260309@gmail.com> |
Add updateable association
Add 'updateable' association to the functional PSU firmware. This 'updateable' association can be used to mark all the firmware components which can be programmable from B
Add updateable association
Add 'updateable' association to the functional PSU firmware. This 'updateable' association can be used to mark all the firmware components which can be programmable from BMC interfaces like Redfish.
Resolves openbmc/phosphor-psu-code-mgmt#2
Tested: Verify unit tests success; Verify the updateable associations are created for PSU firmware objects on Witherspoon, and the Redfish has "Updateable": true for the PSU images.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I579121587b0d2c14f08beceaa68e380eaf1eefd9
show more ...
|
#
1517f5f6 |
| 14-Oct-2019 |
Lei YU <mine260309@gmail.com> |
Check and sync PSU image when PSU is plugged in
When a PSU is plugged out and in, the service shall check the version and do update if it is with an old software. When the PSU is plugged in, the mod
Check and sync PSU image when PSU is plugged in
When a PSU is plugged out and in, the service shall check the version and do update if it is with an old software. When the PSU is plugged in, the model is not available for a while, so the service subscribe the model property as well, and only create the software object when both present and model properties are set.
Tested: With dummy update service, verify on Witherspoon that when PSU is plugged out (by setting "Present" property in inventory), the software object is removed, and when it's pluggd int (by setting "Present" property), the software object is created after the model is got, and is upgraded by a newer image stored in BMC filesystem.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: Ia7516e5bc9c642158b216036bcddf404157f9204
show more ...
|
#
ffb36539 |
| 15-Oct-2019 |
Lei YU <mine260309@gmail.com> |
Activation: remove old objects after update done
The update on PSUs is one-by-one, after each PSU is updated, notify ItemUpdater by onUpdateDone() so that the old object for the PSU is removed.
Tes
Activation: remove old objects after update done
The update on PSUs is one-by-one, after each PSU is updated, notify ItemUpdater by onUpdateDone() so that the old object for the PSU is removed.
Tested: With dummy PSU image and update service, verify the old objects are removed on Witherspoon.
Change-Id: I212b8cba9570ad96083d362bf57691fdabb4e42f
show more ...
|
#
63f9e712 |
| 12-Oct-2019 |
Lei YU <mine260309@gmail.com> |
Sync PSU images on service startup
On service startup, it shall check the PSU images, find a latest version, and update to the PSUs that are not with this version.
Tested: With dummy image and serv
Sync PSU images on service startup
On service startup, it shall check the PSU images, find a latest version, and update to the PSUs that are not with this version.
Tested: With dummy image and service, test on Witherspoon with 2 different running PSU software: * When startup without stored image, the serive tries to update an older PSU but it does not have PSU image, so it's skipped with below journal log: Automatically update PSU No image for the activation, skipped * When startup with an older image stored in BMC, it behaves the same as above. * When startup with a new image stored in BMC, it updates the PSUs, with below example journal log: Automatically update PSU Starting Update PSU /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0 /var/lib/obmc/psu/2B1D... Started Update PSU /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0 /var/lib/obmc/psu/2B1D. Starting Update PSU /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1 /var/lib/obmc/psu/2B1D... Started Update PSU /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1 /var/lib/obmc/psu/2B1D.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I6d676c5a4441685fb2b5920455f439c00f6097af
show more ...
|
#
6520748d |
| 11-Oct-2019 |
Lei YU <mine260309@gmail.com> |
utils: Add function to get the latest version
This repo does not know which PSU version is the latest, and it lets the vendor tool to decide which one is the latest.
This commit defines PSU_VERSION
utils: Add function to get the latest version
This repo does not know which PSU version is the latest, and it lets the vendor tool to decide which one is the latest.
This commit defines PSU_VERSION_COMPARE_UTIL which is expected to be a tool that accepts arguments of a list of versions, and returns the latest version string.
Tested: Put and configure to use the example get_latest_version on Witherspoon, verify the versionId with a larger version string is returned.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: Ic5a10d3724cf6a98b3979486c72d54f8deac7038
show more ...
|
#
58c26e3f |
| 27-Sep-2019 |
Lei YU <mine260309@gmail.com> |
Scan directories that store PSU images on start
When the service starts, scan the directories that store PSU images, including the built-in images, and the saved images during PSU update.
When the
Scan directories that store PSU images on start
When the service starts, scan the directories that store PSU images, including the built-in images, and the saved images during PSU update.
When the scanned image is different than the running images, create activation/version object; When the scanned image is the same as the running images, update the version object's path to indicate the PSU image path, so it could be used for future update in case a PSU is replaced with a different software.
Tested: On Witherspoon, fake create a dummy PSU image with a different version than running PSU, verify a new object is created on restart; fake creating a dummy PSU image with a same version as a running PSU, verify no new object is created, but the "Path" property is set to the PSU image directory.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I860b978250a718eb82d948a1c88bd8f41bb2b2e3
show more ...
|
#
9930137b |
| 29-Sep-2019 |
Lei YU <mine260309@gmail.com> |
Refactor: Make Activation inherit FilePath interface
Previously Version inherits FilePath interface to provide the information of the file path property of a software, and Activation was using pre-d
Refactor: Make Activation inherit FilePath interface
Previously Version inherits FilePath interface to provide the information of the file path property of a software, and Activation was using pre-defined location to find the image path (IMG_DIR / versionId).
Now the code is going to support pre-built image and stored image during update, the Activation class needs to know the file path to perform the update.
So this commit "moves" the FilePath from Version to Activation.
Tested: Verify the "Path" property on FilePath still exists on the DBus object after uploading a tarball.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I37b41eaa93cd239ab7732f6fac9400410995ca71
show more ...
|
#
a5c47bb3 |
| 28-Sep-2019 |
Lei YU <mine260309@gmail.com> |
Refactor: remove DeleteAll interface
There is no need for ItemUpdater to implement DeleteAll interface, remove it.
Also make Activation::versionId private and provide a public getVersionId() method
Refactor: remove DeleteAll interface
There is no need for ItemUpdater to implement DeleteAll interface, remove it.
Also make Activation::versionId private and provide a public getVersionId() method; Make ItemUpdater::erase() to pass const reference.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: Ifd6c61fc21b2967d6c83f1df7aaa3b2e94cae86c
show more ...
|
#
7f2a2152 |
| 16-Sep-2019 |
Lei YU <mine260309@gmail.com> |
Activation: create associations
Create activation, functional, activate associations during PSU update.
Tested: With dummy psu update service, verify the assocations are created when the PS
Activation: create associations
Create activation, functional, activate associations during PSU update.
Tested: With dummy psu update service, verify the assocations are created when the PSU update is completed, and not created when PSU update fails.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I3d457e65b55066b93f7fc9a3311093dcec05d020
show more ...
|
#
dcaf8934 |
| 09-Sep-2019 |
Lei YU <mine260309@gmail.com> |
Get version directly on PSU plugged in
When PSU is plugged in, get the version directly instead of waiting for the VERSION interface change on the inventory object. This simplies the code a lot in o
Get version directly on PSU plugged in
When PSU is plugged in, get the version directly instead of waiting for the VERSION interface change on the inventory object. This simplies the code a lot in onPsuInventoryChanged(), and it does not depend on the VERSION interface on inventory object anymore.
Tested: Verify on Witherspoon that when PSU is plugged out and in, the PSU software object is removed and created as expected.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I2770049baf8ffa8f1d91391fd9225a237acb24dc
show more ...
|
#
a2c2cd72 |
| 09-Aug-2019 |
Lei YU <mine260309@gmail.com> |
Test: Add unit test for PSU plug out and in
Split the function into two, one for handling the sdbus::message, the other for handling the changed properties, so that it's easier to write unit test ca
Test: Add unit test for PSU plug out and in
Split the function into two, one for handling the sdbus::message, the other for handling the changed properties, so that it's easier to write unit test cases.
Added the test cases: * On a system with a PSU present, remove the PSU; * On a system without PSU, plug the PSU in; * On a system with a PSU, remove the PSU and add it back, while the propertiesChanged callback is invoked with both Present and Version properties. * On a system with two PSUs with same version, remove them one-by-one, and add back one-by-one, while PSU1 has a different version.
Tested: Verify ItemUpdater correctly handles the above cases: * Remove the activation and version object if PSU is removed; * Create activation and version object if PSU is added; * When there are two PSUs with same version, removing one only update the associations, removing the other shall result in the objects to be removed; Adding one back will create the objects, and adding the other one with different version will create new objects.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I14c7ae9f03ec91bb1c85bb5a18d69f20dc1efd53
show more ...
|
#
f77189f7 |
| 07-Aug-2019 |
Lei YU <mine260309@gmail.com> |
Add unit test for item_udpater
To test item_updater easier, mocking utils is necessary. So add a UtilsInterface to make the mocking eaiser.
Due to the fact that there is templated member functions
Add unit test for item_udpater
To test item_updater easier, mocking utils is necessary. So add a UtilsInterface to make the mocking eaiser.
Due to the fact that there is templated member functions that could not be virtual, adding an extra "Impl" virtual function makes it possible to simulates the mock of templated functions. See https://stackoverflow.com/questions/7968023/c-virtual-template-method for details.
However, using std::any in with googlemock has an issue on GCC9, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90415 for details.
So this commit uses std::experimental::any as a workaround.
With the mocked utils, it's easy to test item_updater in different cases.
This commit adds the test cases for creating PSU objects, when: * There is no PSU present * There is one PSU present * There are two PSUs present with the same version; * There are two PSUs present with different versions.
Tested: Verify the unit tests passes.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I5d74ab26b344c5c40bc141f97b8aca42e74ee88e
show more ...
|
#
bd3b0076 |
| 08-Aug-2019 |
Lei YU <mine260309@gmail.com> |
Handle PSU inventory changes
Watch the PSU inventory property changes, so that when a PSU is plugged out/in, the software object is removed or created. If mutliple PSUs have the same software versio
Handle PSU inventory changes
Watch the PSU inventory property changes, so that when a PSU is plugged out/in, the software object is removed or created. If mutliple PSUs have the same software version, the related associations are updated.
Tested: On Witherspoon, manually setting PSU's present property to false and true, when both PSUs have the same version. 0. Before setting PSU's present false, verify the software object is associated with two PSUs; 1. When one of the PSU is set false, verify the assocation is removed and only one PSU path is associated; 2. When both of the PSUs are set false, verify the software object is removed; 3. When a PSU is set to true, verify the software object is created and associated with the PSU; 4. When the other PSU is set to true, verify the software object is associated with both PSUs.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I417a87bf57c01aa57f78f09b7abc4e948a4d1752
show more ...
|
#
ad90ad51 |
| 05-Aug-2019 |
Lei YU <mine260309@gmail.com> |
Create objects for running PSUs
On service startup, create activation and version objects for running PSUs, and set related active, functional associations.
If multiple PSUs are running with the sa
Create objects for running PSUs
On service startup, create activation and version objects for running PSUs, and set related active, functional associations.
If multiple PSUs are running with the same software version, they share the same DBus object, and the object will be associated to multiple PSU inventories.
Tested: Verify the software objects are created on Witherspoon, and the active, functional associations are created.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: Ia8372aba8299818baccfdf37e98fdbc99f747b7c
show more ...
|
#
5e0dcb39 |
| 02-Aug-2019 |
Lei YU <mine260309@gmail.com> |
Get psu inventory path
Invoke GetSubTreePaths on configurable psu inventory base path to get all the PSU paths. Add unit test case and meson.build to build the unit test case.
In test/meson.build,
Get psu inventory path
Invoke GetSubTreePaths on configurable psu inventory base path to get all the PSU paths. Add unit test case and meson.build to build the unit test case.
In test/meson.build, manually adding dynamic_linker related options for OE SDK environment to link_args, so that the built test binary could be executed in OE SDK environment. Otherwise, the ld will not find the correct shared libraries in OE SDK.
And you have to execute the test binaries manually in OE SDK, because meson skips running the tests due to it thinks it's cross compiling. This is described in README as well.
Tested: Verify the build and unit test run OK in OE SDK environment and in OpenBMC CI. Verify it gets the PSU inventory paths correctly on Witherspoon.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I2e2003c5897d7a623fad7f87d263b71c926fc46d
show more ...
|