From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 89AFC1FF0A8 for ; Sat, 03 Oct 2026 14:49:36 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 66EA1216BB; Sat, 03 Oct 2026 14:49:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dualfroz.com; s=dkim; t=1791031768; h=from:subject:date:message-id:to:mime-version: content-transfer-encoding:in-reply-to:references; bh=Wdk8jBQcdLVQl2F2JGgqzjaKkKct3kbj1/kMKtNdm/E=; b=MrieV+uQeEqzsD/XLrOY3anP8leMB/AzLU7J4MnzOGBaeKY/xtTwSxFrxZKsaL8J8P0DfP mYZl+UJBOt+ywYAQixaNwxhvG7ZbNeKjR/Egzht8s5IT3muV/SeblKkPu61YNX/lRTkAex 9Fk5n3v03J15PensRM6shYnAygu4/1EE6zD9YrbVtDAVtDr7Trgecgo6/eG/ahqbj6Dqjy VubZ9KMxxGMGAsoAKlSRjhLHtASC27nNAUrSlZalTznFRfQS6ORCbFptM2747fxBuaPuq0 9B5x2QjW1+iXYqwKe/Q0TwuByQNFjNjxmWZHOWiU0emWZNhkZNcVRDl2MNrEKA== From: Michal Fox To: pve-devel@lists.proxmox.com Subject: [PATCH storage 2/3] fix #6640, #6938: api: disks: zfs: return exact error counters Date: Sat, 3 Oct 2026 12:49:16 +0000 Message-ID: <20261003124917.7-3-me@dualfroz.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261003124917.7-1-me@dualfroz.com> References: <20261003124917.7-1-me@dualfroz.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.276 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: W3FI63OAK4U4OYMLLFTWTTR7QMMJEANY X-Message-ID-Hash: W3FI63OAK4U4OYMLLFTWTTR7QMMJEANY X-MailFrom: me@dualfroz.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Without '-p', 'zpool status' shortens the READ, WRITE and CKSUM counters of a vdev to a value with a unit suffix once they reach 1024, for example 1130 read errors are shown as '1.10K'. The parser just adds zero to those values, so the API returned 1.1 read errors in that case and logged a warning like: Argument "1.10K" isn't numeric in addition (+) Request exact values with '-p'. For the non-JSON output of 'zpool status' it only affects those counters, the sizes in the scan line stay human readable. Signed-off-by: Michal Fox --- src/PVE/API2/Disks/ZFS.pm | 2 +- src/test/zfs_pool_detail_test.pm | 79 +++++++++++++++++++++++++++++++- 2 files changed, 79 insertions(+), 2 deletions(-) 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; -- 2.43.0