@@ -749,12 +749,7 @@ module MIRROR : SMAPIv2_MIRROR = struct
749749 Option. iter (fun r -> Local.DP. destroy dbg r.leaf_dp false ) recv_state ;
750750 State. remove_receive_mirror id
751751
752- let receive_finalize3 _ctx ~dbg ~mirror_id ~sr ~url ~verify_dest =
753- D. debug " %s dbg:%s id: %s sr: %s url: %s verify_dest: %B" __FUNCTION__ dbg
754- mirror_id (s_of_sr sr) url verify_dest ;
755- let (module Remote ) =
756- Storage_migrate_helper. get_remote_backend url verify_dest
757- in
752+ let receive_finalize_common ~dbg ~mirror_id (module SMAPI : SMAPIv2 ) =
758753 let recv_state = State. find_active_receive_mirror mirror_id in
759754 let open State.Receive_state in
760755 Option. iter
@@ -764,16 +759,28 @@ module MIRROR : SMAPIv2_MIRROR = struct
764759 __FUNCTION__ (Sr. string_of r.sr)
765760 (Vdi. string_of r.parent_vdi)
766761 (Vdi. string_of r.leaf_vdi) ;
767- Remote .DP. destroy2 dbg r.leaf_dp r.sr r.leaf_vdi r.mirror_vm false ;
768- Remote .VDI. compose dbg r.sr r.parent_vdi r.leaf_vdi ;
762+ SMAPI .DP. destroy2 dbg r.leaf_dp r.sr r.leaf_vdi r.mirror_vm false ;
763+ SMAPI .VDI. compose dbg r.sr r.parent_vdi r.leaf_vdi ;
769764 (* On SMAPIv3, compose would have removed the now invalid dummy vdi, so
770765 there is no need to destroy it anymore, while this is necessary on SMAPIv1 SRs. *)
771- D. log_and_ignore_exn (fun () -> Remote .VDI. destroy dbg r.sr r.dummy_vdi) ;
772- Remote .VDI. remove_from_sm_config dbg r.sr r.leaf_vdi " base_mirror"
766+ D. log_and_ignore_exn (fun () -> SMAPI .VDI. destroy dbg r.sr r.dummy_vdi) ;
767+ SMAPI .VDI. remove_from_sm_config dbg r.sr r.leaf_vdi " base_mirror"
773768 )
774769 recv_state ;
775770 State. remove_receive_mirror mirror_id
776771
772+ let receive_finalize2 _ctx ~dbg ~id =
773+ D. debug " %s dbg:%s id: %s" __FUNCTION__ dbg id ;
774+ receive_finalize_common ~dbg ~mirror_id: id (module Local )
775+
776+ let receive_finalize3 _ctx ~dbg ~mirror_id ~sr ~url ~verify_dest =
777+ D. debug " %s dbg:%s id: %s sr: %s url: %s verify_dest: %B" __FUNCTION__ dbg
778+ mirror_id (s_of_sr sr) url verify_dest ;
779+ let (module Remote ) =
780+ Storage_migrate_helper. get_remote_backend url verify_dest
781+ in
782+ receive_finalize_common ~dbg ~mirror_id (module Remote )
783+
777784 let receive_cancel _ctx ~dbg ~id =
778785 D. debug " %s dbg:%s mirror_id:%s" __FUNCTION__ dbg id ;
779786 let receive_state = State. find_active_receive_mirror id in
0 commit comments