Project

General

Profile

Actions

Bug #14007

closed

zfstest: find_disks needs to be smarter

Added by Yuri Pankov 6 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
tests
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

Just had my rpool destroyed (overwritten) by zfs-tests using the -a (auto detect) option.

        NAME                     STATE     READ WRITE CKSUM
        rpool                    ONLINE       0     0     0
          c2t7A40F34B5A21C0F1d0  ONLINE       0     0     0

Here disk name contains A-F while find_disks only checks a-f, so this was treated as unused.

Following should help:

--- a/usr/src/test/zfs-tests/cmd/scripts/zfstest.ksh
+++ b/usr/src/test/zfs-tests/cmd/scripts/zfstest.ksh
@@ -41,7 +41,7 @@ function find_disks
        typeset all_disks=$(echo '' | sudo -k format | awk \
            '/c[0-9]/ {print $2}')
        typeset used_disks=$(zpool status | awk \
-           '/c[0-9]+(t[0-9a-f]+)?d[0-9]+/ {print $1}' | sed -E \
+           '/c[0-9]+(t[0-9a-fA-F]+)?d[0-9]+/ {print $1}' | sed -E \
            's/(s|p)[0-9]+//g')

        typeset disk used avail_disks

To test this, I ran zfs-tests suite on the system with disk names as shown above, and this time my rpool was not destroyed.

Actions

Also available in: Atom PDF