Skip to content

Commit 786a6a0

Browse files
committed
VDI.export_changed_blocks: lock vdi_to during SMAPIv2 call
This is to avoid the VDI being attached and written to while the VDI.export_changed_blocks SMAPIv2 call is running. The caller has to ensure that the "sr" parameter is the SR of the second VDI, "vdi_to". Signed-off-by: Gabor Igloi <[email protected]>
1 parent c419338 commit 786a6a0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ocaml/xapi/storage_impl.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,9 +592,13 @@ module Wrapper = functor(Impl: Server_impl) -> struct
592592
Impl.VDI.disable_cbt context ~dbg ~sr ~vdi
593593
)
594594

595+
(** The [sr] parameter is the SR of VDI [vdi_to]. *)
595596
let export_changed_blocks context ~dbg ~sr ~vdi_from ~vdi_to =
596597
info "VDI.export_changed_blocks dbg:%s sr:%s vdi_from:%s vdi_to:%s" dbg sr vdi_from vdi_to;
597-
Impl.VDI.export_changed_blocks context ~dbg ~sr ~vdi_from ~vdi_to
598+
with_vdi sr vdi_to
599+
(fun () ->
600+
Impl.VDI.export_changed_blocks context ~dbg ~sr ~vdi_from ~vdi_to
601+
)
598602

599603
end
600604

0 commit comments

Comments
 (0)