public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup 1/2] zfs status: add test with spares
@ 2020-07-30  8:02 Dominik Csapak
  2020-07-30  8:02 ` [pbs-devel] [PATCH proxmox-backup 2/2] fix #2904: zpool status: parse vdevs with state but without statistics Dominik Csapak
  0 siblings, 1 reply; 3+ messages in thread
From: Dominik Csapak @ 2020-07-30  8:02 UTC (permalink / raw)
  To: pbs-devel

this will fail for now, fixed in the next commit

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/tools/disks/zpool_status.rs | 37 +++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/src/tools/disks/zpool_status.rs b/src/tools/disks/zpool_status.rs
index 3b0edc88..8971d905 100644
--- a/src/tools/disks/zpool_status.rs
+++ b/src/tools/disks/zpool_status.rs
@@ -465,3 +465,40 @@ errors: No known data errors
 
     Ok(())
 }
+
+#[test]
+fn test_zpool_status_parser_spares() -> Result<(), Error> {
+
+    let output = r###"  pool: tank
+ state: ONLINE
+  scan: none requested
+config:
+
+	NAME           STATE     READ WRITE CKSUM
+	tank          ONLINE       0     0     0
+	  mirror-0     ONLINE       0     0     0
+	    /dev/sda1  ONLINE       0     0     0
+	    /dev/sda2  ONLINE       0     0     0
+	  mirror-1     ONLINE       0     0     0
+	    /dev/sda3  ONLINE       0     0     0
+	    /dev/sda4  ONLINE       0     0     0
+	logs
+	  /dev/sda5    ONLINE       0     0     0
+        spares
+          /dev/sdb     AVAIL
+          /dev/sdc     AVAIL
+
+errors: No known data errors
+"###;
+
+    let key_value_list = parse_zpool_status(&output)?;
+    for (k, v) in key_value_list {
+        println!("{} => {}", k,v);
+        if k == "config" {
+            let vdev_list = parse_zpool_status_config_tree(&v)?;
+            let _tree = vdev_list_to_tree(&vdev_list);
+        }
+    }
+
+    Ok(())
+}
-- 
2.20.1





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pbs-devel] [PATCH proxmox-backup 2/2] fix #2904: zpool status: parse vdevs with state but without statistics
  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
  2020-08-14 11:01   ` [pbs-devel] applied: " Fabian Grünbichler
  0 siblings, 1 reply; 3+ messages in thread
From: Dominik Csapak @ 2020-07-30  8:02 UTC (permalink / raw)
  To: pbs-devel

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pbs-devel] applied: [PATCH proxmox-backup 2/2] fix #2904: zpool status: parse vdevs with state but without statistics
  2020-07-30  8:02 ` [pbs-devel] [PATCH proxmox-backup 2/2] fix #2904: zpool status: parse vdevs with state but without statistics Dominik Csapak
@ 2020-08-14 11:01   ` Fabian Grünbichler
  0 siblings, 0 replies; 3+ messages in thread
From: Fabian Grünbichler @ 2020-08-14 11:01 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion

On July 30, 2020 10:02 am, Dominik Csapak wrote:
> 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
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-14 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [pbs-devel] [PATCH proxmox-backup 2/2] fix #2904: zpool status: parse vdevs with state but without statistics Dominik Csapak
2020-08-14 11:01   ` [pbs-devel] applied: " Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal