-
Notifications
You must be signed in to change notification settings - Fork 1.9k
vdev_to_nvlist_iter: ignore draid parameters when matching names #17228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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 <[email protected]>
I think to be unique, it would be Providing an example of the updated output would be helpful |
@allanjude As I see, the index is split just before that. |
Sorry, I wasn't clear. This is just for matching; nothing changes display. The reason for the errors in |
The PR works for me. @allanjude here's what the output looks like: $ zpool get name tank4 all-vdevs
NAME PROPERTY VALUE SOURCE
root-0 name tank4 -
draid2:8d:10c:0s-0 name draid-0 -
/tmp/file1 name /tmp/file1 -
/tmp/file10 name /tmp/file10 -
/tmp/file2 name /tmp/file2 -
/tmp/file3 name /tmp/file3 -
/tmp/file4 name /tmp/file4 -
/tmp/file5 name /tmp/file5 -
/tmp/file6 name /tmp/file6 -
/tmp/file7 name /tmp/file7 -
/tmp/file8 name /tmp/file8 -
/tmp/file9 name /tmp/file9 - |
…nzfs#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 <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Tony Hutter <[email protected]>
…nzfs#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 <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Tony Hutter <[email protected]> (cherry picked from commit 131df3b)
) 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 <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Tony Hutter <[email protected]> (cherry picked from commit 131df3b)
[Sponsors: Klara, Inc., Wasabi Technology, Inc.]
Motivation and Context
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.
Description
This commit updates
vdev_to_nvlist_iter()
so that when matching vdev types it will truncate vdev types starting withdraid
at the first ':', egdraid2:8d:10c:0s
becomes simplydraid2
.How Has This Been Tested?
New test is included, that exercises
zpool get name <pool> all-vdevs
to make sure it produces a row for each vdev with a plausible value. That's not a test of the matcher exactly, but is the place I found a bug, and it seems useful to at least make sure thatall-vdevs
produces something for every vdev.Types of changes
Checklist:
Signed-off-by
.