summaryrefslogtreecommitdiffstats
path: root/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager
diff options
context:
space:
mode:
authorMichael Tritz <mtritz@us.ibm.com>2017-09-21 00:41:15 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-10-03 20:26:20 +0000
commited6d7b07832f7a9e32a7dc2ac3afb7b35608c8d3 (patch)
tree08943e2190fe995c83ed7f21ece79adad03b5977 /meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager
parentb457009fdb07e9f08d65e48ddb7b181beca0a35c (diff)
downloadtalos-openbmc-ed6d7b07832f7a9e32a7dc2ac3afb7b35608c8d3.tar.gz
talos-openbmc-ed6d7b07832f7a9e32a7dc2ac3afb7b35608c8d3.zip
Service files to remove orphaned UBI volumes
This commit provides supplementary service files for openbmc/openbmc#2264, which adds a function to delete all versions to each of the BMC and host updaters. The service files introduced in this change will locate any "orphaned" BMC or host volumes - that is to say, volumes which do not correspond to a current version on the system. Change-Id: If324d24f66ba08fb0b76ca5873addb6bf2446f97 Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
Diffstat (limited to 'meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager')
-rw-r--r--meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios24
-rw-r--r--meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-cleanup.service8
2 files changed, 32 insertions, 0 deletions
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios
index 948c6ec05..6e4aa78cf 100644
--- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios
@@ -270,6 +270,27 @@ clear_ubi() {
fi
}
+ubi_cleanup() {
+ # When ubi_cleanup is run, it expects one or no active version.
+ activeVersion=$(busctl --list --no-pager tree \
+ org.open_power.Software.Host.Updater | \
+ grep /xyz/openbmc_project/software/ | tail -c 9)
+
+ if [[ -z "$activeVersion" ]]; then
+ vols=$(ubinfo -a | grep -e "pnor-ro-" -e "pnor-rw-" | cut -c 14-)
+ vols=(${vols})
+ else
+ vols=$(ubinfo -a | grep -e "pnor-ro-" -e "pnor-rw-" | \
+ grep -v "$activeVersion" | cut -c 14-)
+ vols=(${vols})
+ fi
+
+ for (( index=0; index<${#vols[@]}; index++ )); do
+ name=${vols[index]}
+ umount_ubi
+ done
+}
+
case "$1" in
ubiattach)
attach_ubi
@@ -297,6 +318,9 @@ case "$1" in
name="$2"
clear_ubi
;;
+ ubicleanup)
+ ubi_cleanup
+ ;;
*)
echo "Invalid argument"
exit 1
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-cleanup.service b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-cleanup.service
new file mode 100644
index 000000000..07642a0e0
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-cleanup.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Clean up UBI volumes unattached to a Host version
+
+[Service]
+Type=oneshot
+RemainAfterExit=no
+ExecStart=/usr/bin/env obmc-flash-bios ubicleanup
+SyslogIdentifier=obmc-flash-bios
OpenPOWER on IntegriCloud