diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c index 07868a30d..9d7a9b74b 100644 --- a/cmd/zpool/zpool_vdev.c +++ b/cmd/zpool/zpool_vdev.c @@ -876,6 +876,18 @@ check_replication(nvlist_t *config, nvlist_t *newroot) (u_longlong_t)mirror->zprl_children); ret = -1; } + } else if (is_raidz_draid(current, new)) { + if (current->zprl_parity != new->zprl_parity) { + vdev_error(gettext( + "mismatched replication level: pool and " + "new vdev with different redundancy, %s " + "and %s vdevs, %llu vs. %llu\n"), + current->zprl_type, + new->zprl_type, + (u_longlong_t)current->zprl_parity, + (u_longlong_t)new->zprl_parity); + ret = -1; + } } else if (strcmp(current->zprl_type, new->zprl_type) != 0) { vdev_error(gettext( "mismatched replication level: pool uses %s " @@ -1581,13 +1593,12 @@ construct_spec(nvlist_t *props, int argc, char **argv) is_dedup = is_spare = B_FALSE; } - if (is_log || is_special || is_dedup) { + if (is_log) { if (strcmp(type, VDEV_TYPE_MIRROR) != 0) { (void) fprintf(stderr, gettext("invalid vdev " - "specification: unsupported '%s' " - "device: %s\n"), is_log ? "log" : - "special", type); + "specification: unsupported 'log' " + "device: %s\n"), type); goto spec_out; } nlogs++; diff --git a/tests/zfs-tests/tests/functional/alloc_class/alloc_class_002_neg.ksh b/tests/zfs-tests/tests/functional/alloc_class/alloc_class_002_neg.ksh index 7d6924b2c..79a431a13 100755 --- a/tests/zfs-tests/tests/functional/alloc_class/alloc_class_002_neg.ksh +++ b/tests/zfs-tests/tests/functional/alloc_class/alloc_class_002_neg.ksh @@ -41,9 +41,4 @@ log_mustnot zpool create $TESTPOOL $ZPOOL_DISKS special mirror \ log_mustnot display_status $TESTPOOL log_mustnot zpool destroy -f $TESTPOOL -log_mustnot zpool create $TESTPOOL raidz $ZPOOL_DISKS special raidz \ - $CLASS_DISK0 $CLASS_DISK1 $CLASS_DISK2 -log_mustnot display_status $TESTPOOL -log_mustnot zpool destroy -f $TESTPOOL - log_pass $claim diff --git a/tests/zfs-tests/tests/functional/alloc_class/alloc_class_003_pos.ksh b/tests/zfs-tests/tests/functional/alloc_class/alloc_class_003_pos.ksh index 42d5deda3..961dcd464 100755 --- a/tests/zfs-tests/tests/functional/alloc_class/alloc_class_003_pos.ksh +++ b/tests/zfs-tests/tests/functional/alloc_class/alloc_class_003_pos.ksh @@ -32,7 +32,7 @@ log_onexit cleanup log_must disk_setup -for type in "" "mirror" "raidz" +for type in "" "mirror" "raidz" "draid" do log_must zpool create $TESTPOOL $type $ZPOOL_DISKS @@ -47,6 +47,12 @@ do $CLASS_DISK0 $CLASS_DISK1 log_must zpool iostat -H $TESTPOOL $CLASS_DISK0 log_must zpool iostat -H $TESTPOOL $CLASS_DISK1 + elif [ "$type" = "draid" ]; then + log_must zpool add $TESTPOOL special raidz \ + $CLASS_DISK0 $CLASS_DISK1 $CLASS_DISK2 + log_must zpool iostat -H $TESTPOOL $CLASS_DISK0 + log_must zpool iostat -H $TESTPOOL $CLASS_DISK1 + log_must zpool iostat -H $TESTPOOL $CLASS_DISK2 else log_must zpool add $TESTPOOL special $CLASS_DISK0 log_must zpool iostat -H $TESTPOOL $CLASS_DISK0 diff --git a/tests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh b/tests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh index 684b6557e..39ddaad1b 100755 --- a/tests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh +++ b/tests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh @@ -37,7 +37,7 @@ typeset ac_value typeset stype="" typeset sdisks="" -for type in "" "mirror" "raidz" +for type in "" "mirror" "raidz" "draid" do if [ "$type" = "mirror" ]; then stype="mirror" @@ -45,6 +45,9 @@ do elif [ "$type" = "raidz" ]; then stype="mirror" sdisks="${CLASS_DISK0} ${CLASS_DISK1}" + elif [ "$type" = "draid" ]; then + stype="raidz" + sdisks="${CLASS_DISK0} ${CLASS_DISK1} ${CLASS_DISK2}" else stype="" sdisks="${CLASS_DISK0}" diff --git a/tests/zfs-tests/tests/functional/alloc_class/alloc_class_009_pos.ksh b/tests/zfs-tests/tests/functional/alloc_class/alloc_class_009_pos.ksh index 2223bb1c4..b7e93fc73 100755 --- a/tests/zfs-tests/tests/functional/alloc_class/alloc_class_009_pos.ksh +++ b/tests/zfs-tests/tests/functional/alloc_class/alloc_class_009_pos.ksh @@ -36,7 +36,7 @@ typeset stype="" typeset sdisks="" typeset props="" -for type in "" "mirror" "raidz" +for type in "" "mirror" "raidz" "draid" do if [ "$type" = "mirror" ]; then stype="mirror" @@ -45,6 +45,9 @@ do elif [ "$type" = "raidz" ]; then stype="mirror" sdisks="${CLASS_DISK0} ${CLASS_DISK1}" + elif [ "$type" = "draid" ]; then + stype="raidz" + sdisks="${CLASS_DISK0} ${CLASS_DISK1} ${CLASS_DISK2}" else stype="" sdisks="${CLASS_DISK0}"