History log of /openbmc/phosphor-psu-code-mgmt/src/activation.hpp (Results 1 – 25 of 28)
Revision Date Author Comments
# 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 ...


# 7cb5d05e 03-Jan-2025 Shawn McCarney <shawnmm@us.ibm.com>

Handle repeated activation requests

PSU code versions are represented on D-Bus as a combination of Version
and Activation objects.

When this application determines that one or more PSUs need a code

Handle repeated activation requests

PSU code versions are represented on D-Bus as a combination of Version
and Activation objects.

When this application determines that one or more PSUs need a code
update, it sets the RequestedActivation property to Active on the
Activation object. This triggers the code update.

The code is updated on each PSU in sequential order. This process can
take several minutes depending on the PSU type and number of PSUs.

During this long code update process, it is possible for one of the
following to occur:
* New PSU information is found on D-Bus
* A new PSU is plugged in (hot-plug)

If the new PSU requires a code update, the application will again set
the RequestedActivation property to Active on the Activation object. If
a code update is already occurring, the property change is currently
ignored. That means that the new PSU will not be code updated.

Enhance the application so that the second code update request is not
ignored. If it is requested while another code update is already in
progress, then restart the code update process once the current one
completes.

Tested:
* Tested a repeated code update request occurring due to new PSU
information found on D-Bus.
* Tested a repeated code update request occurring due to a new PSU
being plugged in.
* Verified that code update cycle was repeated if a request was deferred
and the previous code update was successful.
* Verified that code update cycle was not repeated if a request was
deferred and the previous code update failed.
* See the complete test plan at
https://gist.github.com/smccarney/424f92af23fc25c6c2b6f67ee54d8919

Change-Id: Ie73e3f83c68945f6c85c2747003c36637791a24b
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 ...


# 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 ...


# 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 ...


# 434ae483 16-Apr-2022 Tang Yiwei <tangyiwei.2022@bytedance.com>

sdbusplus: object: don't use 'bool' argument constructor

`sdbusplus::server::object_t` has long had an enum-based parameter for
signal action, but maintained a backwards compatible boolean mapping.

sdbusplus: object: don't use 'bool' argument constructor

`sdbusplus::server::object_t` has long had an enum-based parameter for
signal action, but maintained a backwards compatible boolean mapping.
It is time to remove this boolean to make it more observable which
actions are being used in applications. Map all `true` occurrences to
`action::defer_emit` or `action::emit_interface_added`.

Signed-off-by: Tang Yiwei <tangyiwei.2022@bytedance.com>
Change-Id: Ibb77315bca56d6cebfb540976f44ee362534f942

show more ...


# f356fdc9 01-Mar-2020 Albert Zhang <zhanghaodi@inspur.com>

Cleanup the code related to emit_interface_added

sdbusplus now supports action::emit_interface_added() when an object is
constructed, so the code that manually invokes emit_interface_added()
could b

Cleanup the code related to emit_interface_added

sdbusplus now supports action::emit_interface_added() when an object is
constructed, so the code that manually invokes emit_interface_added()
could be cleaned up and use the above action instead.

Tested:Tested on fp5280g2, and psu update is normal.

Signed-off-by: Albert Zhang <zhanghaodi@inspur.com>
Change-Id: I0ca12a0941c1d45c860478c6f0d72675668de653

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 ...


# 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 ...


# e8945ea6 29-Sep-2019 Lei YU <mine260309@gmail.com>

Activation: support updating PSU from stored image

The previous code assume the image to update is from IMG_DIR.
Now it needs to update PSU from pre-built or stored images.

This commit adds the sup

Activation: support updating PSU from stored image

The previous code assume the image to update is from IMG_DIR.
Now it needs to update PSU from pre-built or stored images.

This commit adds the support, by constructing the systemd unit based on
Activation's Path property instead of IMG_DIR.

Tested: Verify on Witherspoon that it is able to activate a stored
image.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I0936bb921b22c7f67aee9689e3695e6b21703a29

show more ...


# 2e0e2de5 26-Sep-2019 Lei YU <mine260309@gmail.com>

Activation: store PSU image in persistent storage

When an activation succeeds, store the PSU image into persistent
storage, which will be used in future in case a PSU is replaced, and the
BMC will n

Activation: store PSU image in persistent storage

When an activation succeeds, store the PSU image into persistent
storage, which will be used in future in case a PSU is replaced, and the
BMC will need to update the replaced PSU's firmware.
Only the latest image is saved, and old ones are removed for each model.

Tested: On witherspoon, verify the PSU image is saved in persistent
storage after a successful activation with dummy service, and
the FilePath inteface is updated with the stored path.
And after another successful activation, the new image is saved
and the old one is removed in persistent storage.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I11f3d4a91d045d2316242d8eef968f05250d862e

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 ...


# 9edb7330 19-Sep-2019 Lei YU <mine260309@gmail.com>

Activation: check compatiblity of uploaded software

Before activation, check if the PSU inventory's manufacturer and model
matches the uploaded software, to make sure the software is not updated
to

Activation: check compatiblity of uploaded software

Before activation, check if the PSU inventory's manufacturer and model
matches the uploaded software, to make sure the software is not updated
to a incompatible PSU.

The model check is mandatory, and if the PSU manufacturer is empty,
ignore the manufacturer check.

Tested: Upload a dummy tarball with incompatible model, verify the
activation fails;
Upload a dummy tarball with compatible model, verify the
activation succeeds with a dummy update service.
Also added unit tests for several cases:
* Update on a PSU that model is incompatible;
* Update on a PSU that the manufacture is incompatible;
* Update on a PSU that the menufacture is empty;
* Update on 4 PSUs that the second one is incompatible.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: Ia1b6a3fa6c98cdea1ea93c917c0938d4a60f0911

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 ...


# ff83c2a0 12-Sep-2019 Lei YU <mine260309@gmail.com>

Activation: Support to update multiple PSUs

Queue the update on multiple PSUs, and do the update one-by-one.

Tested: Write unit test cases and verify the cases pass.
On witherspoon, verify

Activation: Support to update multiple PSUs

Queue the update on multiple PSUs, and do the update one-by-one.

Tested: Write unit test cases and verify the cases pass.
On witherspoon, verify the dummy update services are run on all
PSUs.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: Icfe0f6e74623e54840df8d731d852d53d6071768

show more ...


# 90c8a8b9 11-Sep-2019 Lei YU <mine260309@gmail.com>

Activation: Add activationProgress

Use ActivationProgress to provide the PSU update progress.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I92d8c1425cf5ec1d0ff192a822a60f0c59bd8110


# 81c67725 11-Sep-2019 Lei YU <mine260309@gmail.com>

Activation: Add activationBlocksTransition

Use activationBlocksTransition during PSU code update, which prevent
host from powering on during the activation.

Signed-off-by: Lei YU <mine260309@gmail.

Activation: Add activationBlocksTransition

Use activationBlocksTransition during PSU code update, which prevent
host from powering on during the activation.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: Ie303a99d9bbfee49c949884f16dbca0c5b08ee6e

show more ...


# d0bbfa9e 11-Sep-2019 Lei YU <mine260309@gmail.com>

Activation: Delete version interface after activation

When activation is finished, the version interface and the related
images created by phosphor-version-software-manager shall be deleted.

This i

Activation: Delete version interface after activation

When activation is finished, the version interface and the related
images created by phosphor-version-software-manager shall be deleted.

This is done by invoking the Delete method of the related service, so we
need to get all the services from the object, and get the correct
service to invoke the Delete method.

Tested: Verify the Version interface created by
xyz.openbmc_project.Software.Version service, and the related
files in /tmp/image/<versionId> are removed after activation is
completed.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: Icb14731bbea35175c2519bd40b9f88a0b54a034a

show more ...


12