From: Nicolas Frey <n.frey@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH proxmox 2/2] fix #7541: zfs status: account for msg directly after status in vdev parser
Date: Wed, 3 Jun 2026 17:58:22 +0200 [thread overview]
Message-ID: <20260603155822.370223-3-n.frey@proxmox.com> (raw)
In-Reply-To: <20260603155822.370223-1-n.frey@proxmox.com>
so spares that have the status `INUSE` parse correctly.
adds a line to the mock config in the `test_zpool_status_parser_spares`
test containing an example of a vdev that would be `INUSE`.
Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=7541
Signed-off-by: Nicolas Frey <n.frey@proxmox.com>
---
Notes:
Changes since version for PBS:
* simplify parsing logic by optionally parsing out the stats resulting
in a single return and msg parse. This way there is no "special case"
proxmox-disks/src/zpool_status.rs | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/proxmox-disks/src/zpool_status.rs b/proxmox-disks/src/zpool_status.rs
index 52776a76..cfb29f89 100644
--- a/proxmox-disks/src/zpool_status.rs
+++ b/proxmox-disks/src/zpool_status.rs
@@ -12,7 +12,7 @@ use nom::{
combinator::opt,
error::VerboseError,
multi::{many0, many1},
- sequence::preceded,
+ sequence::{preceded, tuple},
};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
@@ -66,21 +66,14 @@ fn parse_zpool_status_vdev(i: &str) -> IResult<&str, ZFSPoolVDevState> {
}
let (i, state) = preceded(space1, notspace1)(i)?;
- if let Ok((n, _)) = preceded(space0::<&str, VerboseError<&str>>, line_ending)(i) {
- // spares
- let vdev = ZFSPoolVDevState {
- name: vdev_name.to_string(),
- lvl: indent_level,
- state: Some(state.to_string()),
- stats: None,
- msg: None,
- };
- return Ok((n, vdev));
- }
+ let (i, stats) = opt(tuple((
+ preceded(space1, nom::character::complete::u64),
+ preceded(space1, nom::character::complete::u64),
+ preceded(space1, nom::character::complete::u64),
+ )))(i)?;
+
+ let stats = stats.map(|(read, write, cksum)| VDevStats { read, write, cksum });
- let (i, read) = preceded(space1, nom::character::complete::u64)(i)?;
- let (i, write) = preceded(space1, nom::character::complete::u64)(i)?;
- let (i, cksum) = preceded(space1, nom::character::complete::u64)(i)?;
let (i, msg) = opt(preceded(space1, take_while(|c| c != '\n')))(i)?;
let (i, _) = line_ending(i)?;
@@ -88,7 +81,7 @@ fn parse_zpool_status_vdev(i: &str) -> IResult<&str, ZFSPoolVDevState> {
name: vdev_name.to_string(),
lvl: indent_level,
state: Some(state.to_string()),
- stats: Some(VDevStats { read, write, cksum }),
+ stats,
msg: msg.map(String::from),
};
@@ -484,6 +477,7 @@ config:
spares
/dev/sdb AVAIL
/dev/sdc AVAIL
+ /dev/sdd INUSE currently in use
errors: No known data errors
"###;
--
2.47.3
next prev parent reply other threads:[~2026-06-03 15:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 15:58 [PATCH proxmox 0/2] fix #7541: zfs status: account for msg directly after status in vdev parser Nicolas Frey
2026-06-03 15:58 ` [PATCH proxmox 1/2] disks: zpool: add `VDevStats` struct instead of 3 optional u64s Nicolas Frey
2026-06-03 15:58 ` Nicolas Frey [this message]
2026-06-03 16:01 ` [PATCH proxmox 0/2] fix #7541: zfs status: account for msg directly after status in vdev parser Nicolas Frey
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=20260603155822.370223-3-n.frey@proxmox.com \
--to=n.frey@proxmox.com \
--cc=pve-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