vpnor: Catch ReasonedError in vpnor_copy_bootloader_partition
It was observed that mboxd cored on systems that didn't have a virtual
PNOR deployed:
```
May 09 10:53:48 witherspoon systemd[1]: Starting Updates symlinks for active PNOR version...
May 09 10:53:49 witherspoon obmc-flash-bios[1238]: ls: /media/pnor-ro-*: No such file or directory
May 09 10:53:49 witherspoon systemd[1]: Started Updates symlinks for active PNOR version.
May 09 10:53:49 witherspoon systemd[1]: Started Phosphor MBOX Daemon.
May 09 10:53:51 witherspoon mboxd[1242]: terminate called after throwing an instance of 'openpower::virtual_pnor::UnknownPartition'
May 09 10:53:51 witherspoon mboxd[1242]: what(): Partition HBB is not listed in the table of contents
May 09 10:53:51 witherspoon systemd[1]: Created slice system-systemd\x2dcoredump.slice.
May 09 10:53:51 witherspoon systemd[1]: Started Process Core Dump (PID 1243/UID 0).
May 09 10:53:51 witherspoon phosphor-host-state-manager[1237]: Initial Host State will be Off
May 09 10:53:51 witherspoon phosphor-host-state-manager[1237]: External request to reset reboot count
May 09 10:53:51 witherspoon systemd[1]: Started Phosphor Host State Manager.
May 09 10:53:51 witherspoon systemd[1]: Started Witherspoon UART render controller.
May 09 10:53:53 witherspoon systemd[1]: Started Wait for /xyz/openbmc_project/state/host0.
May 09 10:53:53 witherspoon systemd[1]: Starting Reset host sensors...
May 09 10:53:53 witherspoon systemd[1]: Starting Reboot If Enabled...
May 09 10:53:53 witherspoon systemd[1]: Starting Phosphor Time Manager daemon...
May 09 10:53:55 witherspoon systemd[1]: mboxd.service: Main process exited, code=dumped, status=6/ABRT
May 09 10:53:56 witherspoon systemd[1]: mboxd.service: Unit entered failed state.
May 09 10:53:56 witherspoon systemd[1]: mboxd.service: Failed with result 'core-dump'.
```
The ToC parsing and partition lookup functions can throw a variety of
exceptions, though the ones we care about are all derived from
ReasonedError. Catch ReasonedError to avoid core-dumping mboxd when it is
launched without a virtual PNOR available or symlinks in place th point it to
the virtual PNOR root directory.
Further, explicitly ignore the failure in the start-up path. This keeps
mboxd alive, which will recover on receiving a RESET if the appropriate
images and symlinks have been put in place.
Change-Id: I1f753d1944d29499e360cbdf5a27a3531f37eed6
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/mboxd.c b/mboxd.c
index f92d9fb..070c8bc 100644
--- a/mboxd.c
+++ b/mboxd.c
@@ -334,7 +334,7 @@
/* Set the LPC bus mapping */
rc = reset_lpc(context);
if (rc) {
- goto finish;
+ MSG_ERR("LPC configuration failed, RESET required: %d\n", rc);
}
rc = set_bmc_events(context, BMC_EVENT_DAEMON_READY, SET_BMC_EVENT);
diff --git a/vpnor/mboxd_pnor_partition_table.cpp b/vpnor/mboxd_pnor_partition_table.cpp
index fad0c7f..1756516 100644
--- a/vpnor/mboxd_pnor_partition_table.cpp
+++ b/vpnor/mboxd_pnor_partition_table.cpp
@@ -114,7 +114,7 @@
phosphor::logging::commit<err::InternalFailure>();
return -MBOX_R_SYSTEM_ERROR;
}
- catch (vpnor::TocEntryError &e)
+ catch (vpnor::ReasonedError &e)
{
MSG_ERR("%s\n", e.what());
phosphor::logging::commit<err::InternalFailure>();