OpenPOWER: Clear system and resource dump entries while powering off

The dumps like system and resource dumps are stored in host memory
and that will be lost during a power off, so the entries in BMC
dump-manager for those dumps will be stale after a power off.
This commit adds a service to call deleteAll to clear the entries
for system and resource dumps during system power off.

Tests:
   1 - Created a resource dump and system dump
       and activated the service
       Result: Both dump entries are cleared

   2 - Created a resource dump and system dump
       powered off the system
       Result: Both dump entries are cleared

Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Change-Id: I4e6a59ae852c86f5edbab767fb6a0ff2a4635289
diff --git a/dump-extensions/openpower-dumps/clear_hostdumps_poweroff.service b/dump-extensions/openpower-dumps/clear_hostdumps_poweroff.service
new file mode 100644
index 0000000..3673c84
--- /dev/null
+++ b/dump-extensions/openpower-dumps/clear_hostdumps_poweroff.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Remove entries of dumps stored in the host memory during poweroff
+Wants=obmc-host-stop-pre@0.target
+After=obmc-host-stop-pre@0.target
+Wants=obmc-host-stopping@0.target
+Before=obmc-host-stopping@0.target
+Conflicts=obmc-host-startmin@0.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/busctl call xyz.openbmc_project.Dump.Manager /xyz/openbmc_project/dump/resource xyz.openbmc_project.Collection.DeleteAll  DeleteAll
+ExecStart=/usr/bin/busctl call xyz.openbmc_project.Dump.Manager /xyz/openbmc_project/dump/system xyz.openbmc_project.Collection.DeleteAll  DeleteAll
+RemainAfterExit=yes
+
+[Install]
+WantedBy=obmc-host-stop@0.target