move state manager service files into its repo
OpenBMC is moving towards individual repos hosting and maintaining their
own service files. This allows the corresponding maintainer more control
over their service file and removes the meta-* layer maintainer from
needing to be involved.
Once this is merged, its bump will need to be combined with a change in
the meta-phosphor layer that removes the service files.
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: Ib9ebfb16e131bc2743b3fc9fcfdfb7370f455f8f
diff --git a/service_files/meson.build b/service_files/meson.build
index 8d45b15..6284dab 100644
--- a/service_files/meson.build
+++ b/service_files/meson.build
@@ -1,5 +1,14 @@
unit_files = [
'phosphor-systemd-target-monitor.service',
+ 'phosphor-discover-system-state@.service',
+ 'phosphor-reboot-host@.service',
+ 'phosphor-reset-host-check@.service',
+ 'phosphor-reset-host-reboot-attempts@.service',
+ 'phosphor-reset-host-running@.service',
+ 'phosphor-reset-sensor-states@.service',
+ 'xyz.openbmc_project.State.BMC.service',
+ 'xyz.openbmc_project.State.Chassis.service',
+ 'xyz.openbmc_project.State.Host.service'
]
foreach u : unit_files
diff --git a/service_files/phosphor-discover-system-state@.service b/service_files/phosphor-discover-system-state@.service
new file mode 100644
index 0000000..21554c9
--- /dev/null
+++ b/service_files/phosphor-discover-system-state@.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=Reboot If Enabled
+Wants=mapper-wait@-xyz-openbmc_project-control-host0-power_restore_policy.service
+After=mapper-wait@-xyz-openbmc_project-control-host0-power_restore_policy.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
+After=op-reset-chassis-on@%i.service
+ConditionPathExists=!/run/openbmc/chassis@%i-on
+
+[Service]
+Restart=no
+Type=oneshot
+ExecStart=/usr/bin/phosphor-discover-system-state --host %i
+
+[Install]
+WantedBy=multi-user.target
diff --git a/service_files/phosphor-reboot-host@.service b/service_files/phosphor-reboot-host@.service
new file mode 100644
index 0000000..f32bf22
--- /dev/null
+++ b/service_files/phosphor-reboot-host@.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Reboot host%i
+Wants=obmc-host-stop@%i.target
+After=obmc-host-stop@%i.target
+
+[Service]
+#ExecStart=/bin/systemctl start obmc-host-start@%i.target
+# This service is starting another target that conflicts with the
+# target this service is running in. OpenBMC needs a refactor of
+# how it does its host reset path. Until then, this short term
+# solution does the job.
+# Since this is a part of the reboot target, call the startmin
+# target which does the minimum required to start the host.
+ExecStart=/bin/sh -c "sleep 5 && systemctl start obmc-host-startmin@%i.target"
+
+[Install]
+WantedBy=obmc-host-reboot@%i.target
diff --git a/service_files/phosphor-reset-host-check@.service b/service_files/phosphor-reset-host-check@.service
new file mode 100644
index 0000000..0d98974
--- /dev/null
+++ b/service_files/phosphor-reset-host-check@.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=Check Host%i status on BMC reset
+Wants=phosphor-ipmi-host.service
+After=phosphor-ipmi-host.service
+Wants=obmc-host-reset-running@%i.target
+Before=obmc-host-reset-running@%i.target
+Wants=op-reset-chassis-on@%i.service
+After=op-reset-chassis-on@%i.service
+Conflicts=obmc-host-stop@%i.target
+ConditionPathExists=/run/openbmc/chassis@%i-on
+
+[Service]
+RemainAfterExit=yes
+Type=oneshot
+ExecStart=/usr/bin/phosphor-host-check
+
+[Install]
+WantedBy=obmc-host-reset@%i.target
diff --git a/service_files/phosphor-reset-host-reboot-attempts@.service b/service_files/phosphor-reset-host-reboot-attempts@.service
new file mode 100644
index 0000000..35de430
--- /dev/null
+++ b/service_files/phosphor-reset-host-reboot-attempts@.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Reset host reboot counter
+Wants=mapper-wait@-xyz-openbmc_project-state-host%i.service
+After=mapper-wait@-xyz-openbmc_project-state-host%i.service
+ConditionPathExists=!/run/openbmc/host@%i-on
+
+[Service]
+Restart=no
+Type=oneshot
+ExecStart=/bin/sh -c "busctl set-property `mapper get-service /xyz/openbmc_project/state/host%i` /xyz/openbmc_project/state/host%i xyz.openbmc_project.Control.Boot.RebootAttempts AttemptsLeft u 3"
+
+[Install]
+WantedBy=obmc-host-start@%i.target
diff --git a/service_files/phosphor-reset-host-running@.service b/service_files/phosphor-reset-host-running@.service
new file mode 100644
index 0000000..a49bbdd
--- /dev/null
+++ b/service_files/phosphor-reset-host-running@.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Start host%i running after BMC reset
+After=obmc-host-reset-running@%i.target
+Requires=obmc-host-reset-running@%i.target
+ConditionPathExists=/run/openbmc/host@%i-on
+
+[Service]
+RemainAfterExit=no
+ExecStart=/bin/systemctl start obmc-host-start@%i.target
+
+
+[Install]
+WantedBy=obmc-host-reset@%i.target
diff --git a/service_files/phosphor-reset-sensor-states@.service b/service_files/phosphor-reset-sensor-states@.service
new file mode 100644
index 0000000..689372f
--- /dev/null
+++ b/service_files/phosphor-reset-sensor-states@.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Reset host sensors
+After=phosphor-reset-host-check@%i.service
+Wants=mapper-wait@-xyz-openbmc_project-state-host%i.service
+After=mapper-wait@-xyz-openbmc_project-state-host%i.service
+ConditionPathExists=!/run/openbmc/host@%i-on
+
+[Service]
+Restart=no
+Type=oneshot
+ExecStart=/bin/sh -c "busctl set-property `mapper get-service /xyz/openbmc_project/state/host0` /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.Boot.Progress BootProgress s xyz.openbmc_project.State.Boot.Progress.ProgressStages.Unspecified"
+ExecStart=/bin/sh -c "busctl set-property `mapper get-service /xyz/openbmc_project/state/host0` /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.OperatingSystem.Status OperatingSystemState s xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Inactive"
+
+[Install]
+WantedBy=obmc-host-reset@%i.target
diff --git a/service_files/xyz.openbmc_project.State.BMC.service b/service_files/xyz.openbmc_project.State.BMC.service
new file mode 100644
index 0000000..7c92690
--- /dev/null
+++ b/service_files/xyz.openbmc_project.State.BMC.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Phosphor BMC State Manager
+Before=mapper-wait@-xyz-openbmc_project-state-bmc.service
+Wants=obmc-mapper.target
+After=obmc-mapper.target
+
+
+[Service]
+ExecStart=/usr/bin/phosphor-bmc-state-manager
+Restart=always
+Type=dbus
+BusName=xyz.openbmc_project.State.BMC
+
+[Install]
+WantedBy=multi-user.target
diff --git a/service_files/xyz.openbmc_project.State.Chassis.service b/service_files/xyz.openbmc_project.State.Chassis.service
new file mode 100644
index 0000000..861203a
--- /dev/null
+++ b/service_files/xyz.openbmc_project.State.Chassis.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Phosphor Chassis State Manager
+Before=mapper-wait@-xyz-openbmc_project-state-chassis.service
+Wants=obmc-mapper.target
+After=obmc-mapper.target
+After=org.openbmc.control.Power@0.service
+
+[Service]
+ExecStart=/usr/bin/phosphor-chassis-state-manager
+Restart=always
+Type=dbus
+BusName=xyz.openbmc_project.State.Chassis
+
+[Install]
+WantedBy=multi-user.target
diff --git a/service_files/xyz.openbmc_project.State.Host.service b/service_files/xyz.openbmc_project.State.Host.service
new file mode 100644
index 0000000..123d339
--- /dev/null
+++ b/service_files/xyz.openbmc_project.State.Host.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Phosphor Host State Manager
+Wants=mapper-wait@-xyz-openbmc_project-control-host0-auto_reboot.service
+After=mapper-wait@-xyz-openbmc_project-control-host0-auto_reboot.service
+Before=mapper-wait@-xyz-openbmc_project-state-host.service
+After=phosphor-reset-host-running@0.service
+Wants=obmc-mapper.target
+After=obmc-mapper.target
+
+[Service]
+ExecStart=/usr/bin/phosphor-host-state-manager
+Restart=always
+Type=dbus
+BusName=xyz.openbmc_project.State.Host
+
+[Install]
+WantedBy=multi-user.target