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 ...
|
4b9ac392 | 11-Oct-2019 |
Lei YU <mine260309@gmail.com> |
utils: Add function to check if PSU is associated
Add a helper function to check if a PSU is in an association list, which will be used in future commits to check if a PSU is running a software imag
utils: Add function to check if PSU is associated
Add a helper function to check if a PSU is in an association list, which will be used in future commits to check if a PSU is running a software image.
Tested: added unit test case and verify it passes.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I99b5d3d8d09f8e09a1eb42ba104a4804b7214cf1
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 ...
|
c09155bb | 11-Oct-2019 |
Lei YU <mine260309@gmail.com> |
Test: Use unique mocked utils for each test
The mocked utils object was shared between the tests because it's a static object. This causes problems on expecting the number of called the mocked funct
Test: Use unique mocked utils for each test
The mocked utils object was shared between the tests because it's a static object. This causes problems on expecting the number of called the mocked functions.
Add a freeUtils() in mocked_utils.hpp, and call it in test fixture's destructor, so that each test case will use a different mocked object.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I2622c678012d30b2bd75dc37a2bc3a663f40d86c
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 ...
|
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 ...
|
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 ...
|
fda15a33 | 19-Sep-2019 |
Lei YU <mine260309@gmail.com> |
Refactor Version::getValue()
Rename the function to getValues() and change the parameter and return value types, and add a test case for it. It will be used in future commits.
Tested: Verify the un
Refactor Version::getValue()
Rename the function to getValues() and change the parameter and return value types, and add a test case for it. It will be used in future commits.
Tested: Verify the unit test case passes.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I57ccf857737ef13f4e2f27c5f2fb7400a2170e91
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 ...
|
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 ...
|
12c9f4c4 | 11-Sep-2019 |
Lei YU <mine260309@gmail.com> |
Activation: initially support psu update
Initial support for PSU update by starting a systemd unit with PSU inventory path and image dir as arguments.
Add an example psu-update@.service that shows
Activation: initially support psu update
Initial support for PSU update by starting a systemd unit with PSU inventory path and image dir as arguments.
Add an example psu-update@.service that shows how the arguments are passed to systemd unit and expanded to command line arguments.
Tested: Upload a dummy tarball, create a dummy service that only prints the arguments, and verify the service is invoked correctly when the RequestedActivation is set to Active.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I7e122f1cce234caf4951d3e3daad5bee406b507b
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 ...
|
5f3584d4 | 27-Aug-2019 |
Lei YU <mine260309@gmail.com> |
Get PSU version from vendor specific tool
The code was getting the version from PSU inventory object. This commit changes the behavior to use a vendor-specific tool to get the version directly, wher
Get PSU version from vendor specific tool
The code was getting the version from PSU inventory object. This commit changes the behavior to use a vendor-specific tool to get the version directly, where the tool is expected to be configured during build time.
Add an example get_version app that shows the expected behavior of the tool: * It accepts an argument of PSU inventory object; * It outputs the version to stdout.
Tested: 1. Put and configure to use the example get_version on witherspoon, verify that PSU software objects are created with the version returned by the exmaple tool. 2. With the Witherspoon specific tool in https://gerrit.openbmc-project.xyz/c/openbmc/witherspoon-pfault-analysis/+/24811, verify the version is correctly got from the PSU inventory path and the software objects are created.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I5195cb6fc8998a76b09abcfe0b107364cb180c01
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 ...
|
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 ...
|