From b3b5899fc47fdac6d3959051ebb223335909408a Mon Sep 17 00:00:00 2001 From: Michael Tritz Date: Fri, 31 Mar 2017 12:04:32 -0500 Subject: Recipe for phosphor-discover-system-state This recipe will add the new program phosphor-discover-system-state to new builds. Additionally, the old Python state manager is removed from the build since discover_system_state.py was the last thing in it. Resolves openbmc/openbmc#773 Change-Id: I99ba0f1f0264cedebc5a9a7e5fa5dbaba0b79502 Signed-off-by: Michael Tritz --- .../packagegroups/packagegroup-obmc-apps.bb | 1 + .../files/phosphor-discover-system-state@.service | 16 +++++++++++++ .../state/phosphor-state-manager.bb | 10 +++++--- .../recipes-phosphor/system/obmc-mgr-state.bb | 28 ---------------------- .../system/obmc-mgr-state/obmc-mgr-state.service | 15 ------------ .../system/obmc-mgr-state/obmc-mgr-state.target | 2 -- .../conf/distro/include/phosphor-defaults.inc | 7 ++++++ 7 files changed, 31 insertions(+), 48 deletions(-) create mode 100644 meta-phosphor/common/recipes-phosphor/state/files/phosphor-discover-system-state@.service delete mode 100644 meta-phosphor/common/recipes-phosphor/system/obmc-mgr-state.bb delete mode 100644 meta-phosphor/common/recipes-phosphor/system/obmc-mgr-state/obmc-mgr-state.service delete mode 100644 meta-phosphor/common/recipes-phosphor/system/obmc-mgr-state/obmc-mgr-state.target (limited to 'meta-phosphor') 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 a0415e077..815f40f3e 100644 --- a/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb +++ b/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb @@ -41,6 +41,7 @@ RDEPENDS_${PN}-extrasdev = " \ SUMMARY_${PN}-host-state-mgmt = "Host state management" RDEPENDS_${PN}-host-state-mgmt = " \ ${VIRTUAL-RUNTIME_obmc-host-state-manager} \ + ${VIRTUAL-RUNTIME_obmc-discover-system-state} \ " SUMMARY_${PN}-inventory = "Inventory applications" diff --git a/meta-phosphor/common/recipes-phosphor/state/files/phosphor-discover-system-state@.service b/meta-phosphor/common/recipes-phosphor/state/files/phosphor-discover-system-state@.service new file mode 100644 index 000000000..325e8dcc1 --- /dev/null +++ b/meta-phosphor/common/recipes-phosphor/state/files/phosphor-discover-system-state@.service @@ -0,0 +1,16 @@ +[Unit] +Description=Reboot If Enabled +Wants=mapper-wait@-org-openbmc-settings-host%i.service +After=mapper-wait@-org-openbmc-settings-host%i.service +Wants=mapper-wait@-xyz-openbmc_project-state-host%i.service +After=mapper-wait@-xyz-openbmc_project-state-host%i.service +Wants=mapper-wait@-xyz-openbmc_project-state-chassis%i.service +After=mapper-wait@-xyz-openbmc_project-state-chassis%i.service + +[Service] +Restart=no +Type=oneshot +ExecStart={sbindir}/phosphor-discover-system-state --host %i + +[Install] +WantedBy={SYSTEMD_DEFAULT_TARGET} 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 5258486b9..ce0fa1ee8 100644 --- a/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb +++ b/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb @@ -20,9 +20,7 @@ RDEPENDS_${PN}-staticdev = "${STATE_MGR_PACKAGES}" DBUS_PACKAGES = "${STATE_MGR_PACKAGES}" -# Set SYSTEMD_PACKAGES to empty because we do not want ${PN} and DBUS_PACKAGES -# handles the rest. -SYSTEMD_PACKAGES = "" +SYSTEMD_PACKAGES = "${PN}-discover" inherit autotools pkgconfig inherit obmc-phosphor-dbus-service @@ -48,6 +46,12 @@ FILES_${PN}-bmc = "${sbindir}/phosphor-bmc-state-manager" DBUS_SERVICE_${PN}-bmc += "xyz.openbmc_project.State.BMC.service" FILES_${PN}-discover = "${sbindir}/phosphor-discover-system-state" +SYSTEMD_SERVICE_${PN}-discover += "phosphor-discover-system-state@.service" + +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" diff --git a/meta-phosphor/common/recipes-phosphor/system/obmc-mgr-state.bb b/meta-phosphor/common/recipes-phosphor/system/obmc-mgr-state.bb deleted file mode 100644 index 464cf110a..000000000 --- a/meta-phosphor/common/recipes-phosphor/system/obmc-mgr-state.bb +++ /dev/null @@ -1,28 +0,0 @@ -SUMMARY = "OpenBMC state manager" -DESCRIPTION = "OpenBMC state manager." -PR = "r1" - -inherit skeleton-python -inherit obmc-phosphor-systemd - -VIRTUAL-RUNTIME_skeleton_workbook ?= "" - -RDEPENDS_${PN} += "\ - python-dbus \ - python-json \ - python-subprocess \ - python-pygobject \ - " - -SKELETON_DIR = "pystatemgr" -SYSTEMD_SERVICE_${PN} += "obmc-mgr-state.service obmc-mgr-state.target" - -TMPL = "mapper-wait@.service" -TGT = "obmc-mgr-state.target" -HOST_FMT = "../${TMPL}:${TGT}.wants/mapper-wait@-org-openbmc-settings-host{0}.service" -CHASSIS_FMT = "../${TMPL}:${TGT}.wants/mapper-wait@-org-openbmc-control-chassis{0}.service" -POWER_FMT = "../${TMPL}:${TGT}.wants/mapper-wait@-org-openbmc-control-power{0}.service" - -SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_FMT', 'OBMC_HOST_INSTANCES')}" -SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'CHASSIS_FMT', 'OBMC_CHASSIS_INSTANCES')}" -SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'POWER_FMT', 'OBMC_POWER_INSTANCES')}" diff --git a/meta-phosphor/common/recipes-phosphor/system/obmc-mgr-state/obmc-mgr-state.service b/meta-phosphor/common/recipes-phosphor/system/obmc-mgr-state/obmc-mgr-state.service deleted file mode 100644 index 681abb4b3..000000000 --- a/meta-phosphor/common/recipes-phosphor/system/obmc-mgr-state/obmc-mgr-state.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Restore Last State -Wants=obmc-mgr-state.target -After=obmc-mgr-state.target -Wants=mapper-wait@-org-openbmc-settings-host0.service -After=mapper-wait@-org-openbmc-settings-host0.service - -[Service] -Restart=no -Type=oneshot -ExecStart={sbindir}/discover_system_state.py -Environment="PYTHONUNBUFFERED=1" - -[Install] -WantedBy={SYSTEMD_DEFAULT_TARGET} diff --git a/meta-phosphor/common/recipes-phosphor/system/obmc-mgr-state/obmc-mgr-state.target b/meta-phosphor/common/recipes-phosphor/system/obmc-mgr-state/obmc-mgr-state.target deleted file mode 100644 index fef2a1ff0..000000000 --- a/meta-phosphor/common/recipes-phosphor/system/obmc-mgr-state/obmc-mgr-state.target +++ /dev/null @@ -1,2 +0,0 @@ -[Unit] -Description=Restore Last State diff --git a/meta-phosphor/conf/distro/include/phosphor-defaults.inc b/meta-phosphor/conf/distro/include/phosphor-defaults.inc index 296d30447..75d51db62 100644 --- a/meta-phosphor/conf/distro/include/phosphor-defaults.inc +++ b/meta-phosphor/conf/distro/include/phosphor-defaults.inc @@ -32,6 +32,13 @@ VIRTUAL-RUNTIME_obmc-chassis-state-manager ?= "phosphor-state-manager-chassis" # interface. VIRTUAL-RUNTIME_obmc-host-state-manager ?= "phosphor-state-manager-host" +# obmc-discover-system-state +# +# Provides an implementation of phosphor-discover-system-state, which, if the +# host is powered off, will check the current power policy and, if necessary, +# power the host back on. +VIRTUAL-RUNTIME_obmc-discover-system-state ?= "phosphor-state-manager-discover" + # obmc-fan-presence # # Provides implementations of fan presence detection -- cgit v1.2.1