Skip to content

Commit 358181d

Browse files
committed
Filter by required_SR_list
1 parent bd45e8c commit 358181d

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

ocaml/xapi/xapi_vm_helpers.ml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -769,14 +769,12 @@ let assert_can_be_recovered ~__context ~self ~session_to =
769769

770770
let get_SRs_required_for_recovery ~__context ~self ~session_to =
771771
let required_SR_list = list_required_SRs ~__context ~self in
772-
let required_SR_uuids = List.map( fun sr ->Db.SR.get_uuid ~__context ~self:sr) required_SR_list
773-
in
774772
try
775-
let sr_uuids_list=
776773
Server_helpers.exec_with_new_task ~session_id:session_to
777774
"Looking for the required SRs"
778775
(fun __context_to -> List.filter
779-
( fun sr_uuid ->
776+
( fun sr_ref ->
777+
let sr_uuid = Db.SR.get_uuid ~__context ~self:sr_ref in
780778
try
781779
let sr = Db.SR.get_by_uuid ~__context:__context_to ~uuid:sr_uuid in
782780
let pbds = Db.SR.get_PBDs ~__context:__context_to ~self:sr in
@@ -787,9 +785,7 @@ let get_SRs_required_for_recovery ~__context ~self ~session_to =
787785
if attached_pbds = [] then true else false
788786
with Db_exn.Read_missing_uuid(_ , _ , sr_uuid) -> true
789787
)
790-
required_SR_uuids)
791-
in
792-
List.map(fun sr -> Db.SR.get_by_uuid ~__context ~uuid:sr)sr_uuids_list
788+
required_SR_list)
793789
with e -> raise e;;
794790

795791

0 commit comments

Comments
 (0)