mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
zpool: Dryrun fails to list some devices
`zpool create -n` fails to list cache and spare vdevs. `zpool add -n` fails to list spare devices. `zpool split -n` fails to list `special` and `dedup` labels. `zpool add -n` and `zpool split -n` shouldn't list hole devices. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Attila Fülöp <attila@fueloep.org> Closes #11122 Closes #11167
This commit is contained in:
committed by
Brian Behlendorf
parent
32a78e579d
commit
6539bf71fe
@@ -3388,7 +3388,7 @@ zpool_vdev_split(zpool_handle_t *zhp, char *newname, nvlist_t **newroot,
|
||||
nvlist_t *props, splitflags_t flags)
|
||||
{
|
||||
zfs_cmd_t zc = {"\0"};
|
||||
char msg[1024];
|
||||
char msg[1024], *bias;
|
||||
nvlist_t *tree, *config, **child, **newchild, *newconfig = NULL;
|
||||
nvlist_t **varray = NULL, *zc_props = NULL;
|
||||
uint_t c, children, newchildren, lastlog = 0, vcount, found = 0;
|
||||
@@ -3446,6 +3446,7 @@ zpool_vdev_split(zpool_handle_t *zhp, char *newname, nvlist_t **newroot,
|
||||
|
||||
for (c = 0; c < children; c++) {
|
||||
uint64_t is_log = B_FALSE, is_hole = B_FALSE;
|
||||
boolean_t is_special = B_FALSE, is_dedup = B_FALSE;
|
||||
char *type;
|
||||
nvlist_t **mchild, *vdev;
|
||||
uint_t mchildren;
|
||||
@@ -3492,6 +3493,13 @@ zpool_vdev_split(zpool_handle_t *zhp, char *newname, nvlist_t **newroot,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (nvlist_lookup_string(child[c],
|
||||
ZPOOL_CONFIG_ALLOCATION_BIAS, &bias) == 0) {
|
||||
if (strcmp(bias, VDEV_ALLOC_BIAS_SPECIAL) == 0)
|
||||
is_special = B_TRUE;
|
||||
else if (strcmp(bias, VDEV_ALLOC_BIAS_DEDUP) == 0)
|
||||
is_dedup = B_TRUE;
|
||||
}
|
||||
verify(nvlist_lookup_nvlist_array(child[c],
|
||||
ZPOOL_CONFIG_CHILDREN, &mchild, &mchildren) == 0);
|
||||
|
||||
@@ -3509,6 +3517,20 @@ zpool_vdev_split(zpool_handle_t *zhp, char *newname, nvlist_t **newroot,
|
||||
|
||||
if (nvlist_dup(vdev, &varray[vcount++], 0) != 0)
|
||||
goto out;
|
||||
|
||||
if (flags.dryrun != 0) {
|
||||
if (is_dedup == B_TRUE) {
|
||||
if (nvlist_add_string(varray[vcount - 1],
|
||||
ZPOOL_CONFIG_ALLOCATION_BIAS,
|
||||
VDEV_ALLOC_BIAS_DEDUP) != 0)
|
||||
goto out;
|
||||
} else if (is_special == B_TRUE) {
|
||||
if (nvlist_add_string(varray[vcount - 1],
|
||||
ZPOOL_CONFIG_ALLOCATION_BIAS,
|
||||
VDEV_ALLOC_BIAS_SPECIAL) != 0)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* did we find every disk the user specified? */
|
||||
|
||||
Reference in New Issue
Block a user