Inner-Heaven / libzetta-rs

Stable interface for programmatic administration of ZFS from Rust
BSD 2-Clause "Simplified" License
62 stars 15 forks source link

fix(parser): add removed as a valid value for state enum #264

Closed richardstephens closed 8 months ago

richardstephens commented 8 months ago

On a Dell R720 running Alpine 3.18 with a ZFS mirror with one disk pulled:

gallium-dev-r720:~# zpool status
  pool: gallium-data
 state: DEGRADED
status: One or more devices has been removed by the administrator.
    Sufficient replicas exist for the pool to continue functioning in a
    degraded state.
action: Online the device using zpool online' or replace the device with
    'zpool replace'.
config:

    NAME                                      STATE     READ WRITE CKSUM
    gallium-data                              DEGRADED     0     0     0
      mirror-0                                DEGRADED     0     0     0
        3efe7898-b7c2-4a99-a602-2121bb43c543  REMOVED      0     0     0
        f6fbbc4c-f302-456a-aa48-eea467609dc7  ONLINE       0     0     0

errors: No known data errors
gallium-dev-r720:~# 

What do you think might be a good approach to make this parsing more robust? As it stands currently, when ZFS returns something libzetta doesn't recognise, ZpoolOpen3::status_all(...) returns a sucesful result with the unparsable pool missing.

andoriyu commented 8 months ago

thanks!