diff --git a/src/PVE/API2/Disks/ZFS.pm b/src/PVE/API2/Disks/ZFS.pm index 7dae404..b26805a 100644 --- a/src/PVE/API2/Disks/ZFS.pm +++ b/src/PVE/API2/Disks/ZFS.pm @@ -217,7 +217,7 @@ __PACKAGE__->register_method({ die "zfsutils-linux not installed\n"; } - my $cmd = [$ZPOOL, 'status', '-P', $param->{name}]; + my $cmd = [$ZPOOL, 'status', '-P', '-p', $param->{name}]; my $pool = { lvl => 0, diff --git a/src/test/zfs_pool_detail_test.pm b/src/test/zfs_pool_detail_test.pm index a062656..00d666a 100644 --- a/src/test/zfs_pool_detail_test.pm +++ b/src/test/zfs_pool_detail_test.pm @@ -18,7 +18,7 @@ $zfs_api_module->mock( my $cmdline = join(' ', @$cmd); die "unexpected run_command call: '$cmdline'\n" - if $cmdline ne '/sbin/zpool status -P tank'; + if $cmdline ne '/sbin/zpool status -P -p tank'; $param{outfunc}->($_) for split(/\n/, $zpool_status_output); @@ -148,6 +148,83 @@ EOF ], }, }, + { + description => 'error counters above 1023', + status => <<"EOF", + pool: tank + state: ONLINE +status: One or more devices has experienced an unrecoverable error. An +\tattempt was made to correct the error. Applications are unaffected. +action: Determine if the device needs to be replaced, and clear the errors +\tusing 'zpool clear' or replace the device with 'zpool replace'. + see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-9P + scan: scrub repaired 1.38M in 00:41:15 with 0 errors on Sun Sep 13 01:05:15 2026 +config: + +\tNAME STATE READ WRITE CKSUM +\ttank ONLINE 0 0 0 +\t mirror-0 ONLINE 0 0 0 +\t /dev/disk/by-id/ata-DISK_A-part1 ONLINE 1130 0 0 +\t /dev/disk/by-id/ata-DISK_B-part1 ONLINE 0 0 15565 + +errors: No known data errors +EOF + expected => { + name => 'tank', + state => 'ONLINE', + status => 'One or more devices has experienced an unrecoverable error. An' + . ' attempt was made to correct the error. Applications are unaffected.', + action => 'Determine if the device needs to be replaced, and clear the errors' + . " using 'zpool clear' or replace the device with 'zpool replace'.", + see => 'https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-9P', + scan => + 'scrub repaired 1.38M in 00:41:15 with 0 errors on Sun Sep 13 01:05:15 2026', + errors => 'No known data errors', + leaf => 0, + children => [ + { + name => 'tank', + state => 'ONLINE', + read => 0, + write => 0, + cksum => 0, + msg => '', + leaf => 0, + children => [ + { + name => 'mirror-0', + state => 'ONLINE', + read => 0, + write => 0, + cksum => 0, + msg => '', + leaf => 0, + children => [ + { + name => '/dev/disk/by-id/ata-DISK_A-part1', + state => 'ONLINE', + read => 1130, + write => 0, + cksum => 0, + msg => '', + leaf => 1, + }, + { + name => '/dev/disk/by-id/ata-DISK_B-part1', + state => 'ONLINE', + read => 0, + write => 0, + cksum => 15565, + msg => '', + leaf => 1, + }, + ], + }, + ], + }, + ], + }, + }, ]; plan tests => scalar @$tests;