ZTS: get_persistent_disk_name can return truncated names

Instead of using only the 3rd element return the entire string after 
the split to handle device names with dashes.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Vaibhav Bhanawat <vaibhav.bhanawat@delphix.com>
Closes #15567
This commit is contained in:
VaibhavB 2023-11-29 23:04:29 +05:30 committed by GitHub
parent 1c38cdfe98
commit 7d68900af3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -289,7 +289,7 @@ function get_persistent_disk_name #device
if is_linux; then if is_linux; then
if is_real_device $device; then if is_real_device $device; then
udevadm info -q all -n $DEV_DSKDIR/$device \ udevadm info -q all -n $DEV_DSKDIR/$device \
| awk '/disk\/by-id/ {print $2; exit}' | cut -d/ -f3 | awk '/disk\/by-id/ {print $2; exit}' | cut -d/ -f3-
elif is_mpath_device $device; then elif is_mpath_device $device; then
udevadm info -q all -n $DEV_DSKDIR/$device \ udevadm info -q all -n $DEV_DSKDIR/$device \
| awk '/disk\/by-id\/dm-uuid/ {print $2; exit}' \ | awk '/disk\/by-id\/dm-uuid/ {print $2; exit}' \