]> git.proxmox.com Git - proxmox-backup.git/commitdiff
fix #2904: zpool status: parse vdevs with state but without statistics
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 30 Jul 2020 08:02:16 +0000 (10:02 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 14 Aug 2020 09:41:32 +0000 (11:41 +0200)
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

index 8971d905c7294a55c069e7d1fcc0799d956f2fba..41b8a39c54951a459297d9cce9d5d24ca9e7897f 100644 (file)
@@ -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)?;