From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/2] fix #2904: zpool status: parse vdevs with state but without statistics
Date: Thu, 30 Jul 2020 10:02:16 +0200 [thread overview]
Message-ID: <20200730080216.19894-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20200730080216.19894-1-d.csapak@proxmox.com>
some vdevs (e.g. spares) have a 'state' (e.g. AVAIL), but
not statistics like READ/WRITE/etc.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/tools/disks/zpool_status.rs | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/tools/disks/zpool_status.rs b/src/tools/disks/zpool_status.rs
index 8971d905..41b8a39c 100644
--- a/src/tools/disks/zpool_status.rs
+++ b/src/tools/disks/zpool_status.rs
@@ -67,6 +67,19 @@ fn parse_zpool_status_vdev(i: &str) -> IResult<&str, ZFSPoolVDevState> {
}
let (i, state) = preceded(multispace1, notspace1)(i)?;
+ if let Ok((n, _)) = preceded(multispace0, line_ending)(i) { // spares
+ let vdev = ZFSPoolVDevState {
+ name: vdev_name.to_string(),
+ lvl: indent_level,
+ state: Some(state.to_string()),
+ read: None,
+ write: None,
+ cksum: None,
+ msg: None,
+ };
+ return Ok((n, vdev));
+ }
+
let (i, read) = preceded(multispace1, parse_u64)(i)?;
let (i, write) = preceded(multispace1, parse_u64)(i)?;
let (i, cksum) = preceded(multispace1, parse_u64)(i)?;
--
2.20.1
next prev parent reply other threads:[~2020-07-30 8:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-30 8:02 [pbs-devel] [PATCH proxmox-backup 1/2] zfs status: add test with spares Dominik Csapak
2020-07-30 8:02 ` Dominik Csapak [this message]
2020-08-14 11:01 ` [pbs-devel] applied: [PATCH proxmox-backup 2/2] fix #2904: zpool status: parse vdevs with state but without statistics Fabian Grünbichler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200730080216.19894-2-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox