mistifyio/go-zfs

setUint receives empty string for fragmentation in some cases

teselkin opened this issue · 2 comments

In some cases zpool reterns '-' in 'fragmentation' field

$ sudo zpool get -p name,health,dedupratio,fragmentation rpool
NAME   PROPERTY       VALUE   SOURCE
rpool  name           rpool   -
rpool  health         ONLINE  -
rpool  dedupratio     1.00x   -
rpool  fragmentation  -       -

parseLine doesn't check if there is trainling '%' in the string before removing it, and this leads to empty string passed to setUint.

This leads to broken output of docker info

$ docker info
Storage Driver: zfs
 Zpool: error while getting pool information strconv.ParseUint: parsing "": invalid syntax
 Zpool Health: not available
mmlb commented

Thanks teselkin, I'll be taking a look at this to figure out if/when this behavior changed.

mmlb commented

No longer an issue and there are now tests to make sure it doesn't come back to bite.