@@ -10,6 +10,16 @@ pub(crate) struct PoolInfo {
1010 committed : u64 ,
1111 disk_capacity : u64 ,
1212 max_expandable_size : u64 ,
13+ io_error_count : u64 ,
14+ io_error_threshold : u64 ,
15+ io_stalled : bool ,
16+ io_stall_transition_count : u64 ,
17+ io_stall_transition_threshold : u64 ,
18+ alert_status : i32 ,
19+ notice : Vec < i32 > ,
20+ attention : Vec < i32 > ,
21+ warning : Vec < i32 > ,
22+ critical : Vec < i32 > ,
1323}
1424
1525impl PoolInfo {
@@ -43,10 +53,60 @@ impl PoolInfo {
4353 self . max_expandable_size
4454 }
4555
46- /// Get pool of the io_engine .
56+ /// Get state of the Pool .
4757 pub ( crate ) fn state ( & self ) -> u64 {
4858 self . state
4959 }
60+
61+ /// Get the count of IO errors on the pool.
62+ pub ( crate ) fn io_error_count ( & self ) -> u64 {
63+ self . io_error_count
64+ }
65+
66+ /// Get the IO error threshold for the pool.
67+ pub ( crate ) fn io_error_threshold ( & self ) -> u64 {
68+ self . io_error_threshold
69+ }
70+
71+ /// Get whether the pool is currently in stalled state.
72+ pub ( crate ) fn io_stalled ( & self ) -> bool {
73+ self . io_stalled
74+ }
75+
76+ /// Get the count of IO stall transitions on the pool.
77+ pub ( crate ) fn io_stall_transition_count ( & self ) -> u64 {
78+ self . io_stall_transition_count
79+ }
80+
81+ /// Get the IO stall transition threshold for the pool.
82+ pub ( crate ) fn io_stall_transition_threshold ( & self ) -> u64 {
83+ self . io_stall_transition_threshold
84+ }
85+
86+ /// Get the alert status for the pool.
87+ pub ( crate ) fn alert_status ( & self ) -> i32 {
88+ self . alert_status
89+ }
90+
91+ /// Get the collection of notice alert reasons for the pool.
92+ pub ( crate ) fn notice ( & self ) -> & Vec < i32 > {
93+ & self . notice
94+ }
95+
96+ /// Get the collection of attention alert reasons for the pool.
97+ pub ( crate ) fn attention ( & self ) -> & Vec < i32 > {
98+ & self . attention
99+ }
100+
101+ /// Get the collection of warning alert reasons for the pool.
102+ pub ( crate ) fn warning ( & self ) -> & Vec < i32 > {
103+ & self . warning
104+ }
105+
106+ /// Get the collection of critical alert reasons for the pool.
107+ pub ( crate ) fn critical ( & self ) -> & Vec < i32 > {
108+ & self . critical
109+ }
50110}
51111
52112/// Array of PoolInfo objects.
@@ -57,6 +117,34 @@ pub(crate) struct Pools {
57117
58118impl From < rpc:: v1:: pool:: Pool > for PoolInfo {
59119 fn from ( value : rpc:: v1:: pool:: Pool ) -> Self {
120+ let mut io_error_count: u64 = 0 ;
121+ let mut io_error_threshold: u64 = 0 ;
122+ let mut io_stalled: bool = false ;
123+ let mut io_stall_transition_count: u64 = 0 ;
124+ let mut io_stall_transition_threshold: u64 = 0 ;
125+ let mut alert_status: i32 = 0 ;
126+ let mut notice: Vec < i32 > = Vec :: new ( ) ;
127+ let mut attention: Vec < i32 > = Vec :: new ( ) ;
128+ let mut warning: Vec < i32 > = Vec :: new ( ) ;
129+ let mut critical: Vec < i32 > = Vec :: new ( ) ;
130+ if let Some ( errors) = value. errors . clone ( ) {
131+ io_error_count = errors. io_error_count ;
132+ io_error_threshold = errors. io_error_threshold ;
133+ io_stalled = errors. io_stalled ;
134+ io_stall_transition_count = errors. io_stall_transition_count ;
135+ io_stall_transition_threshold = errors. io_stall_transition_threshold ;
136+ if let Some ( alerts) = errors. alerts {
137+ alert_status = alerts. status ;
138+
139+ notice = alerts. notice ;
140+
141+ attention = alerts. attention ;
142+
143+ warning = alerts. warning ;
144+
145+ critical = alerts. critical ;
146+ }
147+ }
60148 Self {
61149 name : value. name ,
62150 used : value. used ,
@@ -65,6 +153,16 @@ impl From<rpc::v1::pool::Pool> for PoolInfo {
65153 committed : value. committed ,
66154 disk_capacity : value. disk_capacity ,
67155 max_expandable_size : value. max_expandable_size . unwrap_or_default ( ) ,
156+ io_error_count,
157+ io_error_threshold,
158+ io_stalled,
159+ io_stall_transition_count,
160+ io_stall_transition_threshold,
161+ alert_status,
162+ notice,
163+ attention,
164+ warning,
165+ critical,
68166 }
69167 }
70168}
0 commit comments