@@ -74,29 +74,29 @@ where
7474 T : FromStr ,
7575{
7676 if e. children . is_empty ( ) {
77- return Err ( StorageMetricsError :: new ( format ! ( "{} not found" , tag) ) ) ;
77+ return Err ( StorageError :: new ( format ! ( "{} not found" , tag) ) ) ;
7878 }
7979 for child in & e. children {
8080 if child. name == tag {
8181 let res = T :: from_str ( & child. clone ( ) . text . unwrap_or ( "" . to_string ( ) ) ) ;
8282 match res {
8383 Ok ( val) => return Ok ( val) ,
8484 Err ( _) => {
85- return Err ( StorageMetricsError :: new ( format ! (
85+ return Err ( StorageError :: new ( format ! (
8686 "parsing {} failed" ,
8787 child. name
8888 ) ) )
8989 }
9090 }
9191 }
9292 }
93- Err ( StorageMetricsError :: new ( format ! ( "{} not found" , tag) ) )
93+ Err ( StorageError :: new ( format ! ( "{} not found" , tag) ) )
9494}
9595
9696fn check_failure ( e : & treexml:: Element ) -> MetricsResult < ( ) > {
9797 if let Some ( s) = e. attributes . get ( "status" ) {
9898 if s == "failed" {
99- return Err ( StorageMetricsError :: new ( format ! (
99+ return Err ( StorageError :: new ( format ! (
100100 "netapp query failed: {}" ,
101101 e. attributes. get( "reason" ) . unwrap( )
102102 ) ) ) ;
@@ -176,18 +176,18 @@ pub struct PerformanceStat {
176176impl FromXml for HaPerformanceStats {
177177 fn from_xml ( data : & str ) -> MetricsResult < Self > {
178178 let doc = Document :: parse ( data. as_bytes ( ) ) ?;
179- let root = doc. root . ok_or ( StorageMetricsError :: new ( format ! (
179+ let root = doc. root . ok_or ( StorageError :: new ( format ! (
180180 "root xml not found for {}" ,
181181 data
182182 ) ) ) ?;
183183 let results = root. find_child ( |tag| tag. name == "results" ) . ok_or (
184- StorageMetricsError :: new ( format ! ( "results tag not found in {:?}" , root) ) ,
184+ StorageError :: new ( format ! ( "results tag not found in {:?}" , root) ) ,
185185 ) ?;
186186 check_failure ( & results) ?;
187187
188188 let attribute_list = results
189189 . find_child ( |tag| tag. name == "attributes-list" )
190- . ok_or ( StorageMetricsError :: new ( format ! (
190+ . ok_or ( StorageError :: new ( format ! (
191191 "results tag not found in {:?}" ,
192192 root
193193 ) ) ) ?;
@@ -384,56 +384,56 @@ pub struct NetappVolume {
384384impl FromXml for NetappVolumes {
385385 fn from_xml ( data : & str ) -> MetricsResult < Self > {
386386 let doc = Document :: parse ( data. as_bytes ( ) ) ?;
387- let root = doc. root . ok_or ( StorageMetricsError :: new ( format ! (
387+ let root = doc. root . ok_or ( StorageError :: new ( format ! (
388388 "root xml not found for {}" ,
389389 data
390390 ) ) ) ?;
391391 let results = root. find_child ( |tag| tag. name == "results" ) . ok_or (
392- StorageMetricsError :: new ( format ! ( "results tag not found in {:?}" , root) ) ,
392+ StorageError :: new ( format ! ( "results tag not found in {:?}" , root) ) ,
393393 ) ?;
394394 check_failure ( & results) ?;
395395
396396 let vols = results
397397 . find_child ( |tag| tag. name == "attributes-list" )
398- . ok_or ( StorageMetricsError :: new ( format ! (
398+ . ok_or ( StorageError :: new ( format ! (
399399 "results tag not found in {:?}" ,
400400 root
401401 ) ) ) ?;
402402 let mut volumes: Vec < NetappVolume > = Vec :: new ( ) ;
403403 for vol_child in & vols. children {
404404 let autosize_attributes = vol_child
405405 . find_child ( |tag| tag. name == "volume-autosize-attributes" )
406- . ok_or ( StorageMetricsError :: new ( format ! (
406+ . ok_or ( StorageError :: new ( format ! (
407407 "volume-autosize-attributes tag not found in {:?}" ,
408408 vol_child
409409 ) ) ) ?;
410410 let id_attributes = vol_child
411411 . find_child ( |tag| tag. name == "volume-id-attributes" )
412- . ok_or ( StorageMetricsError :: new ( format ! (
412+ . ok_or ( StorageError :: new ( format ! (
413413 "volume-id-attributes tag not found in {:?}" ,
414414 vol_child
415415 ) ) ) ?;
416416 let inode_attributes = vol_child
417417 . find_child ( |tag| tag. name == "volume-inode-attributes" )
418- . ok_or ( StorageMetricsError :: new ( format ! (
418+ . ok_or ( StorageError :: new ( format ! (
419419 "volume-inode-attributes tag not found in {:?}" ,
420420 vol_child
421421 ) ) ) ?;
422422 let sis_attributes = vol_child
423423 . find_child ( |tag| tag. name == "volume-sis-attributes" )
424- . ok_or ( StorageMetricsError :: new ( format ! (
424+ . ok_or ( StorageError :: new ( format ! (
425425 "volume-sis-attributes tag not found in {:?}" ,
426426 vol_child
427427 ) ) ) ?;
428428 let space_attributes = vol_child
429429 . find_child ( |tag| tag. name == "volume-space-attributes" )
430- . ok_or ( StorageMetricsError :: new ( format ! (
430+ . ok_or ( StorageError :: new ( format ! (
431431 "volume-space-attributes tag not found in {:?}" ,
432432 vol_child
433433 ) ) ) ?;
434434 let state_attributes = vol_child
435435 . find_child ( |tag| tag. name == "volume-state-attributes" )
436- . ok_or ( StorageMetricsError :: new ( format ! (
436+ . ok_or ( StorageError :: new ( format ! (
437437 "volume-state-attributes tag not found in {:?}" ,
438438 vol_child
439439 ) ) ) ?;
@@ -619,12 +619,12 @@ impl FromXml for OnTapVersion {
619619 debug ! ( "parsing ontap data: {}" , data) ;
620620
621621 let doc = Document :: parse ( data. as_bytes ( ) ) ?;
622- let root = doc. root . ok_or ( StorageMetricsError :: new ( format ! (
622+ let root = doc. root . ok_or ( StorageError :: new ( format ! (
623623 "root xml not found for {}" ,
624624 data
625625 ) ) ) ?;
626626 let results = root. find_child ( |tag| tag. name == "results" ) . ok_or (
627- StorageMetricsError :: new ( format ! ( "results tag not found in {:?}" , root) ) ,
627+ StorageError :: new ( format ! ( "results tag not found in {:?}" , root) ) ,
628628 ) ?;
629629 check_failure ( & results) ?;
630630
0 commit comments