File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -1012,10 +1012,20 @@ let i_am_srmaster ~__context ~sr =
10121012 get_srmaster ~__context ~sr = get_localhost ~__context
10131013
10141014let get_all_plugged_srs ~__context =
1015- let pbds = Db.PBD. get_all ~__context in
1016- let pbds_plugged_in = List. filter ( fun self -> Db.PBD. get_currently_attached ~__context ~self ) pbds in
1015+ let pbds_plugged_in = Db.PBD. get_refs_where ~__context ~expr: (
1016+ Eq ( Field " currently_attached " , Literal " true " )) in
10171017 List. setify (List. map (fun self -> Db.PBD. get_SR ~__context ~self ) pbds_plugged_in)
10181018
1019+ let get_local_plugged_srs ~__context =
1020+ let localhost = get_localhost __context in
1021+ let localhost = Ref. string_of localhost in
1022+ let my_pbds_plugged_in = Db.PBD. get_refs_where ~__context ~expr: (And (
1023+ Eq (Field " host" , Literal localhost),
1024+ Eq (Field " currently_attached" , Literal " true" )
1025+ ))
1026+ in
1027+ List. setify (List. map (fun self -> Db.PBD. get_SR ~__context ~self ) my_pbds_plugged_in)
1028+
10191029let find_health_check_task ~__context ~sr =
10201030 Db.Task. get_refs_where ~__context ~expr: (And (
10211031 Eq (Field " name__label" , Literal Xapi_globs. sr_health_check_task_label),
Original file line number Diff line number Diff line change @@ -665,7 +665,7 @@ let physical_utilisation_thread ~__context () =
665665 let sr_cache : bool SRMap.t ref = ref SRMap. empty in
666666
667667 let srs_to_update () =
668- let plugged_srs = Helpers. get_all_plugged_srs ~__context in
668+ let plugged_srs = Helpers. get_local_plugged_srs ~__context in
669669 (* Remove SRs that are no longer plugged *)
670670 sr_cache := SRMap. filter (fun sr _ -> List. mem sr plugged_srs) ! sr_cache;
671671 (* Cache wether we should manage stats for newly plugged SRs *)
You can’t perform that action at this time.
0 commit comments