Add enumerated vdev names to 'zpool iostat -v' and 'zpool list -v'

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
This commit is contained in:
Akash B 2022-02-04 03:59:29 +05:30 committed by Tony Hutter
parent 72a82f312f
commit 9221ff1888
3 changed files with 6 additions and 6 deletions

View File

@ -4825,7 +4825,7 @@ children:
continue; continue;
vname = zpool_vdev_name(g_zfs, zhp, newchild[c], vname = zpool_vdev_name(g_zfs, zhp, newchild[c],
cb->cb_name_flags); cb->cb_name_flags | VDEV_NAME_TYPE_ID);
ret += print_vdev_stats(zhp, vname, oldnv ? oldchild[c] : NULL, ret += print_vdev_stats(zhp, vname, oldnv ? oldchild[c] : NULL,
newchild[c], cb, depth + 2); newchild[c], cb, depth + 2);
free(vname); free(vname);
@ -4868,7 +4868,7 @@ children:
} }
vname = zpool_vdev_name(g_zfs, zhp, newchild[c], vname = zpool_vdev_name(g_zfs, zhp, newchild[c],
cb->cb_name_flags); cb->cb_name_flags | VDEV_NAME_TYPE_ID);
ret += print_vdev_stats(zhp, vname, oldnv ? ret += print_vdev_stats(zhp, vname, oldnv ?
oldchild[c] : NULL, newchild[c], cb, depth + 2); oldchild[c] : NULL, newchild[c], cb, depth + 2);
free(vname); free(vname);
@ -6182,7 +6182,7 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
continue; continue;
vname = zpool_vdev_name(g_zfs, zhp, child[c], 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); print_list_stats(zhp, vname, child[c], cb, depth + 2, B_FALSE);
free(vname); free(vname);
} }
@ -6216,7 +6216,7 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
printed = B_TRUE; printed = B_TRUE;
} }
vname = zpool_vdev_name(g_zfs, zhp, child[c], 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, print_list_stats(zhp, vname, child[c], cb, depth + 2,
B_FALSE); B_FALSE);
free(vname); free(vname);

View File

@ -2145,7 +2145,7 @@ function get_disklist # pool
disklist=$(zpool iostat -v $1 | nawk '(NR >4) {print $1}' | \ disklist=$(zpool iostat -v $1 | nawk '(NR >4) {print $1}' | \
grep -v "\-\-\-\-\-" | \ 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 echo $disklist
} }

View File

@ -243,7 +243,7 @@ function get_vdevs #pool cnt
typeset -i cnt=$2 typeset -i cnt=$2
typeset all_devs=$(zpool iostat -v $pool | awk '{print $1}'| \ 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$") egrep -v "/old$|^$pool$")
typeset -i i=0 typeset -i i=0
typeset vdevs typeset vdevs