src/tools/disks/zpool_status.rs - add all attributes to the tree

This commit is contained in:
Dietmar Maurer 2020-06-19 16:55:28 +02:00
parent 4e37d9ce67
commit f675c5e978
1 changed files with 15 additions and 0 deletions

View File

@ -182,6 +182,21 @@ pub fn vdev_list_to_tree(vdev_list: &[ZFSPoolVDevState]) -> Result<Value, Error>
indented_list_to_tree(vdev_list, |vdev, node| { indented_list_to_tree(vdev_list, |vdev, node| {
node.insert("name".to_string(), Value::String(vdev.name.clone())); node.insert("name".to_string(), Value::String(vdev.name.clone()));
node.insert("lvl".to_string(), Value::Number(vdev.lvl.into())); node.insert("lvl".to_string(), Value::Number(vdev.lvl.into()));
if let Some(ref state) = vdev.state {
node.insert("state".to_string(), Value::String(state.clone()));
}
if let Some(ref msg) = vdev.msg {
node.insert("msg".to_string(), Value::String(msg.clone()));
}
if let Some(read) = vdev.read {
node.insert("read".to_string(), Value::Number(read.into()));
}
if let Some(write) = vdev.write {
node.insert("write".to_string(), Value::Number(write.into()));
}
if let Some(cksum) = vdev.cksum {
node.insert("cksum".to_string(), Value::Number(cksum.into()));
}
vdev.lvl vdev.lvl
}) })
} }