| 638b84ae | 01-Feb-2025 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: update latest spec and reformat
Copy the latest format file from the docs repository and apply.
Change-Id: I9230bbf1838e1e34ee6b6b49553a59fc9245cca1 Signed-off-by: Patrick Williams <p
clang-format: update latest spec and reformat
Copy the latest format file from the docs repository and apply.
Change-Id: I9230bbf1838e1e34ee6b6b49553a59fc9245cca1 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
| 8a08ac10 | 01-Feb-2025 |
Patrick Williams <patrick@stwcx.xyz> |
meson: reformat with meson formatter
Apply the `meson format` results.
Change-Id: Ide29bf7e4bef23e31328a7e425ff700ea0aab39b Signed-off-by: Patrick Williams <patrick@stwcx.xyz> |
| b8590f56 | 13-Jan-2025 |
Shawn McCarney <shawnmm@us.ibm.com> |
Fix CI error
The test case doUpdateOnePSUNotPresent() recently started failing in CI on the meson pass that contains the following option: * -Db_sanitize=address,undefined
This option turns on memo
Fix CI error
The test case doUpdateOnePSUNotPresent() recently started failing in CI on the meson pass that contains the following option: * -Db_sanitize=address,undefined
This option turns on memory checking, and that results in slightly different gtest execution.
There appears to be one or more gmock bugs when ON_CALL and EXPECT_CALL are used on the same mock method. Modify doUpdateOnePSUNotPresent() to use ON_CALL instead of EXPECT_CALL. This is consistent with the other methods in this file.
Also wrap the SdBusMock objects in test cases with NiceMock<> to simplify future test case debug. The test cases do not set many expectations on the sdbusplus functions that are called, and this results in a huge number of 'Uninteresting mock function call' warning messages. Using NiceMock eliminates these warnings.
Tested: * Verified all automated test cases pass
Change-Id: I9f7ef8f314378ad928579c3b5707aab4fa091a23 Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
show more ...
|
| 17c2c94e | 10-Dec-2024 |
Shawn McCarney <shawnmm@us.ibm.com> |
Set ExtendedVersion property on Activations
Activation objects are created by this application in three scenarios: 1. When an InterfacesAdded event notifies the application about a new PSU image
Set ExtendedVersion property on Activations
Activation objects are created by this application in three scenarios: 1. When an InterfacesAdded event notifies the application about a new PSU image that was uploaded to IMG_DIR (/tmp/images). 2. When getting the firmware version that is already running on a PSU in the system. 3. When a firmware version is found in the file system (IMG_DIR_BUILTIN or IMG_DIR_PERSIST).
In scenario #2, there are two Activation properties that are not set: 1. Path: the file system path to the image directory. 2. ExtendedVersion: contains the manufacturer and model.
In scenario #3, a firmware version may be found in the file system that is the same as the version running on a PSU. In this case, the Activation object has already been created. The Path property on the existing Activation is set to the file system path.
However, the ExtendedVersion property of the existing Activation is not set. Due to this, the Activation has no manufacturer or model information. This means it cannot be used to update other PSUs.
Solve this problem by setting the ExtendedVersion property of the existing Activation when a matching version is found in the file system. This will enable the Activation to obtain the manufacturer and model information. This in turn will allow the Activation to be used to update other PSUs that are not running the latest version.
Tested: * Verified that extendedVersion, manufacturer, and model data members are set when the Activation constructor is called. * Verified that extendedVersion, manufacturer, and model data members are set when the new, overridden extendedVersion() method is called. * Verified that the ExtendedVersion property is set by scanDirectory() if an Activation already exists. * For the complete test plan see: https://gist.github.com/smccarney/2a3bf72c6faa436199a70968cd99e30e
Change-Id: I7107b8c1d631ada5cd55648f92cf2c1e5cd90778 Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
show more ...
|
| 46ea388c | 10-Dec-2024 |
Shawn McCarney <shawnmm@us.ibm.com> |
Verify PSU is present before code update
When an Activation is set to the Activating state, it checks all the PSUs in the system to see which ones are compatible. Compatibility is determined based o
Verify PSU is present before code update
When an Activation is set to the Activating state, it checks all the PSUs in the system to see which ones are compatible. Compatibility is determined based on the Model and Manufacturer properties. It performs a code update only on compatible PSUs.
Update the Activation class to also check whether a PSU is present. A code update should not be attempted on a missing PSU. The attempt will fail, and that will cause the remaining PSUs to be skipped.
Tested: * Activation::startActivation() * Test where PSU is not present * Verify it is skipped * Test where PSU is present * Verify the compatibility is checked * Test where PSU is not compatible * Verify it is skipped * Test where PSU is compatible * Verify it is code updated * Activation::isPresent() * Test where PSU is present * Test where PSU is not present * Test where a D-Bus error occurs * Verify error is written to the journal * Verify false is returned
Change-Id: I5647e51177d84d22f6ae5a38afa970243fe9ecdd Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
show more ...
|
| 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 ...
|
| d57bd2f2 | 02-Dec-2024 |
Shawn McCarney <shawnmm@us.ibm.com> |
Rename getPSUInventoryPath to getPSUInventoryPaths
Rename the utils method/function getPSUInventoryPath() to getPSUInventoryPaths(). The method/function returns multiple paths in a vector, so the n
Rename getPSUInventoryPath to getPSUInventoryPaths
Rename the utils method/function getPSUInventoryPath() to getPSUInventoryPaths(). The method/function returns multiple paths in a vector, so the name should be plural. This will make the return type more clear. Currently the name implies only one path will be returned.
Tested: * Verified all automated tests build and run successfully * Verified getPSUInventoryPaths() returns correct data
Change-Id: I7e215c37e3ce1eb27313bc51348c7f7335c8f67a 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 ...
|
| 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 ...
|
| 22c2fbd8 | 23-Aug-2024 |
George Liu <liuxiwei@ieisystem.com> |
clang-tidy: Enable readability-uppercase-literal-suffix check
cert-dcl16-c redirects here as an alias for this check. By default, only the suffixes that begin with l (l, ll, lu, llu, but not u, ul,
clang-tidy: Enable readability-uppercase-literal-suffix check
cert-dcl16-c redirects here as an alias for this check. By default, only the suffixes that begin with l (l, ll, lu, llu, but not u, ul, ull) are diagnosed by that alias.
Signed-off-by: George Liu <liuxiwei@ieisystem.com> Change-Id: I180ee3e3274899c63181f69a14f158319f178f0c
show more ...
|
| 71ae535c | 23-Aug-2024 |
George Liu <liuxiwei@ieisystem.com> |
clang-tidy: Enable readability-make-member-function-const check
Finds non-static member functions that can be made const because the functions don’t use this in a non-const way.
Signed-off-by: Geor
clang-tidy: Enable readability-make-member-function-const check
Finds non-static member functions that can be made const because the functions don’t use this in a non-const way.
Signed-off-by: George Liu <liuxiwei@ieisystem.com> Change-Id: Iff3a367401d571f9fcff90539aaab59e2c66e627
show more ...
|
| 66a54ad4 | 23-Aug-2024 |
George Liu <liuxiwei@ieisystem.com> |
clang-tidy: Enable cppcoreguidelines-special-member-functions
The check finds classes where some but not all of the special member functions are defined.
By default the compiler defines a copy cons
clang-tidy: Enable cppcoreguidelines-special-member-functions
The check finds classes where some but not all of the special member functions are defined.
By default the compiler defines a copy constructor, copy assignment operator, move constructor, move assignment operator and destructor. The default can be suppressed by explicit user-definitions. The relationship between which functions will be suppressed by definitions of other functions is complicated and it is advised that all five are defaulted or explicitly defined.
Signed-off-by: George Liu <liuxiwei@ieisystem.com> Change-Id: Icbfd448b2bf78ebf99ec07b55220871e093cb899
show more ...
|
| 047d9944 | 23-Aug-2024 |
George Liu <liuxiwei@ieisystem.com> |
clang-tidy: Enable cppcoreguidelines-explicit-virtual-functions
Adds override (introduced in C++11) to overridden virtual functions and removes virtual from those functions as it is not required.
v
clang-tidy: Enable cppcoreguidelines-explicit-virtual-functions
Adds override (introduced in C++11) to overridden virtual functions and removes virtual from those functions as it is not required.
virtual on non base class implementations was used to help indicate to the user that a function was virtual. C++ compilers did not use the presence of this to signify an overridden function.
In C++11 override and final keywords were introduced to allow overridden functions to be marked appropriately. Their presence allows compilers to verify that an overridden function correctly overrides a base class implementation.
This can be useful as compilers can generate a compile time error when: - The base class implementation function signature changes. - The user has not created the override with the correct signature.
Signed-off-by: George Liu <liuxiwei@ieisystem.com> Change-Id: I428f69c11b071a1a50e7f93f7bcc29c8300dcddb
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 ...
|
| ce6c5c54 | 29-Nov-2023 |
Patrick Williams <patrick@stwcx.xyz> |
build: use allowed over enabled
Meson feature options are typically in a tri-state of enabled, disabled, or auto. The enabled and disabled functions on an option (from `get_option`) no longer retur
build: use allowed over enabled
Meson feature options are typically in a tri-state of enabled, disabled, or auto. The enabled and disabled functions on an option (from `get_option`) no longer return true for auto features. Instead, the expectation is to use `allowed()` which is true for both enabled and auto.
Switch all uses of `enabled` to `allowed`.
Change-Id: Icb327fb26f7ffe6c08b0220caf8a489dfb7d1248 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
| 3f6c12b8 | 20-Oct-2023 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: copy latest and re-format
clang-format-17 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-17 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: I732e5e7e4a76173d0018b1cd540c3b9b4adee83e Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
| 4ba2edcc | 06-Jan-2023 |
Chicago Duan <duanzhijia01@inspur.com> |
Fix bug: Fix spelling errors
Fix spelling errors.
Signed-off-by: Chicago Duan <duanzhijia01@inspur.com> Change-Id: Ibf7c6598be90d6a19d4a39adef0dee2202d9f0a6 |
| 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 ...
|
| b5f9b829 | 16-Jun-2022 |
Patrick Williams <patrick@stwcx.xyz> |
remove std::experimental usage
The bug previously referenced that instigated the usage of std::experimental::any instead of std::any has long been fixed in GCC/libstdc++. Switch back to use the non
remove std::experimental usage
The bug previously referenced that instigated the usage of std::experimental::any instead of std::any has long been fixed in GCC/libstdc++. Switch back to use the non-experimental library.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Icb162fd24105b32196993c319ddf232ab1b8c50e
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 ...
|
| 8afeee56 | 21-Oct-2019 |
Lei YU <mine260309@gmail.com> |
Activation: add BMC reboot guard
BMC shall not reboot during PSU update, otherwise it has the risk of putting the PSU in a bad state. So add BMC reboot guard in ActivationBlocksTransition to enable
Activation: add BMC reboot guard
BMC shall not reboot during PSU update, otherwise it has the risk of putting the PSU in a bad state. So add BMC reboot guard in ActivationBlocksTransition to enable reboot guard when PSU update is started, and disable it when it's finished or failed.
During test, it's found that the ActivationBlocksTransition is created too early before checking the PSU compatibility, it is fixed by constructing ActivationBlocksTransition after the check.
Tested: Verify the BMC guard is enabled and disabled during PSU update.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I405fe640929aa91ecbcb3d48e19309d38b6849e5
show more ...
|
| d0f8bbb3 | 18-Oct-2019 |
Lei YU <mine260309@gmail.com> |
Version: support CRLF line feed in MANIFEST
When a MANIFEST is generated from Windows and it contains CRLF as line feed, the code was getting each line with '\r' at the end, and thus the parsed stri
Version: support CRLF line feed in MANIFEST
When a MANIFEST is generated from Windows and it contains CRLF as line feed, the code was getting each line with '\r' at the end, and thus the parsed string contains '\r' and it incorrectly parses the string.
Add a piece of code to support CRLF line feed so support such MANIFEST files.
Tested: Added a unit test case to verify CRLF is correctly handled.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I99e146717b815e3e40c232376555b2b48d77bc56
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 ...
|