summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-06-27 19:54:53 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-07-09 23:53:50 +0300
commit8d908475252c2788b3610b2761c55c4671495bea (patch)
tree2df6b1798c21c6be01efaf26a18977507d7e7ee8
parentfec5d6d2ef4c955aa754688df60641ddde715890 (diff)
downloadopenbmc-8d908475252c2788b3610b2761c55c4671495bea.tar.xz
phosphor-mapper: oneshots should restart on failure
This makes the oneshot services that wait on the mapper or manipulate mapper state more resilient to guarantee that they succeeded even if they encounter an unexpected and unhandled error. Tested: On zaius prior to applying some mapper fixes to make sure that these services do restart when they hit ENOBUFS. The system eventually proceeds as normal. Change-Id: Iea74004d6347db59c32f9f1602b5053c8252ca90 Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r--meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-subtree-remove@.service17
-rw-r--r--meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-wait@.service17
2 files changed, 28 insertions, 6 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-subtree-remove@.service b/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-subtree-remove@.service
index 8781073d88..4bd411e75f 100644
--- a/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-subtree-remove@.service
+++ b/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-subtree-remove@.service
@@ -4,8 +4,19 @@ Wants=obmc-mapper.target
After=obmc-mapper.target
[Service]
-Type=oneshot
+# We are using a Type=simple service instead of the normal Type=oneshot
+# since Type=oneshot can't have Restart= lines
+# https://github.com/systemd/systemd/issues/2582
+# Unfortunately Type=oneshot services halt any services which order after
+# the oneshot on the completion of ExecStart= lines. For Type=simple, the
+# halting is only until ExecStartPre lines have completed and ExecStart has
+# begun executing. Since we want to wait for the `mapper wait` process to
+# finish, it must be an ExecStartPre. All Type=simple services require an
+# ExecStart so we use `true` as a placeholder to satisfy the requirement.
+Type=simple
RemainAfterExit=no
-Restart=no
-ExecStart=/usr/bin/env mapper subtree-remove %I
+Restart=on-failure
+TimeoutStartSec=infinity
+ExecStartPre=/usr/bin/env mapper subtree-remove %I
+ExecStart=/usr/bin/env true
SyslogIdentifier=mapper
diff --git a/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-wait@.service b/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-wait@.service
index 14a657ab29..f7744e2d8b 100644
--- a/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-wait@.service
+++ b/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-wait@.service
@@ -4,8 +4,19 @@ Wants=obmc-mapper.target
After=obmc-mapper.target
[Service]
-Type=oneshot
+# We are using a Type=simple service instead of the normal Type=oneshot
+# since Type=oneshot can't have Restart= lines
+# https://github.com/systemd/systemd/issues/2582
+# Unfortunately Type=oneshot services halt any services which order after
+# the oneshot on the completion of ExecStart= lines. For Type=simple, the
+# halting is only until ExecStartPre lines have completed and ExecStart has
+# begun executing. Since we want to wait for the `mapper wait` process to
+# finish, it must be an ExecStartPre. All Type=simple services require an
+# ExecStart so we use `true` as a placeholder to satisfy the requirement.
+Type=simple
RemainAfterExit=yes
-Restart=no
-ExecStart=/usr/bin/env mapper wait %I
+Restart=on-failure
+TimeoutStartSec=infinity
+ExecStartPre=/usr/bin/env mapper wait %I
+ExecStart=/usr/bin/env true
SyslogIdentifier=mapper