mmc: Add HardwareIsolation service to restart if factory resets
- The HardwareIsolation (daemon) service is dependent on the host partition
to share the host isolated hardware entries through the external
interface (for example Redfish).
- But, If we attempted to do the factory reset then, the host partition
gets deleted and recreated back so due to this the HardwareIsolation
daemon is unable to handle the host partition.
- Fixed the above mentioned issue by restarting the HardwareIsolation daemon.
- Note, start unit won't help if the service is already running like a daemon
so, we need to use restart method for the HardwareIsolation so modified
the code to use a method based on the services that's need to consider
in the host factory reset.
Tested:
- Verified by the host factory reset.
```
Apr 20 11:59:33 bmc_system phosphor-log-manager[339]: Deleting all log entries
Apr 20 11:59:33 bmc_system systemd[1]: Starting Setup Host FW directories...
Apr 20 11:59:33 bmc_system systemd[1]: Starting Create patch directory for Host FW...
Apr 20 11:59:33 bmc_system systemd[1]: Stopping OpenPOWER Host HardwareIsolation...
Apr 20 11:59:33 bmc_system systemd[1]: Starting Reset PHYP-NVRAM-CKSUM file...
Apr 20 11:59:33 bmc_system systemd[1]: Starting Reset PHYP-NVRAM file...
Apr 20 11:59:33 bmc_system systemd[1]: org.open_power.HardwareIsolation.service: Deactivated successfully.
Apr 20 11:59:33 bmc_system systemd[1]: Stopped OpenPOWER Host HardwareIsolation.
Apr 20 11:59:33 bmc_system systemd[1]: pldm-reset-phyp-nvram-cksum.service: Deactivated successfully.
Apr 20 11:59:33 bmc_system systemd[1]: Finished Reset PHYP-NVRAM-CKSUM file.
Apr 20 11:59:33 bmc_system systemd[1]: Starting Create empty PHYP-NVRAM-CKSUM file...
Apr 20 11:59:33 bmc_system dd[9688]: 1+0 records in
Apr 20 11:59:33 bmc_system dd[9688]: 1+0 records out
Apr 20 11:59:33 bmc_system systemd[1]: pldm-create-phyp-nvram-cksum.service: Deactivated successfully.
Apr 20 11:59:33 bmc_system systemd[1]: Finished Create empty PHYP-NVRAM-CKSUM file.
Apr 20 11:59:33 bmc_system systemd[1]: obmc-flash-bios-patch.service: Deactivated successfully.
Apr 20 11:59:33 bmc_system systemd[1]: Finished Create patch directory for Host FW.
Apr 20 11:59:33 bmc_system systemd[1]: pldm-reset-phyp-nvram.service: Deactivated successfully.
Apr 20 11:59:33 bmc_system systemd[1]: Finished Reset PHYP-NVRAM file.
Apr 20 11:59:34 bmc_system systemd[1]: Starting Create empty PHYP-NVRAM file...
Apr 20 11:59:39 bmc_system systemd[1]: obmc-flash-bios-init.service: Deactivated successfully.
Apr 20 11:59:39 bmc_system systemd[1]: Finished Setup Host FW directories.
Apr 20 11:59:39 bmc_system systemd[1]: Starting Set POWER host firmware well-known names...
Apr 20 11:59:39 bmc_system dd[9692]: 145408+0 records in
Apr 20 11:59:39 bmc_system dd[9692]: 145408+0 records out
Apr 20 11:59:39 bmc_system systemd[1]: pldm-create-phyp-nvram.service: Deactivated successfully.
Apr 20 11:59:39 bmc_system systemd[1]: Finished Create empty PHYP-NVRAM file.
Apr 20 11:59:41 bmc_system systemd[1]: openpower-process-host-firmware.service: Deactivated successfully.
Apr 20 11:59:41 bmc_system systemd[1]: Finished Set POWER host firmware well-known names.
Apr 20 11:59:41 bmc_system systemd[1]: Starting Update BIOS attr table with host firmware well-known names...
Apr 20 11:59:41 bmc_system systemd[1]: openpower-update-bios-attr-table.service: Deactivated successfully.
Apr 20 11:59:41 bmc_system systemd[1]: Finished Update BIOS attr table with host firmware well-known names.
Apr 20 11:59:41 bmc_system systemd[1]: Starting OpenPOWER Host HardwareIsolation...
Apr 20 11:59:41 bmc_system systemd[1]: Started OpenPOWER Host HardwareIsolation.
```
Signed-off-by: Ramesh Iyyar <rameshi1@in.ibm.com>
Change-Id: I37ae2862d105ff3901e408df15f58d7653e95ad3
diff --git a/mmc/item_updater_mmc.cpp b/mmc/item_updater_mmc.cpp
index 9541b08..c806252 100644
--- a/mmc/item_updater_mmc.cpp
+++ b/mmc/item_updater_mmc.cpp
@@ -90,18 +90,22 @@
}
// Recreate default files.
- const std::string services[] = {"obmc-flash-bios-init.service",
- "obmc-flash-bios-patch.service",
- "openpower-process-host-firmware.service",
- "openpower-update-bios-attr-table.service",
- "pldm-reset-phyp-nvram.service",
- "pldm-reset-phyp-nvram-cksum.service"};
+ // std::tuple<method, service_name>
+ const std::tuple<std::string, std::string> services[] = {
+ {"StartUnit", "obmc-flash-bios-init.service"},
+ {"StartUnit", "obmc-flash-bios-patch.service"},
+ {"StartUnit", "openpower-process-host-firmware.service"},
+ {"StartUnit", "openpower-update-bios-attr-table.service"},
+ {"StartUnit", "pldm-reset-phyp-nvram.service"},
+ {"StartUnit", "pldm-reset-phyp-nvram-cksum.service"},
+ {"RestartUnit", "org.open_power.HardwareIsolation.service"}};
for (const auto& service : services)
{
auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
- SYSTEMD_INTERFACE, "StartUnit");
- method.append(service, "replace");
+ SYSTEMD_INTERFACE,
+ std::get<0>(service).c_str());
+ method.append(std::get<1>(service), "replace");
// Ignore errors if the service is not found - not all systems
// may have these services
try