]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Add enumerated vdev names to 'zpool iostat -v' and 'zpool list -v'
authorAkash B <akash-b@hpe.com>
Thu, 3 Feb 2022 22:29:29 +0000 (03:59 +0530)
committerGitHub <noreply@github.com>
Thu, 3 Feb 2022 22:29:29 +0000 (14:29 -0800)
This commit adds enumerated names to disambiguate between the
different vdevs. Previously only 'zpool status' showed enumerated
vdev names, now 'zpool list -v' and 'zpool iostat -v' also shows
the enumerated vdev names.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Dipak Ghosh <dipak.ghosh@hpe.com>
Signed-off-by: Akash B <akash-b@hpe.com>
Closes #12510
Closes #13031

cmd/zpool/zpool_main.c
tests/zfs-tests/include/libtest.shlib
tests/zfs-tests/tests/functional/redundancy/redundancy.kshlib

index 2c608ee4db951fbcbfb10f1e53f65cfee57303cc..5d8d18255f515c00f28787e8de2018ce29fb676f 100644 (file)
@@ -4846,7 +4846,7 @@ children:
                        continue;
 
                vname = zpool_vdev_name(g_zfs, zhp, newchild[c],
-                   cb->cb_vdevs.cb_name_flags);
+                   cb->cb_vdevs.cb_name_flags | VDEV_NAME_TYPE_ID);
                ret += print_vdev_stats(zhp, vname, oldnv ? oldchild[c] : NULL,
                    newchild[c], cb, depth + 2);
                free(vname);
@@ -4890,7 +4890,7 @@ children:
                        }
 
                        vname = zpool_vdev_name(g_zfs, zhp, newchild[c],
-                           cb->cb_vdevs.cb_name_flags);
+                           cb->cb_vdevs.cb_name_flags | VDEV_NAME_TYPE_ID);
                        ret += print_vdev_stats(zhp, vname, oldnv ?
                            oldchild[c] : NULL, newchild[c], cb, depth + 2);
                        free(vname);
@@ -6212,7 +6212,7 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
                        continue;
 
                vname = zpool_vdev_name(g_zfs, zhp, child[c],
-                   cb->cb_name_flags);
+                   cb->cb_name_flags | VDEV_NAME_TYPE_ID);
                print_list_stats(zhp, vname, child[c], cb, depth + 2, B_FALSE);
                free(vname);
        }
@@ -6246,7 +6246,7 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
                                printed = B_TRUE;
                        }
                        vname = zpool_vdev_name(g_zfs, zhp, child[c],
-                           cb->cb_name_flags);
+                           cb->cb_name_flags | VDEV_NAME_TYPE_ID);
                        print_list_stats(zhp, vname, child[c], cb, depth + 2,
                            B_FALSE);
                        free(vname);
index 24010d9f3732f0ca92e2dd2456f435caba797fac..b229a161518be2f163b285dc8ba03176b3c77e5f 100644 (file)
@@ -2141,7 +2141,7 @@ function get_disklist # pool
 
        disklist=$(zpool iostat -v $1 | nawk '(NR >4) {print $1}' | \
            grep -v "\-\-\-\-\-" | \
-           egrep -v -e "^(mirror|raidz[1-3]|spare|log|cache|special|dedup)$")
+           egrep -v -e "^(mirror|raidz[1-3]|draid[1-3]|spare|log|cache|special|dedup)|\-[0-9]$")
 
        echo $disklist
 }
index baee8269b1e15a21bbf229c5972db352c012192a..9888034667a7a5ac5ff2d0b1692611e134736338 100644 (file)
@@ -243,7 +243,7 @@ function get_vdevs #pool cnt
        typeset -i cnt=$2
 
        typeset all_devs=$(zpool iostat -v $pool | awk '{print $1}'| \
-               egrep -v "^pool$|^capacity$|^mirror$|^raidz1$|^raidz2$|^raidz3$|^draid1.*|^draid2.*|^draid3.*|---" | \
+               egrep -v "^pool$|^capacity$|^mirror\-[0-9]$|^raidz[1-3]\-[0-9]$|^draid[1-3].*\-[0-9]$|---" | \
                egrep -v "/old$|^$pool$")
        typeset -i i=0
        typeset vdevs