Check if eMMC is mounted before writing during multipart update.
This change adds a check to ensure that the eMMC filesystem is mounted before attempting to write firmware bundle files during a multipart update. If the eMMC is not mounted, an error is returned, preventing writes to an unexpected location. The return type of CreateBoostRequest is also updated to StatusOr to propagate errors.
I choose sys/stat to avoid DBus dependencies (which is normally async).
This will avoid all future problem that firmware bundle is placed into rwfs and brick BMC, because of eMMC not being ready.
#bmc-bloom
No eMMC.
```
root@ddcbs3-nfd01:~# umount /mnt/luks-mmcblk0_fs/
root@ddcbs3-nfd01:~# df -h
Filesystem Size Used Available Use% Mounted on
dev 468.4M 0 468.4M 0% /dev
tmpfs 469.4M 13.3M 456.1M 3% /run
/dev/mtdblock4 52.1M 52.1M 0 100% /run/initramfs/ro
/dev/mtdblock7 3.0M 956.0K 2.1M 31% /run/initramfs/rw
cow 3.0M 956.0K 2.1M 31% /
tmpfs 469.4M 8.0K 469.4M 0% /dev/shm
tmpfs 469.4M 8.7M 460.7M 2% /tmp
tmpfs 469.4M 52.0K 469.3M 0% /var/volatile
tmpfs 469.4M 13.3M 456.1M 3% /var/lib/systemd/coredump
root@ddcbs3-nfd01:~# mkdir /mnt/luks-mmcblk0_fs/
mkdir: can't create directory '/mnt/luks-mmcblk0_fs/': File exists
root@ddcbs3-nfd01:~# touch /mnt/luks-mmcblk0_fs/something.txt
root@ddcbs3-nfd01:~# echo "hello" >> /mnt/luks-mmcblk0_fs/something.txt
root@ddcbs3-nfd01:~# cat /mnt/luks-mmcblk0_fs/something.txt
hello
ddcbs3-n1:~# /tmp/platforms_milotic_milotictool_mpm/1-23c4ce84_050585c7_e0f8d895_e258b4ad_27400fc6/milotic_tool_cli -uid= -gid= --auth insecure --command post --host ddcbs3-nfd01 --port 3995 --resource_url /redfish/v1/UpdateService/MultipartUpdate --command_body_file firmware_bundle.tar.gz
E0220 17:57:13.988465 99321 google_no_envelope_resolver.cc:195] UNAVAILABLE: (ddcbs3-nfd01:3995): unknown resolver mechanism. For DNS resolution, please prepend addresses with 'dns:///'.
=== Source Location Trace: ===
net/grpc/util/address_updater/address_updater.cc:951
URL is /redfish/v1/UpdateService/MultipartUpdate
Command body will be parsed from firmware_bundle.tar.gz
F0220 17:57:14.040414 99229 grpc_dynamic_raw.cc:382] Command failed: INTERNAL: eMMC is not mounted. Can't process multipart update.
=== Source Location Trace: ===
third_party/ecclesia/lib/status/rpc.h:45
Body is
```
Have eMMC
```
root@ddcbs3-nfd01:~# df -h
Filesystem Size Used Available Use% Mounted on
dev 468.4M 0 468.4M 0% /dev
tmpfs 469.4M 4.2M 465.2M 1% /run
/dev/mtdblock4 52.1M 52.1M 0 100% /run/initramfs/ro
/dev/mtdblock7 3.0M 956.0K 2.1M 31% /run/initramfs/rw
cow 3.0M 956.0K 2.1M 31% /
tmpfs 469.4M 8.0K 469.4M 0% /dev/shm
tmpfs 469.4M 224.0K 469.2M 0% /tmp
tmpfs 469.4M 52.0K 469.3M 0% /var/volatile
tmpfs 14.2G 304.2M 13.2G 2% /var/lib/systemd/coredump
/dev/mapper/luks-mmcblk0
14.2G 304.2M 13.2G 2% /mnt/luks-mmcblk0_fs
/dev/mapper/luks-mmcblk0
14.2G 304.2M 13.2G 2% /run/systemd/coredumps
/dev/mapper/luks-mmcblk0
14.2G 304.2M 13.2G 2% /var/lib/systemd/coredump
ddcbs3-n1:~# /tmp/platforms_milotic_milotictool_mpm/1-23c4ce84_050585c7_e0f8d895_e258b4ad_27400fc6/milotic_tool_cli -uid= -gid= --auth insecure --command post --host ddcbs3-nfd01 --port 3995 --resource_url /redfish/v1/UpdateService/MultipartUpdate --command_body_file firmware_bundle.tar.gz
E0220 18:09:52.075019 103457 google_no_envelope_resolver.cc:195] UNAVAILABLE: (ddcbs3-nfd01:3995): unknown resolver mechanism. For DNS resolution, please prepend addresses with 'dns:///'.
=== Source Location Trace: ===
net/grpc/util/address_updater/address_updater.cc:951
URL is /redfish/v1/UpdateService/MultipartUpdate
Command body will be parsed from firmware_bundle.tar.gz
Response JSON is /redfish/v1/UpdateService/MultipartUpdate{
"@odata.id": "/redfish/v1/TaskService/Tasks/FirmwareBundleUpdate",
"@odata.type": "#Task.v1_4_2.Task",
"Id": "FirmwareBundleUpdate",
"Name": "Firmware Bundle Update",
"PercentComplete": 0,
"TaskState": "New"
}
Response JSON is /redfish/v1/UpdateService/MultipartUpdate{
"@odata.id": "/redfish/v1/TaskService/Tasks/FirmwareBundleUpdate",
"@odata.type": "#Task.v1_4_2.Task",
"Id": "FirmwareBundleUpdate",
"Name": "Firmware Bundle Update",
"PercentComplete": 0,
"TaskState": "New"
}
```
PiperOrigin-RevId: 873161540
Change-Id: Ibe3dc55062a5be62f91425c2ff33533883559b7d
This project is Google's version of BMCWeb.
See Readme Google for Google added features. The following is the original README of OpenBMC/BMCWeb.
==============================================================================
This component attempts to be a “do everything” embedded webserver for OpenBMC.
The webserver implements a few distinct interfaces:
bmcweb at a protocol level supports http and https. TLS is supported through OpenSSL.
Bmcweb supports multiple authentication protocols:
Each of these types of authentication is able to be enabled or disabled both via runtime policy changes (through the relevant Redfish APIs) or via configure time options. All authentication mechanisms supporting username/password are routed to libpam, to allow for customization in authentication implementations.
All authorization in bmcweb is determined at routing time, and per route, and conform to the Redfish PrivilegeRegistry.
*Note: Non-Redfish functions are mapped to the closest equivalent Redfish privilege level.
bmcweb is configured per the meson build files. Available options are documented in meson_options.txt
meson builddir ninja -C builddir
If any of the dependencies are not found on the host system during configuration, meson will automatically download them via its wrap dependencies mentioned in bmcweb/subprojects.
bmcweb relies on some on-system data for storage of persistent data that is internal to the process. Details on the exact data stored and when it is read/written can seen from the persistent_data namespace.
When SSL support is enabled and a usable certificate is not found, bmcweb will generate a self-signed a certificate before launching the server. Please see the bmcweb source code for details on the parameters this certificate is built with.
bmcweb is capable of aggregating resources from satellite BMCs. Refer to AGGREGATION.md for more information on how to enable and use this feature.