Service for enabling/disabling host failure reboots
Wraps the auto_reboot host setting in a service so it
can be enabled or disabled by starting or stopping the
service.
Change-Id: Ib3e92f67eb833cd6e31e153b58a63edb6837ae2c
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/packagegroups/packagegroup-op-apps.bb b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/packagegroups/packagegroup-op-apps.bb
index e4decd4..d5a542a 100644
--- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/packagegroups/packagegroup-op-apps.bb
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/packagegroups/packagegroup-op-apps.bb
@@ -31,6 +31,7 @@
obmc-op-control-power \
obmc-pcie-detect \
obmc-watchdog \
+ obmc-host-failure-reboots \
"
#Pull in obmc-fsi-scan on all P9 OpenPOWER systems
RDEPENDS_${PN}-chassis += "${@mf_enabled(d, 'obmc-fsi-scan', 'obmc-fsi-scan')}"
diff --git a/meta-phosphor/common/recipes-phosphor/chassis/obmc-host-failure-reboots.bb b/meta-phosphor/common/recipes-phosphor/chassis/obmc-host-failure-reboots.bb
new file mode 100644
index 0000000..e0f9b84
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/chassis/obmc-host-failure-reboots.bb
@@ -0,0 +1,9 @@
+SUMMARY = "Enables reboots on host failures"
+DESCRIPTION = "Manages the settings entry that controls reboots \
+on host failures"
+PR = "r1"
+
+inherit obmc-phosphor-systemd
+inherit obmc-phosphor-license
+
+SYSTEMD_SERVICE_${PN} += "host-failure-reboots.service"
diff --git a/meta-phosphor/common/recipes-phosphor/chassis/obmc-host-failure-reboots/host-failure-reboots.service b/meta-phosphor/common/recipes-phosphor/chassis/obmc-host-failure-reboots/host-failure-reboots.service
new file mode 100644
index 0000000..81902ae
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/chassis/obmc-host-failure-reboots/host-failure-reboots.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Enable reboot on host failures
+Wants=mapper-wait@-org-openbmc-settings-host0.service
+After=mapper-wait@-org-openbmc-settings-host0.service
+
+[Service]
+ExecStart = /bin/sh -c "busctl set-property `mapper get-service /org/openbmc/settings/host0` /org/openbmc/settings/host0 org.openbmc.settings.Host auto_reboot s \"yes\""
+ExecStop = /bin/sh -c "busctl set-property `mapper get-service /org/openbmc/settings/host0` /org/openbmc/settings/host0 org.openbmc.settings.Host auto_reboot s \"no\""
+Type=oneshot
+RemainAfterExit=yes
+
+[Install]
+WantedBy={SYSTEMD_DEFAULT_TARGET}