PNOR: Add logic to handle the case where ubi volume creation failure

- Combine the service files that creates the UBI volumes
- Add "OnFailure" to service files that creates UBI volumes
  in order to clean up any ubi voumes or mount points that
  were created during the activation.
- Part of the change required for openbmc/openbmc#1616.

Change-Id: Ibe316c810e797b256c141c5ea6583970da5e57b8
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
diff --git a/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-squashfsmount@.service b/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-squashfsmount@.service
deleted file mode 100644
index 96c1eb6..0000000
--- a/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-squashfsmount@.service
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Mount SquashFS image pnor-ro-%I
-Requires=obmc-flash-bios-ubiattach.service
-After=obmc-flash-bios-ubiattach.service
-
-[Service]
-Type=oneshot
-RemainAfterExit=no
-ExecStart=/usr/bin/env obmc-flash-bios squashfsmount pnor-ro-%i %i
-SyslogIdentifier=obmc-flash-bios
diff --git a/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubimount@.service b/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubimount@.service
index b4bd2d7..d03041d 100644
--- a/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubimount@.service
+++ b/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubimount@.service
@@ -1,11 +1,13 @@
 [Unit]
-Description=Mount UBIFS volume pnor-prsv and pnor-rw-%I
+Description=Mount UBIFS volumes pnor-ro-%I, pnor-rw-%I and pnor-prsv
 Requires=obmc-flash-bios-ubiattach.service
 After=obmc-flash-bios-ubiattach.service
+OnFailure=obmc-flash-bios-ubiumount-ro@%i.service obmc-flash-bios-ubiumount-rw@%i.service
 
 [Service]
 Type=oneshot
 RemainAfterExit=no
+ExecStart=/usr/bin/env obmc-flash-bios squashfsmount pnor-ro-%i %i
 ExecStart=/usr/bin/env obmc-flash-bios ubimount pnor-rw-%i
 ExecStart=/usr/bin/env obmc-flash-bios ubimount pnor-prsv
 SyslogIdentifier=obmc-flash-bios