Changeset View
Changeset View
Standalone View
Standalone View
sys/contrib/openzfs/lib/libzfs/libzfs_pool.c
Context not available. | |||||
return (B_FALSE); | return (B_FALSE); | ||||
} | } | ||||
/* | |||||
* Check if vdev list contains a dRAID vdev | |||||
*/ | |||||
static boolean_t | |||||
zpool_has_draid_vdev(nvlist_t *nvroot) | |||||
{ | |||||
nvlist_t **child; | |||||
uint_t children; | |||||
if (nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, | |||||
&child, &children) == 0) { | |||||
for (uint_t c = 0; c < children; c++) { | |||||
char *type; | |||||
if (nvlist_lookup_string(child[c], | |||||
ZPOOL_CONFIG_TYPE, &type) == 0 && | |||||
strcmp(type, VDEV_TYPE_DRAID) == 0) { | |||||
return (B_TRUE); | |||||
} | |||||
} | |||||
} | |||||
return (B_FALSE); | |||||
} | |||||
/* | /* | ||||
* Output a dRAID top-level vdev name in to the provided buffer. | * Output a dRAID top-level vdev name in to the provided buffer. | ||||
*/ | */ | ||||
Context not available. | |||||
"one or more devices is out of space")); | "one or more devices is out of space")); | ||||
return (zfs_error(hdl, EZFS_BADDEV, msg)); | return (zfs_error(hdl, EZFS_BADDEV, msg)); | ||||
case EINVAL: | |||||
if (zpool_has_draid_vdev(nvroot) && | |||||
zfeature_lookup_name("draid", NULL) != 0) { | |||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, | |||||
"dRAID vdevs are unsupported by the " | |||||
"kernel")); | |||||
return (zfs_error(hdl, EZFS_BADDEV, msg)); | |||||
} else { | |||||
return (zpool_standard_error(hdl, errno, msg)); | |||||
} | |||||
default: | default: | ||||
return (zpool_standard_error(hdl, errno, msg)); | return (zpool_standard_error(hdl, errno, msg)); | ||||
} | } | ||||
Context not available. | |||||
break; | break; | ||||
case EINVAL: | case EINVAL: | ||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, | |||||
"invalid config; a pool with removing/removed " | if (zpool_has_draid_vdev(nvroot) && | ||||
"vdevs does not support adding raidz vdevs")); | zfeature_lookup_name("draid", NULL) != 0) { | ||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, | |||||
"dRAID vdevs are unsupported by the " | |||||
"kernel")); | |||||
} else { | |||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, | |||||
"invalid config; a pool with removing/" | |||||
"removed vdevs does not support adding " | |||||
"raidz or dRAID vdevs")); | |||||
} | |||||
(void) zfs_error(hdl, EZFS_BADDEV, msg); | (void) zfs_error(hdl, EZFS_BADDEV, msg); | ||||
break; | break; | ||||
Context not available. |