Skip to content

Commit c973256

Browse files
committed
Bring back DATA.MIRROR.stat to storage_mux
Do the same as DATA.MIRROR.list Signed-off-by: Vincent Liu <[email protected]>
1 parent a0faec2 commit c973256

File tree

10 files changed

+26
-3
lines changed

10 files changed

+26
-3
lines changed

ocaml/xapi-idl/storage/storage_interface.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,10 @@ module StorageAPI (R : RPC) = struct
11961196
Param.mk ~name:"mirrors" TypeCombinators.(list (pair Mirror.(id, t)))
11971197
in
11981198
declare "DATA.MIRROR.list" [] (dbg_p @-> returning result_p err)
1199+
1200+
let stat =
1201+
let result_p = Param.mk ~name:"result" Mirror.t in
1202+
declare "DATA.MIRROR.stat" [] (dbg_p @-> id_p @-> returning result_p err)
11991203
end
12001204
end
12011205

@@ -1310,6 +1314,8 @@ module type MIRROR = sig
13101314
context -> dbg:debug_info -> mirror_id:Mirror.id -> sr:Sr.t -> bool
13111315

13121316
val list : context -> dbg:debug_info -> (Mirror.id * Mirror.t) list
1317+
1318+
val stat : context -> dbg:debug_info -> id:Mirror.id -> Mirror.t
13131319
end
13141320

13151321
module type Server_impl = sig
@@ -1791,6 +1797,7 @@ module Server (Impl : Server_impl) () = struct
17911797
Impl.DATA.MIRROR.is_mirror_failed () ~dbg ~mirror_id ~sr
17921798
) ;
17931799
S.DATA.MIRROR.list (fun dbg -> Impl.DATA.MIRROR.list () ~dbg) ;
1800+
S.DATA.MIRROR.stat (fun dbg id -> Impl.DATA.MIRROR.stat () ~dbg ~id) ;
17941801
S.DATA.import_activate (fun dbg dp sr vdi vm ->
17951802
Impl.DATA.import_activate () ~dbg ~dp ~sr ~vdi ~vm
17961803
) ;

ocaml/xapi-idl/storage/storage_skeleton.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ module DATA = struct
190190
u "DATA.MIRROR.is_mirror_failed"
191191

192192
let list ctx ~dbg = u "DATA.MIRROR.list"
193+
194+
let stat ctx ~dbg ~id = u "DATA.MIRROR.stat"
193195
end
194196
end
195197

ocaml/xapi-storage-script/main.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,6 +1930,7 @@ let bind ~volume_script_dir =
19301930
S.DATA.MIRROR.pre_deactivate_hook (u "DATA.MIRROR.pre_deactivate_hook") ;
19311931
S.DATA.MIRROR.is_mirror_failed (u "DATA.MIRROR.is_mirror_failed") ;
19321932
S.DATA.MIRROR.list (u "DATA.MIRROR.list") ;
1933+
S.DATA.MIRROR.stat (u "DATA.MIRROR.stat") ;
19331934
S.DP.create (u "DP.create") ;
19341935
S.TASK.cancel (u "TASK.cancel") ;
19351936
S.TASK.list (u "TASK.list") ;

ocaml/xapi/storage_access.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ let update_task ~__context id =
446446
let update_mirror ~__context id =
447447
try
448448
let dbg = Context.string_of_task __context in
449-
let m = Storage_migrate.stat ~dbg ~id in
449+
let m = Client.DATA.MIRROR.stat dbg id in
450450
if m.Mirror.failed then
451451
debug "Mirror %s has failed" id ;
452452
let task = get_mirror_task id in

ocaml/xapi/storage_mux.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,11 @@ module Mux = struct
868868
with_dbg ~name:"DATA.MIRROR.list" ~dbg @@ fun di ->
869869
info "%s dbg: %s" __FUNCTION__ dbg ;
870870
Storage_migrate.list ~dbg:di.log
871+
872+
let stat () ~dbg ~id =
873+
with_dbg ~name:"DATA.MIRROR.stat" ~dbg @@ fun di ->
874+
info "%s dbg: %s mirror_id: %s" __FUNCTION__ di.log id ;
875+
Storage_migrate.stat ~dbg:di.log ~id
871876
end
872877
end
873878

ocaml/xapi/storage_smapiv1.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,8 @@ module SMAPIv1 : Server_impl = struct
11631163
let is_mirror_failed _context ~dbg:_ ~mirror_id:_ ~sr:_ = assert false
11641164

11651165
let list _context ~dbg:_ = assert false
1166+
1167+
let stat _context ~dbg:_ ~id:_ = assert false
11661168
end
11671169
end
11681170

ocaml/xapi/storage_smapiv1_migrate.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,4 +827,6 @@ module MIRROR : SMAPIv2_MIRROR = struct
827827
false
828828

829829
let list _ctx = u __FUNCTION__
830+
831+
let stat _ctx = u __FUNCTION__
830832
end

ocaml/xapi/storage_smapiv1_wrapper.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,8 @@ functor
12261226
let is_mirror_failed _context ~dbg:_ ~mirror_id:_ ~sr:_ = u __FUNCTION__
12271227

12281228
let list _context ~dbg:_ = u __FUNCTION__
1229+
1230+
let stat _context ~dbg:_ ~id:_ = u __FUNCTION__
12291231
end
12301232
end
12311233

ocaml/xapi/storage_smapiv3_migrate.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,6 @@ module MIRROR : SMAPIv2_MIRROR = struct
4444
let pre_deactivate_hook _ctx = u __FUNCTION__
4545

4646
let list _ctx = u __FUNCTION__
47+
48+
let stat _ctx = u __FUNCTION__
4749
end

ocaml/xapi/xapi_vm_migrate.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ let vdi_copy_fun __context dbg vdi_map remote is_intra_pool remote_vdis so_far
10771077
(None, vdi.vdi)
10781078
) else
10791079
let mirrorid = task_result |> mirror_of_task dbg in
1080-
let m = Storage_migrate.stat ~dbg ~id:mirrorid in
1080+
let m = SMAPI.DATA.MIRROR.stat dbg mirrorid in
10811081
(Some mirrorid, m.Mirror.dest_vdi)
10821082
in
10831083
so_far := Int64.add !so_far vconf.size ;
@@ -1106,7 +1106,7 @@ let vdi_copy_fun __context dbg vdi_map remote is_intra_pool remote_vdis so_far
11061106
match mirror_id with
11071107
| Some mid ->
11081108
ignore (Storage_access.unregister_mirror mid) ;
1109-
let m = Storage_migrate.stat ~dbg ~id:mid in
1109+
let m = SMAPI.DATA.MIRROR.stat dbg mid in
11101110
(try Storage_migrate.stop ~dbg ~id:mid with _ -> ()) ;
11111111
m.Mirror.failed
11121112
| None ->

0 commit comments

Comments
 (0)