Add mpath support to validate_platform_backup

The command 'system health-query-upgrade' returns the value [Fail]
for the field 'Valid platform-backup partition',
that happens because the lsblk command is not able to return
a device path when multipath disks are used or when the root
partition is under cgts--vg.

To fix this, backup commands were added in case lsblk fails to
return a valid path.

Test Plan:
PASS: Upgrade AIO-SX (with and without multipath):
      Valid platform-backup partition: [Ok]
      on "system health-query-update"
PASS: Upgrade AIO-DX (with and without multipath):
      Valid platform-backup partition: [Ok]
      on "system health-query-update"
PASS: Upgrade Standard (with and without multipath):
      Valid platform-backup partition: [Ok]
      on "system health-query-update"

Story: 2010608
Task: 47648

Signed-off-by: Matheus Guilhermino <matheus.machadoguilhermino@windriver.com>
Change-Id: I2655dd4cfe1c91a8bcd2d7d8e10ddb662a58d6ce
This commit is contained in:
Matheus Guilhermino 2023-02-24 08:52:04 -03:00 committed by Matheus Machado Guilhermino
parent 6e832b4707
commit f3094cad8f
1 changed files with 15 additions and 3 deletions

View File

@ -1,13 +1,25 @@
#!/bin/bash
#
# Copyright (c) 2020 Wind River Systems, Inc.
# Copyright (c) 2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
NAME=$(basename $0)
rootfs_part=$(findmnt -n -o SOURCE /)
device_path=$(lsblk -pno pkname $rootfs_part)
rootfs_part=$(findmnt -n -o SOURCE / | sed 's/\[[^]]*\]//g')
device_path=$(lsblk -pno pkname ${rootfs_part})
if [ -z $device_path ] ; then
base_device=$(dmsetup deps -o devname ${rootfs_part%} | grep -wo "(.*.)")
device_path=$(find /dev -name "${base_device:1:-1}")
check_parent_path_1=$(lsblk -pno pkname ${device_path} | head -n 1)
if [ ! -z $check_parent_path_1 ] ; then
device_path=${check_parent_path_1}
fi
check_parent_path_2=$(dmsetup deps -o devname ${device_path} | grep -wo "(.*.)")
if [ ! -z $check_parent_path_2 ] ; then
device_path=$(find /dev -name "${check_parent_path_2:1:-1}")
fi
fi
BACKUP_PART_GUID="BA5EBA11-0000-1111-2222-000000000002"
PLATFORM_BACKUP_SIZE=10000