Skip to content

Commit 2ffa7ab

Browse files
committed
CA-78221: add a new SM call VDI.remove_from_other_config
We use this call when the storage motion is successful to remove the "base_mirror" key from other-config (this will make the mirgated VDIs to appear in XenCenter)
1 parent 99b8d38 commit 2ffa7ab

File tree

7 files changed

+20
-0
lines changed

7 files changed

+20
-0
lines changed

ocaml/xapi/storage_access.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,13 @@ module SMAPIv1 = struct
553553
raise (Vdi_does_not_exist vdi1)
554554
| Sm.MasterOnly -> redirect sr
555555

556+
let remove_from_other_config context ~dbg ~sr ~vdi ~key =
557+
info "VDI.update_record dbg:%s sr:%s vdi:%s" dbg sr vdi;
558+
Server_helpers.exec_with_new_task "VDI.update_record" ~subtask_of:(Ref.of_string dbg)
559+
(fun __context ->
560+
let self = find_vdi ~__context sr vdi |> fst in
561+
Db.VDI.remove_from_other_config ~__context ~self ~key)
562+
556563
let get_url context ~dbg ~sr ~vdi =
557564
info "VDI.get_url dbg:%s sr:%s vdi:%s" dbg sr vdi;
558565
(* XXX: PR-1255: tapdisk shouldn't hardcode xapi urls *)

ocaml/xapi/storage_impl.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,10 @@ module Wrapper = functor(Impl: Server_impl) -> struct
515515
info "VDI.compose dbg:%s sr:%s vdi1:%s vdi2:%s" dbg sr vdi1 vdi2;
516516
Impl.VDI.compose context ~dbg ~sr ~vdi1 ~vdi2
517517

518+
let remove_from_other_config context ~dbg ~sr ~vdi ~key =
519+
info "VDI.remove_from_other_config dbg:%s sr:%s vdi:%s key:%s" dbg sr vdi key;
520+
Impl.VDI.remove_from_other_config context ~dbg ~sr ~vdi ~key
521+
518522
let get_url context ~dbg ~sr ~vdi =
519523
info "VDI.get_url dbg:%s sr:%s vdi:%s" dbg sr vdi;
520524
Impl.VDI.get_url context ~dbg ~sr ~vdi

ocaml/xapi/storage_impl_test.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ module Debug_print_impl = struct
153153

154154
let get_url context ~dbg ~sr ~vdi = assert false
155155
let compose context ~dbg ~sr ~vdi1 ~vdi2 = assert false
156+
let remove_from_other_config context ~dbg ~sr ~vdi ~key = assert false
156157
let set_content_id context ~dbg ~sr ~vdi ~content_id = assert false
157158
let get_by_name context ~dbg ~sr ~name = assert false
158159
let similar_content context ~dbg ~sr ~vdi = assert false

ocaml/xapi/storage_interface.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@ module VDI = struct
296296

297297
(** [compose task sr vdi1 vdi2] layers the updates from [vdi2] onto [vdi1], modifying [vdi2] *)
298298
external compose : dbg:debug_info -> sr:sr -> vdi1:vdi -> vdi2:vdi -> unit = ""
299+
300+
(** [remove_other_config dbg sr vdi key] remove [key] from [vdi] other config *)
301+
external remove_from_other_config: dbg:debug_info -> sr:sr -> vdi:vdi -> key:string -> unit = ""
299302
end
300303

301304
(** [get_by_name task name] returns a vdi with [name] (which may be in any SR) *)

ocaml/xapi/storage_migrate.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ let start' ~task ~dbg ~sr ~vdi ~dp ~url ~dest =
381381
copy' ~task ~dbg ~sr ~vdi:snapshot.vdi ~url ~dest ~dest_vdi:result.Mirror.copy_diffs_to) |> vdi_info in
382382
debug "Local VDI %s == remote VDI %s" snapshot.vdi new_parent.vdi;
383383
Remote.VDI.compose ~dbg ~sr:dest ~vdi1:result.Mirror.copy_diffs_to ~vdi2:result.Mirror.mirror_vdi.vdi;
384+
Remote.VDI.remove_from_other_config ~dbg ~sr:dest ~vdi:result.Mirror.mirror_vdi.vdi ~key:"base_mirror";
384385
debug "Local VDI %s now mirrored to remote VDI: %s" local_vdi.vdi result.Mirror.mirror_vdi.vdi;
385386

386387
debug "Destroying dummy VDI %s on remote" result.Mirror.dummy_vdi;

ocaml/xapi/storage_mux.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ module Mux = struct
207207
let compose context ~dbg ~sr ~vdi1 ~vdi2 =
208208
let module C = Client(struct let rpc = of_sr sr end) in
209209
C.VDI.compose ~dbg ~sr ~vdi1 ~vdi2
210+
let remove_from_other_config context ~dbg ~sr ~vdi ~key =
211+
let module C = Client(struct let rpc = of_sr sr end) in
212+
C.VDI.remove_from_other_config ~dbg ~sr ~vdi ~key
210213
let get_url context ~dbg ~sr ~vdi =
211214
let module C = Client(struct let rpc = of_sr sr end) in
212215
C.VDI.get_url ~dbg ~sr ~vdi

ocaml/xapi/storage_proxy.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ module Proxy = functor(RPC: RPC) -> struct
6464
let set_content_id _ = Client.VDI.set_content_id
6565
let similar_content _ = Client.VDI.similar_content
6666
let compose _ = Client.VDI.compose
67+
let remove_from_other_config _ = Client.VDI.remove_from_other_config
6768
let get_url _ = Client.VDI.get_url
6869
end
6970

0 commit comments

Comments
 (0)