| commit | 5f1346aff2a3f7bf2cec0cea7e24b9f9acb3a8f2 | [log] [tgz] | 
|---|---|---|
| author | Chau Ly <chaul@amperecomputing.com> | Fri Sep 05 02:51:09 2025 +0000 | 
| committer | Chau Ly <chaul@amperecomputing.com> | Thu Sep 11 07:15:45 2025 +0000 | 
| tree | b77802085c7028afb3c2a14543d54e0fd215111a | |
| parent | 2e168dba1029d1c5baaf065ad7306150dd3cafc2 [diff] | 
bmc: ItemUpdater: Erase tmp folder in erase()
When bmcweb's `redfish-updateservice-use-dbus` is enabled and
`software-update-dbus-interface` option is enabled for this repo,
firmware update to bios_active target via Redfish will be handled by
bmc/ItemUpdater class. During the verification to create new software
objects in `ItemUpdater::verifyAndCreateObjects()`,
`ItemUpdater::erase()` is registered as the erasing callback when
`.Delete` method is called for the software object.
However, in `ItemUpdater::erase()`, in terms of image data, it only
erases RO partition and persist data for BMC image. For BIOS image, it
leaves off the temporary image folder of the software entry under
`$IMG_UPLOAD_DIR` (aka `/tmp/images/`), which can lead to memory leak
issue if BIOS firmware update is performed multiple times without BMC
reboot.
This commit handles removing the temporary image folder in
`ItemUpdater::erase()` for non-BMC firmware image when
`useUpdateDBusInterface` is true, which means this ItemUpdater object is
created when `software-update-dbus-interface` option is enabled.
Tested:
1. Execute BIOS firmware upgrade via Redfish
token=`curl -k -H "Content-Type: application/json" -X POST \
https://${BMC_IP}/login -d '{"username" :  "root", "password" :  \
"0penBmc"}' | grep token | awk '{print $2;}' | tr -d '"'`
uri=$(curl -k -H "X-Auth-Token: $token" \
https://${BMC_IP}/redfish/v1/UpdateService | jq -r ' \
.MultipartHttpPushUri')
curl -k -H "X-Auth-Token: $token" \
-H "Content-Type:multipart/form-data" -X POST \
-F UpdateParameters="{\"Targets\":[\
"/redfish/v1/UpdateService/FirmwareInventory/bios_active\"], \
"@Redfish.OperationApplyTime\":\"OnReset\"};type=application/json"\
-F "UpdateFile=@${IMG_PATH}" https://${BMC_IP}${uri}
Expected that upon upgrade completion, the newly added BIOS software
entry is removed from D-Bus, and the image folder with the software
entry name under `/tmp/images/` is removed too.
Change-Id: I7208cf2381af7db75bfd3cec99b0b891efa91cc8
Signed-off-by: Chau Ly <chaul@amperecomputing.com>
Phosphor BMC Code Management provides a set of system software management applications. More information can be found at Software Architecture
To build this package, do the following steps:
meson buildninja -C buildTo clean the repository run rm -r build.