Skip to content

Commit b158137

Browse files
authored
Merge pull request xapi-project#3720 from gaborigloi/helper
Move implementations_of_backend to xcp-idl
2 parents 9522b92 + 0f9c109 commit b158137

File tree

4 files changed

+4
-17
lines changed

4 files changed

+4
-17
lines changed

ocaml/xapi/attach_helpers.ml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,3 @@ let with_vbds rpc session_id __context vm vdis mode f =
101101
List.iter (Helpers.log_exn_continue "destroying VBD on VM"
102102
(fun self -> Client.VBD.destroy rpc session_id self)) !vbds))
103103

104-
(** Separates the implementations of the given backend returned from
105-
the VDI.attach2 SMAPIv2 call based on their type *)
106-
let implementations_of_backend backend =
107-
List.fold_left
108-
(fun (xendisks, blockdevices, files, nbds) implementation ->
109-
match implementation with
110-
| Storage_interface.XenDisk xendisk -> (xendisk::xendisks, blockdevices, files, nbds)
111-
| BlockDevice blockdevice -> (xendisks, blockdevice::blockdevices, files, nbds)
112-
| File file -> (xendisks, blockdevices, file::files, nbds)
113-
| Nbd nbd -> (xendisks, blockdevices, files, nbd::nbds)
114-
)
115-
([], [], [], [])
116-
backend.Storage_interface.implementations

ocaml/xapi/storage_impl.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ module Wrapper = functor(Impl: Server_impl) -> struct
494494
backwards-compatibility, because older xapis call Remote.VDI.attach during SXM.
495495
However, they ignore the return value, so in practice it does not matter what
496496
we return from here. *)
497-
let (xendisks, blockdevs, files, _nbds) = Attach_helpers.implementations_of_backend backend in
497+
let (xendisks, blockdevs, files, _nbds) = Storage_interface.implementations_of_backend backend in
498498
let response params =
499499
(* We've thrown o_direct info away from the SMAPIv1 info during the conversion to SMAPIv3 attach info *)
500500
(* The removal of these fields does not break read caching info propagation for SMAPIv1

ocaml/xapi/storage_migrate.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ let vdi_info x =
244244
module Local = StorageAPI(Idl.GenClientExnRpc(struct let rpc call = rpc ~srcstr:"smapiv2" ~dststr:"smapiv2" (local_url ()) call end))
245245

246246
let tapdisk_of_attach_info (backend:Storage_interface.backend) =
247-
let xendisks, _, _, _ = Attach_helpers.implementations_of_backend backend in
247+
let xendisks, _, _, _ = Storage_interface.implementations_of_backend backend in
248248
match xendisks with
249249
| xendisk :: _ -> begin
250250
let path = xendisk.Storage_interface.params in
@@ -278,7 +278,7 @@ let with_activated_disk ~dbg ~sr ~vdi ~dp f =
278278
let path =
279279
Opt.map
280280
(fun (vdi, backend) ->
281-
let (_, blockdevs, files, _) = Attach_helpers.implementations_of_backend backend in
281+
let (_, blockdevs, files, _) = Storage_interface.implementations_of_backend backend in
282282
match blockdevs, files with
283283
| ({ path })::_, _ | _, ({ path })::_ ->
284284
Local.VDI.activate dbg dp sr vdi;

ocaml/xapi/xapi_vbd.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ let plug ~__context ~self =
7373
debug "VBD.plug of loopback VBD '%s'" (Ref.string_of self);
7474
Storage_access.attach_and_activate ~__context ~vbd:self ~domid
7575
(fun attach_info ->
76-
let (xendisks, blockdevs, files, nbds) = Attach_helpers.implementations_of_backend attach_info in
76+
let (xendisks, blockdevs, files, nbds) = Storage_interface.implementations_of_backend attach_info in
7777
let device_path =
7878
match files, blockdevs, nbds with
7979
| { path }::_, _, _ | _, { path }::_, _ -> path

0 commit comments

Comments
 (0)