spa_generate_rootconf: add support for old vdev labels

It seems that old ZFS versions (v15) completely omit "vdev_children"
property when there is a single child.

Reported by:	jase
Tested by:	jase
MFC after:	1 week
This commit is contained in:
Andriy Gapon 2013-01-26 10:34:17 +00:00
parent 494459b56b
commit ea84c62f93
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=245945

View File

@ -3792,9 +3792,8 @@ spa_generate_rootconf(const char *name)
/*
* Multi-vdev root pool configuration discovery is not supported yet.
*/
nchildren = 0;
VERIFY(nvlist_lookup_uint64(best_cfg, ZPOOL_CONFIG_VDEV_CHILDREN,
&nchildren) == 0);
nchildren = 1;
nvlist_lookup_uint64(best_cfg, ZPOOL_CONFIG_VDEV_CHILDREN, &nchildren);
holes = NULL;
nvlist_lookup_uint64_array(best_cfg, ZPOOL_CONFIG_HOLE_ARRAY,
&holes, &nholes);