* [PATCH proxmox 0/2] fix #7541: zfs status: account for msg directly after status in vdev parser
@ 2026-06-03 15:58 Nicolas Frey
2026-06-03 15:58 ` [PATCH proxmox 1/2] disks: zpool: add `VDevStats` struct instead of 3 optional u64s Nicolas Frey
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Nicolas Frey @ 2026-06-03 15:58 UTC (permalink / raw)
To: pve-devel
As reported in Enterprise Support, when a spare is "INUSE", it has a
`msg` right after the STATUS, which the parser previously did not
account for.
This patch-series was previously for PBS, but as proxmox-disks is
factoring that code out, it makes sense to make the change here.
I reckon as PBS will at some point use proxmox-disks, it's fine to
only fix this parser issue here; though please let me know if this
fix should also be seperately done again for PBS.
It also doesn't quite 'fix' the bug mentioned in the second patch, as
PBS doesn't use proxmox-disks yet.
Changes since PBS version:
* 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:
Nicolas Frey (2):
disks: zpool: add `VDevStats` struct instead of 3 optional u64s
fix #7541: zfs status: account for msg directly after status in vdev
parser
proxmox-disks/src/zpool_status.rs | 53 ++++++++++++-------------------
1 file changed, 21 insertions(+), 32 deletions(-)
Summary over all repositories:
1 files changed, 21 insertions(+), 32 deletions(-)
--
Generated by murpp 0.12.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH proxmox 1/2] disks: zpool: add `VDevStats` struct instead of 3 optional u64s
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 ` Nicolas Frey
2026-06-03 15:58 ` [PATCH proxmox 2/2] fix #7541: zfs status: account for msg directly after status in vdev parser Nicolas Frey
2026-06-03 16:01 ` [PATCH proxmox 0/2] " Nicolas Frey
2 siblings, 0 replies; 4+ messages in thread
From: Nicolas Frey @ 2026-06-03 15:58 UTC (permalink / raw)
To: pve-devel
in order to reduce a bit of boilerplate. Keeps deserialization the
same by flattening `stats`. No functional change intended
Signed-off-by: Nicolas Frey <n.frey@proxmox.com>
---
Notes:
was discussed in v2 of a series that specifically targeted PBS,
as @Thomas mentioned this does not yet have any users and cleans up
the code a bit, so I thought it would be worth keeping
proxmox-disks/src/zpool_status.rs | 31 +++++++++++++------------------
1 file changed, 13 insertions(+), 18 deletions(-)
diff --git a/proxmox-disks/src/zpool_status.rs b/proxmox-disks/src/zpool_status.rs
index 92aca2c9..52776a76 100644
--- a/proxmox-disks/src/zpool_status.rs
+++ b/proxmox-disks/src/zpool_status.rs
@@ -22,16 +22,19 @@ pub struct ZFSPoolVDevState {
pub lvl: u64,
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub read: Option<u64>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub write: Option<u64>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub cksum: Option<u64>,
+ #[serde(flatten)]
+ pub stats: Option<VDevStats>,
#[serde(skip_serializing_if = "Option::is_none")]
pub msg: Option<String>,
}
+#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
+pub struct VDevStats {
+ read: u64,
+ write: u64,
+ cksum: u64,
+}
+
fn expand_tab_length(input: &str) -> usize {
input.chars().map(|c| if c == '\t' { 8 } else { 1 }).sum()
}
@@ -56,9 +59,7 @@ fn parse_zpool_status_vdev(i: &str) -> IResult<&str, ZFSPoolVDevState> {
name: vdev_name.to_string(),
lvl: indent_level,
state: None,
- read: None,
- write: None,
- cksum: None,
+ stats: None,
msg: None,
};
return Ok((n, vdev));
@@ -71,9 +72,7 @@ fn parse_zpool_status_vdev(i: &str) -> IResult<&str, ZFSPoolVDevState> {
name: vdev_name.to_string(),
lvl: indent_level,
state: Some(state.to_string()),
- read: None,
- write: None,
- cksum: None,
+ stats: None,
msg: None,
};
return Ok((n, vdev));
@@ -89,9 +88,7 @@ fn parse_zpool_status_vdev(i: &str) -> IResult<&str, ZFSPoolVDevState> {
name: vdev_name.to_string(),
lvl: indent_level,
state: Some(state.to_string()),
- read: Some(read),
- write: Some(write),
- cksum: Some(cksum),
+ stats: Some(VDevStats { read, write, cksum }),
msg: msg.map(String::from),
};
@@ -282,9 +279,7 @@ fn test_vdev_list_to_tree() {
name: String::new(),
lvl: 0,
state: None,
- read: None,
- write: None,
- cksum: None,
+ stats: None,
msg: None,
};
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH proxmox 2/2] fix #7541: zfs status: account for msg directly after status in vdev parser
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
2026-06-03 16:01 ` [PATCH proxmox 0/2] " Nicolas Frey
2 siblings, 0 replies; 4+ messages in thread
From: Nicolas Frey @ 2026-06-03 15:58 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH proxmox 0/2] fix #7541: zfs status: account for msg directly after status in vdev parser
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 ` [PATCH proxmox 2/2] fix #7541: zfs status: account for msg directly after status in vdev parser Nicolas Frey
@ 2026-06-03 16:01 ` Nicolas Frey
2 siblings, 0 replies; 4+ messages in thread
From: Nicolas Frey @ 2026-06-03 16:01 UTC (permalink / raw)
To: pve-devel
this was meant to go to pbs-devel, sorry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-03 16:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH proxmox 2/2] fix #7541: zfs status: account for msg directly after status in vdev parser Nicolas Frey
2026-06-03 16:01 ` [PATCH proxmox 0/2] " Nicolas Frey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox