template_zfs_on_linux, zfs.vdev.discovery not filtering "indirect" disks
leaskovski opened this issue · comments
With ZFS, if you remove a disk from a pool, and then add it back again, ZFS will create an "indirect" entries that then show up on discovery. See https://serverfault.com/questions/1102923/what-are-indirect-x-after-zpool-remove for more info on indirect entries.
The code in the conf file for the vdev discovery is currently...
# vdev discovery
UserParameter=zfs.vdev.discovery,/sbin/zpool list -Hv | grep '^[[:blank:]]' | egrep -v 'mirror|raidz' | awk '{print $1}' | sed -e '$ ! s/\(.*\)/{"{#VDEV}":"\1"},/' | sed -e '$ s/\(.*\)/{"{#VDEV}":"\1"}]}/' | sed -e '1 s/\(.*\)/{ \"data\":[\1/'
It should be...
# vdev discovery
UserParameter=zfs.vdev.discovery,/sbin/zpool list -Hv | grep '^[[:blank:]]' | egrep -v 'mirror|raidz|indirect' | awk '{print $1}' | sed -e '$ ! s/\(.*\)/{"{#VDEV}":"\1"},/' | sed -e '$ s/\(.*\)/{"{#VDEV}":"\1"}]}/' | sed -e '1 s/\(.*\)/{ \"data\":[\1/'