Add phosphor-host-check and required host services
This application and services will be used by the host reset service
to determine if the host is running after a BMC has been rebooted
Change-Id: I8299546b0f275ebbb46aa775ab7b0633cc3fd5e0
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
diff --git a/meta-phosphor/classes/obmc-phosphor-image.bbclass b/meta-phosphor/classes/obmc-phosphor-image.bbclass
index e33aa76..29689b7 100644
--- a/meta-phosphor/classes/obmc-phosphor-image.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-image.bbclass
@@ -12,6 +12,7 @@
# - obmc-host-ctl - OpenBMC host control
# - obmc-host-ipmi - OpenBMC host IPMI
# - obmc-host-state-mgmt - OpenBMC host state management
+# - obmc-host-check-mgmt - OpenBMC host state checking
# - obmc-inventory - OpenBMC inventory support
# - obmc-leds - OpenBMC LED support
# - obmc-logging-mgmt - OpenBMC logging management
@@ -39,6 +40,7 @@
FEATURE_PACKAGES_obmc-host-ctl ?= "${@cf_enabled(d, 'obmc-host-ctl', 'virtual-obmc-host-ctl')}"
FEATURE_PACKAGES_obmc-host-ipmi ?= "${@cf_enabled(d, 'obmc-host-ipmi', 'virtual-obmc-host-ipmi-hw')}"
FEATURE_PACKAGES_obmc-host-state-mgmt ?= "packagegroup-obmc-apps-host-state-mgmt"
+FEATURE_PACKAGES_obmc-host-check-mgmt ?= "packagegroup-obmc-apps-host-check-mgmt"
FEATURE_PACKAGES_obmc-inventory ?= "packagegroup-obmc-apps-inventory"
FEATURE_PACKAGES_obmc-leds ?= "packagegroup-obmc-apps-leds"
FEATURE_PACKAGES_obmc-logging-mgmt ?= "${@df_enabled(d, 'obmc-logging-mgmt', 'virtual-obmc-logging-mgmt')}"
@@ -61,6 +63,7 @@
obmc-host-ctl \
obmc-host-ipmi \
obmc-host-state-mgmt \
+ obmc-host-check-mgmt \
obmc-inventory \
obmc-leds \
obmc-logging-mgmt \
diff --git a/meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host.bb b/meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host.bb
index 8533c8e..e4c54be 100644
--- a/meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host.bb
+++ b/meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host.bb
@@ -14,8 +14,6 @@
DBUS_SERVICE_${PN} += "${@compose_list(d, 'FMT', 'OBMC_HOST_INSTANCES')}"
SYSTEMD_SERVICE_${PN} = " \
op-start-host@.service \
- op-reset-host-check@.service \
- op-reset-host-running@.service \
"
START_TMPL = "op-start-host@.service"
@@ -23,23 +21,4 @@
START_INSTFMT = "obmc-start-host@{0}.service"
START_FMT = "../${START_TMPL}:${START_TGTFMT}.requires/${START_INSTFMT}"
-RESET_CHECK_TMPL = "op-reset-host-check@.service"
-RESET_CHECK_TGTFMT = "obmc-host-reset@{1}.target"
-RESET_CHECK_INSTFMT = "op-reset-host-check@{0}.service"
-RESET_CHECK_FMT = "../${RESET_CHECK_TMPL}:${RESET_CHECK_TGTFMT}.requires/${RESET_CHECK_INSTFMT}"
-
-RESET_RUNNING_TMPL = "op-reset-host-running@.service"
-RESET_RUNNING_TGTFMT = "obmc-host-reset@{1}.target"
-RESET_RUNNING_INSTFMT = "op-reset-host-running@{0}.service"
-RESET_RUNNING_FMT = "../${RESET_RUNNING_TMPL}:${RESET_RUNNING_TGTFMT}.requires/${RESET_RUNNING_INSTFMT}"
-
SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'START_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
-SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_CHECK_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
-SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_RUNNING_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
-
-# Force the standby target to run the host reset check target
-RESET_TMPL_CTRL = "obmc-host-reset@.target"
-SYSD_TGT = "${SYSTEMD_DEFAULT_TARGET}"
-RESET_INSTFMT_CTRL = "obmc-host-reset@{0}.target"
-RESET_FMT_CTRL = "../${RESET_TMPL_CTRL}:${SYSD_TGT}.wants/${RESET_INSTFMT_CTRL}"
-SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_FMT_CTRL', 'OBMC_HOST_INSTANCES')}"
diff --git a/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb b/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
index 3dcba8a..f3212cd 100644
--- a/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
+++ b/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
@@ -17,6 +17,7 @@
${PN}-leds \
${PN}-sensors \
${PN}-software \
+ ${PN}-host-check-mgmt \
"
SUMMARY_${PN}-bmc-state-mgmt = "BMC state management"
@@ -29,6 +30,11 @@
${VIRTUAL-RUNTIME_obmc-chassis-state-manager} \
"
+SUMMARY_${PN}-host-check-mgmt = "Host state check on bmc reset"
+RDEPENDS_${PN}-host-check-mgmt = " \
+ ${VIRTUAL-RUNTIME_obmc-host-check} \
+ "
+
SUMMARY_${PN}-extras = "Extra features"
RDEPENDS_${PN}-extras = " \
phosphor-rest \
diff --git a/meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host/op-reset-host-check@.service b/meta-phosphor/common/recipes-phosphor/state/files/phosphor-reset-host-check@.service
similarity index 63%
rename from meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host/op-reset-host-check@.service
rename to meta-phosphor/common/recipes-phosphor/state/files/phosphor-reset-host-check@.service
index 7c9a05c..ba4f0c0 100644
--- a/meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host/op-reset-host-check@.service
+++ b/meta-phosphor/common/recipes-phosphor/state/files/phosphor-reset-host-check@.service
@@ -1,8 +1,7 @@
[Unit]
Description=Check Host%i status on BMC reset
-# TODO: openbmc/openbmc#1274
-#Wants=mapper-wait@-xyz-openbmc_project-control-host%i.service
-#After=mapper-wait@-xyz-openbmc_project-control-host%i.service
+Wants=mapper-wait@-xyz-openbmc_project-control-host%i.service
+After=mapper-wait@-xyz-openbmc_project-control-host%i.service
Wants=obmc-host-reset-running@%i.target
Before=obmc-host-reset-running@%i.target
Wants=op-reset-chassis-on@%i.service
@@ -13,7 +12,7 @@
[Service]
RemainAfterExit=yes
Type=oneshot
-ExecStart=/bin/sh -c "echo TODO - Check Host Status on BMC Reset"
+ExecStart=/usr/sbin/phosphor-host-check
[Install]
diff --git a/meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host/op-reset-host-running@.service b/meta-phosphor/common/recipes-phosphor/state/files/phosphor-reset-host-running@.service
similarity index 100%
rename from meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host/op-reset-host-running@.service
rename to meta-phosphor/common/recipes-phosphor/state/files/phosphor-reset-host-running@.service
diff --git a/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb b/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb
index ce0fa1e..7ba02a0 100644
--- a/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb
+++ b/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb
@@ -12,6 +12,7 @@
${PN}-chassis \
${PN}-bmc \
${PN}-discover \
+ ${PN}-host-check \
"
PACKAGES =+ "${STATE_MGR_PACKAGES}"
PACKAGES_remove = "${PN}"
@@ -35,6 +36,7 @@
RDEPENDS_${PN}-chassis += "libsystemd phosphor-dbus-interfaces"
RDEPENDS_${PN}-bmc += "libsystemd phosphor-dbus-interfaces"
RDEPENDS_${PN}-discover += "libsystemd phosphor-dbus-interfaces"
+RDEPENDS_${PN}-host-check += "libsystemd phosphor-dbus-interfaces"
FILES_${PN}-host = "${sbindir}/phosphor-host-state-manager"
DBUS_SERVICE_${PN}-host += "xyz.openbmc_project.State.Host.service"
@@ -48,12 +50,36 @@
FILES_${PN}-discover = "${sbindir}/phosphor-discover-system-state"
SYSTEMD_SERVICE_${PN}-discover += "phosphor-discover-system-state@.service"
+FILES_${PN}-host-check = "${sbindir}/phosphor-host-check"
+SYSTEMD_SERVICE_${PN}-host-check += "phosphor-reset-host-check@.service"
+SYSTEMD_SERVICE_${PN}-host-check += "phosphor-reset-host-running@.service"
+
+RESET_CHECK_TMPL = "phosphor-reset-host-check@.service"
+RESET_CHECK_TGTFMT = "obmc-host-reset@{1}.target"
+RESET_CHECK_INSTFMT = "phosphor-reset-host-check@{0}.service"
+RESET_CHECK_FMT = "../${RESET_CHECK_TMPL}:${RESET_CHECK_TGTFMT}.requires/${RESET_CHECK_INSTFMT}"
+
+RESET_RUNNING_TMPL = "phosphor-reset-host-running@.service"
+RESET_RUNNING_TGTFMT = "obmc-host-reset@{1}.target"
+RESET_RUNNING_INSTFMT = "phosphor-reset-host-running@{0}.service"
+RESET_RUNNING_FMT = "../${RESET_RUNNING_TMPL}:${RESET_RUNNING_TGTFMT}.requires/${RESET_RUNNING_INSTFMT}"
+
+SYSTEMD_LINK_${PN}-host-check += "${@compose_list_zip(d, 'RESET_CHECK_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
+SYSTEMD_LINK_${PN}-host-check += "${@compose_list_zip(d, 'RESET_RUNNING_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
+
+# Force the standby target to run the host reset check target
+RESET_TMPL_CTRL = "obmc-host-reset@.target"
+SYSD_TGT = "${SYSTEMD_DEFAULT_TARGET}"
+RESET_INSTFMT_CTRL = "obmc-host-reset@{0}.target"
+RESET_FMT_CTRL = "../${RESET_TMPL_CTRL}:${SYSD_TGT}.wants/${RESET_INSTFMT_CTRL}"
+SYSTEMD_LINK_${PN}-host-check += "${@compose_list_zip(d, 'RESET_FMT_CTRL', 'OBMC_HOST_INSTANCES')}"
+
TMPL = "phosphor-discover-system-state@.service"
INSTFMT = "phosphor-discover-system-state@{0}.service"
FMT = "../${TMPL}:${SYSTEMD_DEFAULT_TARGET}.wants/${INSTFMT}"
SYSTEMD_LINK_${PN}-discover += "${@compose_list(d, 'FMT', 'OBMC_HOST_INSTANCES')}"
SRC_URI += "git://github.com/openbmc/phosphor-state-manager"
-SRCREV = "cc3fb5d9a720a9a5b2102683da716004cd938e39"
+SRCREV = "d5ac63507a47010f51ce857bd680c2f655380841"
S = "${WORKDIR}/git"
diff --git a/meta-phosphor/conf/distro/include/phosphor-defaults.inc b/meta-phosphor/conf/distro/include/phosphor-defaults.inc
index 53298da..8ce8e4b 100644
--- a/meta-phosphor/conf/distro/include/phosphor-defaults.inc
+++ b/meta-phosphor/conf/distro/include/phosphor-defaults.inc
@@ -39,6 +39,13 @@
# power the host back on.
VIRTUAL-RUNTIME_obmc-discover-system-state ?= "phosphor-state-manager-discover"
+# obmc-host-check
+#
+# Provides an implementation of phosphor-host-check, which will determine
+# if the host is running after a BMC reboot and create the necessary file
+# to indicate to host services that the host is running
+VIRTUAL-RUNTIME_obmc-host-check ?= "phosphor-state-manager-host-check"
+
# obmc-fan-presence
#
# Provides implementations of fan presence detection