mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
vdev_to_nvlist_iter: ignore draid parameters when matching names (#17228)
Various tools will display draid vdev names with parameters embedded in them, but would not accept them as valid vdev names when looking them up, making it difficult to build pipelines involving draid vdevs. This commit makes it so that if a full draid name is offered for match, it gets truncated at the first ':' character. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Tony Hutter <hutter2@llnl.gov>
This commit is contained in:
@@ -2961,6 +2961,18 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare,
|
||||
idx = p + 1;
|
||||
*p = '\0';
|
||||
|
||||
/*
|
||||
* draid names are presented like: draid2:4d:6c:0s
|
||||
* We match them up to the first ':' so we can still
|
||||
* do the parity check below, but the other params
|
||||
* are ignored.
|
||||
*/
|
||||
if ((p = strchr(type, ':')) != NULL) {
|
||||
if (strncmp(type, VDEV_TYPE_DRAID,
|
||||
strlen(VDEV_TYPE_DRAID)) == 0)
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* If the types don't match then keep looking.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user