Skip to content

Commit ff85883

Browse files
committed
VDI.export_changed_blocks: only require SR of vdi_to
If the VDIs are from different SRs, then the changed blocks are all the blocks of vdi_to, so the SR of vdi_from doesn't have to be connected. Using SR.forward_multiple_op caused a bug where the export_changed_blocks call was forwarded to a slave, even though this call has to be run from the SR master, which is the pool master in case of a shared SR. The forward_vdi_op function correctly forwards the call to the SR master. Signed-off-by: Gabor Igloi <[email protected]>
1 parent 210a756 commit ff85883

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ocaml/xapi/message_forwarding.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3108,8 +3108,9 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct
31083108
let host = Db.PBD.get_host ~__context ~self:pbd in
31093109
do_op_on ~local_fn ~__context ~host op
31103110

3111-
(* do op on a host that can view multiple SRs, if none is found, an
3112-
exception of Not_found will be raised *)
3111+
(** Do op on a host that can view multiple SRs. If none is found, the
3112+
Not_found exception will be raised.
3113+
WARNING: this may forward the call to a host that is NOT the SR master. *)
31133114
let forward_sr_multiple_op ~local_fn ~__context ~srs ?(prefer_slaves=false) op =
31143115
let choose_fn ~host =
31153116
Xapi_vm_helpers.assert_can_see_specified_SRs ~__context ~reqd_srs:srs ~host in
@@ -3608,11 +3609,10 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct
36083609
let export_changed_blocks ~__context ~vdi_from ~vdi_to =
36093610
info "VDI.export_changed_blocks: vdi_from = '%s'; vdi_to = '%s'" (vdi_uuid ~__context vdi_from) (vdi_uuid ~__context vdi_to);
36103611
let local_fn = Local.VDI.export_changed_blocks ~vdi_from ~vdi_to in
3611-
let vdi_from_sr = Db.VDI.get_SR ~__context ~self:vdi_from in
36123612
let vdi_to_sr = Db.VDI.get_SR ~__context ~self:vdi_to in
36133613
with_sr_andor_vdi ~__context ~sr:(vdi_to_sr, `vdi_export_changed_blocks) ~vdi:(vdi_to, `export_changed_blocks) ~doc:"VDI.export_changed_blocks"
36143614
(fun () ->
3615-
SR.forward_sr_multiple_op ~local_fn ~__context ~srs:[vdi_from_sr; vdi_to_sr] ~prefer_slaves:true
3615+
forward_vdi_op ~local_fn ~__context ~self:vdi_to
36163616
(fun session_id rpc -> Client.VDI.export_changed_blocks ~rpc ~session_id ~vdi_from ~vdi_to))
36173617

36183618
end

0 commit comments

Comments
 (0)