Skip to content

Commit dcb01ce

Browse files
committed
Add VDI.export_changed_blocks SMAPIv2 function
And add the call to Storage_impl_test with an "assert false" stub, as we don't have tests for this call in Storage_impl_test at the moment, so it shouldn't get called. Signed-off-by: Gabor Igloi <[email protected]>
1 parent 81264fc commit dcb01ce

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

ocaml/xapi/storage_access.ml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,22 @@ module SMAPIv1 = struct
847847
let data_destroy context =
848848
call_cbt_function context ~f:Sm.vdi_data_destroy ~f_name:"VDI.data_destroy"
849849

850+
let export_changed_blocks context ~dbg ~sr ~vdi_from ~vdi_to =
851+
try
852+
Server_helpers.exec_with_new_task "VDI.export_changed_blocks" ~subtask_of:(Ref.of_string dbg)
853+
(fun __context ->
854+
let vdi_from = find_vdi ~__context sr vdi_from |> fst in
855+
for_vdi ~dbg ~sr ~vdi:vdi_to "VDI.export_changed_blocks"
856+
(fun device_config _type sr vdi_to ->
857+
Sm.vdi_export_changed_blocks device_config _type sr ~vdi_from ~vdi_to
858+
))
859+
with
860+
| Smint.Not_implemented_in_backend ->
861+
raise (Unimplemented "VDI.export_changed_blocks")
862+
| Api_errors.Server_error(code, params) ->
863+
raise (Backend_error(code, params))
864+
| Sm.MasterOnly -> redirect sr
865+
850866
end
851867

852868
let get_by_name context ~dbg ~name = assert false

ocaml/xapi/storage_impl.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,10 @@ module Wrapper = functor(Impl: Server_impl) -> struct
592592
Impl.VDI.disable_cbt context ~dbg ~sr ~vdi
593593
)
594594

595+
let export_changed_blocks context ~dbg ~sr ~vdi_from ~vdi_to =
596+
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+
595599
end
596600

597601
let get_by_name context ~dbg ~name =

ocaml/xapi/storage_impl_test.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ module Debug_print_impl = struct
169169
let enable_cbt context ~dbg ~sr ~vdi = assert false
170170
let disable_cbt context ~dbg ~sr ~vdi = assert false
171171
let data_destroy context ~dbg ~sr ~vdi = assert false
172+
let export_changed_blocks context ~dbg ~sr ~vdi_from ~vdi_to = assert false
172173

173174

174175
end

ocaml/xapi/storage_mux.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ module Mux = struct
264264
let data_destroy context ~dbg ~sr ~vdi =
265265
let module C = Client(struct let rpc = of_sr sr end) in
266266
C.VDI.data_destroy ~dbg ~sr ~vdi
267+
let export_changed_blocks context ~dbg ~sr ~vdi_from ~vdi_to =
268+
let module C = Client(struct let rpc = of_sr sr end) in
269+
C.VDI.export_changed_blocks ~dbg ~sr ~vdi_from ~vdi_to
267270

268271
end
269272

0 commit comments

Comments
 (0)