Keep fan services running until poweroff completes

All the fan services associated with controlling, monitoring and
presence detection of fans need to remain active until a poweroff
completes. This helps ensure thermal safety while a system is in
transition to a powered off state.

With the introduction of this new target (which runs last in
the power off path), need to move the host reset service to
running after it to ensure the power on in the reboot path
does not start until the last power off target runs.

Resolves openbmc/openbmc#2762

Change-Id: I4ca671d2c7de66e8bfa4bba607b06c88c0a6e7f9
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/common/recipes-phosphor/chassis/obmc-op-control-power/op-powered-off@.service b/common/recipes-phosphor/chassis/obmc-op-control-power/op-powered-off@.service
new file mode 100644
index 0000000..b76db7b
--- /dev/null
+++ b/common/recipes-phosphor/chassis/obmc-op-control-power/op-powered-off@.service
@@ -0,0 +1,20 @@
+[Unit]
+Description=Power is off to chassis%i
+After=op-wait-power-off@%i.service
+Requires=op-wait-power-off@%i.service
+
+[Service]
+RemainAfterExit=no
+# systemd starts all wanted targets in parallel and a Conflict
+# statement will resolve itself when the target starts, not when
+# completes. Some services have a requirement to stop
+# once power is off. The solution is to create a new target,
+# obmc-chassis-powered-off@.target, that is started after it is
+# verified that power has been removed from the chassis. Then
+# services may conflict with this target to ensure they
+# are stopped at the appropriate time.
+ExecStart=/bin/systemctl start obmc-chassis-powered-off@%i.target
+
+
+[Install]
+WantedBy=obmc-chassis-poweroff@%i.target