diff options
author | HÃ¥kan Johansson <[email protected]> | 2017-06-05 22:53:09 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-06-05 13:53:09 -0700 |
commit | 6eb6073a044653016013b1a72de03a1257e899c5 (patch) | |
tree | 34a8691149db359fcd1fb12361d11bd2162bda00 /cmd/zpool | |
parent | 9f7b066bd901128f0a5e481e3c23ae9857b1263e (diff) |
Allow add of raidz and mirror with same redundancy
Allow new members to be added to a pool mixing raidz and mirror vdevs
without giving -f, as long as they have matching redundancy. This case
was missed in #5915, which only handled zpool create.
Add zfstest zpool_add_010_pos.ksh, with test of zpool create
followed by zpool add of mixed raidz and mirror vdevs.
Add some more mixed raidz and mirror cases to zpool_create_006_pos.ksh.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Haakan Johansson <[email protected]>
Issue #5915
Closes #6181
Diffstat (limited to 'cmd/zpool')
-rw-r--r-- | cmd/zpool/zpool_vdev.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c index 74ba4455b..b0b639684 100644 --- a/cmd/zpool/zpool_vdev.c +++ b/cmd/zpool/zpool_vdev.c @@ -1053,6 +1053,7 @@ check_replication(nvlist_t *config, nvlist_t *newroot) nvlist_t **child; uint_t children; replication_level_t *current = NULL, *new; + replication_level_t *raidz, *mirror; int ret; /* @@ -1100,7 +1101,21 @@ check_replication(nvlist_t *config, nvlist_t *newroot) */ ret = 0; if (current != NULL) { - if (strcmp(current->zprl_type, new->zprl_type) != 0) { + if (is_raidz_mirror(current, new, &raidz, &mirror) || + is_raidz_mirror(new, current, &raidz, &mirror)) { + if (raidz->zprl_parity != mirror->zprl_children - 1) { + vdev_error(gettext( + "mismatched replication level: pool and " + "new vdev with different redundancy, %s " + "and %s vdevs, %llu vs. %llu (%llu-way)\n"), + raidz->zprl_type, + mirror->zprl_type, + raidz->zprl_parity, + mirror->zprl_children - 1, + mirror->zprl_children); + ret = -1; + } + } else if (strcmp(current->zprl_type, new->zprl_type) != 0) { vdev_error(gettext( "mismatched replication level: pool uses %s " "and new vdev is %s\n"), |