From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id C70971FF136 for ; Mon, 04 May 2026 15:30:40 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id EA25F22DA1; Mon, 4 May 2026 15:30:39 +0200 (CEST) Date: Mon, 04 May 2026 15:29:59 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= Subject: Re: [PATCH proxmox-backup 1/1] fix #7541: zfs status: account for msg directly after status in vdev parser To: Nicolas Frey , pbs-devel@lists.proxmox.com References: <20260430100506.159160-1-n.frey@proxmox.com> In-Reply-To: <20260430100506.159160-1-n.frey@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.17.0 (https://github.com/astroidmail/astroid) Message-Id: <1777900823.7usgya04qb.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1777901297576 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.054 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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: H2TRT3YDOJ5AUSKU5OHZ7HTEEPMVGHIR X-Message-ID-Hash: H2TRT3YDOJ5AUSKU5OHZ7HTEEPMVGHIR X-MailFrom: f.gruenbichler@proxmox.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 Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On April 30, 2026 12:05 pm, Nicolas Frey wrote: > so spares that have the status `INUSE` parse correctly. >=20 > 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`. >=20 > Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=3D7541 > Signed-off-by: Nicolas Frey > --- > src/tools/disks/zpool_status.rs | 33 +++++++++++++++++++-------------- > 1 file changed, 19 insertions(+), 14 deletions(-) >=20 > diff --git a/src/tools/disks/zpool_status.rs b/src/tools/disks/zpool_stat= us.rs > index 05ef5d80..071431f2 100644 > --- a/src/tools/disks/zpool_status.rs > +++ b/src/tools/disks/zpool_status.rs > @@ -14,7 +14,7 @@ use nom::{ > character::complete::line_ending, > combinator::opt, > multi::{many0, many1}, > - sequence::preceded, > + sequence::{preceded, tuple}, > }; >=20 > #[derive(Debug, Serialize, Deserialize)] > @@ -66,33 +66,37 @@ fn parse_zpool_status_vdev(i: &str) -> IResult<&str, = ZFSPoolVDevState> { > } >=20 > let (i, state) =3D preceded(multispace1, notspace1)(i)?; > - if let Ok((n, _)) =3D preceded(multispace0, line_ending)(i) { > - // spares > + if let Ok((n, (read, write, cksum, msg, _))) =3D tuple(( > + preceded(multispace1, parse_u64), > + preceded(multispace1, parse_u64), > + preceded(multispace1, parse_u64), > + opt(preceded(multispace1, take_while1(|c: char| c !=3D '\n'))), > + line_ending, > + ))(i) > + { > let vdev =3D ZFSPoolVDevState { > name: vdev_name.to_string(), > lvl: indent_level, > state: Some(state.to_string()), > - read: None, > - write: None, > - cksum: None, > - msg: None, > + read: Some(read), > + write: Some(write), > + cksum: Some(cksum), > + msg: msg.map(String::from), > }; > return Ok((n, vdev)); I think for following along, it would actually be easier to make read/write/cksum an optional tuple? would also drop a bit of duplicated code AFAICT.. > } >=20 > - let (i, read) =3D preceded(multispace1, parse_u64)(i)?; > - let (i, write) =3D preceded(multispace1, parse_u64)(i)?; > - let (i, cksum) =3D preceded(multispace1, parse_u64)(i)?; > - let (i, msg) =3D opt(preceded(multispace1, take_while(|c| c !=3D '\n= ')))(i)?; > + // spares > + let (i, msg) =3D opt(preceded(multispace1, take_while1(|c: char| c != =3D '\n')))(i)?; > let (i, _) =3D line_ending(i)?; >=20 > let vdev =3D ZFSPoolVDevState { > name: vdev_name.to_string(), > lvl: indent_level, > state: Some(state.to_string()), > - read: Some(read), > - write: Some(write), > - cksum: Some(cksum), > + read: None, > + write: None, > + cksum: None, > msg: msg.map(String::from), > }; >=20 > @@ -490,6 +494,7 @@ config: > spares > /dev/sdb AVAIL > /dev/sdc AVAIL > + /dev/sdd INUSE currently in use >=20 > errors: No known data errors > "###; > -- > 2.47.3 >=20 >=20 >=20 >=20