Skip to content

Commit 84b096a

Browse files
committed
CA-408492: Add back receive_start2 for backwards compat
This function was introduced during the development of inbound SXM for SMAPIv3, but was used in SMAPIv1 migrations as well as SMAPIv1 -> SMAPIv3 migration, so add this back to SMAPIv2 for backwards compatibility. Migrations from xapi-(25.3.0 -- 25.17.0) would otherwise be broken if they were migrating to the latest version of xapi. Yangtze, however, is not affected. Signed-off-by: Vincent Liu <[email protected]>
1 parent 377e923 commit 84b096a

8 files changed

+71
-0
lines changed

ocaml/xapi-idl/storage/storage_interface.ml

+31
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,24 @@ module StorageAPI (R : RPC) = struct
11241124
@-> returning result err
11251125
)
11261126

1127+
(** Called on the receiving end
1128+
@deprecated This function is deprecated, and is only here to keep backward
1129+
compatibility with old xapis that call Remote.DATA.MIRROR.receive_start2 during SXM.
1130+
Use the receive_start3 function instead.
1131+
*)
1132+
let receive_start2 =
1133+
let similar_p = Param.mk ~name:"similar" Mirror.similars in
1134+
let result = Param.mk ~name:"result" Mirror.mirror_receive_result in
1135+
declare "DATA.MIRROR.receive_start2" []
1136+
(dbg_p
1137+
@-> sr_p
1138+
@-> VDI.vdi_info_p
1139+
@-> id_p
1140+
@-> similar_p
1141+
@-> vm_p
1142+
@-> returning result err
1143+
)
1144+
11271145
(** Called on the receiving end to prepare for receipt of the storage. This
11281146
function should be used in conjunction with [receive_finalize2]*)
11291147
let receive_start3 =
@@ -1274,6 +1292,16 @@ module type MIRROR = sig
12741292
-> similar:Mirror.similars
12751293
-> Mirror.mirror_receive_result
12761294

1295+
val receive_start2 :
1296+
context
1297+
-> dbg:debug_info
1298+
-> sr:sr
1299+
-> vdi_info:vdi_info
1300+
-> id:Mirror.id
1301+
-> similar:Mirror.similars
1302+
-> vm:vm
1303+
-> Mirror.mirror_receive_result
1304+
12771305
val receive_start3 :
12781306
context
12791307
-> dbg:debug_info
@@ -1772,6 +1800,9 @@ module Server (Impl : Server_impl) () = struct
17721800
S.DATA.MIRROR.receive_start (fun dbg sr vdi_info id similar ->
17731801
Impl.DATA.MIRROR.receive_start () ~dbg ~sr ~vdi_info ~id ~similar
17741802
) ;
1803+
S.DATA.MIRROR.receive_start2 (fun dbg sr vdi_info id similar vm ->
1804+
Impl.DATA.MIRROR.receive_start2 () ~dbg ~sr ~vdi_info ~id ~similar ~vm
1805+
) ;
17751806
S.DATA.MIRROR.receive_start3
17761807
(fun dbg sr vdi_info mirror_id similar vm url verify_dest ->
17771808
Impl.DATA.MIRROR.receive_start3 () ~dbg ~sr ~vdi_info ~mirror_id

ocaml/xapi-idl/storage/storage_skeleton.ml

+3
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ module DATA = struct
169169
let receive_start ctx ~dbg ~sr ~vdi_info ~id ~similar =
170170
u "DATA.MIRROR.receive_start"
171171

172+
let receive_start2 ctx ~dbg ~sr ~vdi_info ~id ~similar ~vm =
173+
u "DATA.MIRROR.receive_start2"
174+
172175
let receive_start3 ctx ~dbg ~sr ~vdi_info ~mirror_id ~similar ~vm ~url
173176
~verify_dest =
174177
u "DATA.MIRROR.receive_start3"

ocaml/xapi-storage-script/main.ml

+1
Original file line numberDiff line numberDiff line change
@@ -1922,6 +1922,7 @@ let bind ~volume_script_dir =
19221922
S.DP.stat_vdi (u "DP.stat_vdi") ;
19231923
S.DATA.MIRROR.send_start (u "DATA.MIRROR.send_start") ;
19241924
S.DATA.MIRROR.receive_start (u "DATA.MIRROR.receive_start") ;
1925+
S.DATA.MIRROR.receive_start2 (u "DATA.MIRROR.receive_start2") ;
19251926
S.DATA.MIRROR.receive_start3 (u "DATA.MIRROR.receive_start3") ;
19261927
S.DATA.MIRROR.receive_finalize (u "DATA.MIRROR.receive_finalize") ;
19271928
S.DATA.MIRROR.receive_finalize2 (u "DATA.MIRROR.receive_finalize2") ;

ocaml/xapi/storage_mux.ml

+14
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,20 @@ module Mux = struct
837837
Storage_smapiv1_migrate.MIRROR.receive_start () ~dbg ~sr ~vdi_info ~id
838838
~similar
839839

840+
let receive_start2 () ~dbg ~sr ~vdi_info ~id ~similar ~vm =
841+
with_dbg ~name:"DATA.MIRROR.receive_start2" ~dbg @@ fun _di ->
842+
info "%s dbg: %s sr: %s vdi_info: %s mirror_id: %s similar: %s vm: %s"
843+
__FUNCTION__ dbg (s_of_sr sr)
844+
(string_of_vdi_info vdi_info)
845+
id
846+
(String.concat ";" similar)
847+
(s_of_vm vm) ;
848+
info "%s dbg:%s" __FUNCTION__ dbg ;
849+
(* This goes straight to storage_smapiv1_migrate for backwards compatability
850+
reasons, new code should not call receive_start any more *)
851+
Storage_smapiv1_migrate.MIRROR.receive_start2 () ~dbg ~sr ~vdi_info ~id
852+
~similar ~vm
853+
840854
(** see storage_smapiv{1,3}_migrate.receive_start3 *)
841855
let receive_start3 () ~dbg:_ ~sr:_ ~vdi_info:_ ~mirror_id:_ ~similar:_
842856
~vm:_ =

ocaml/xapi/storage_smapiv1.ml

+4
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,10 @@ module SMAPIv1 : Server_impl = struct
11431143
let receive_start _context ~dbg:_ ~sr:_ ~vdi_info:_ ~id:_ ~similar:_ =
11441144
assert false
11451145

1146+
let receive_start2 _context ~dbg:_ ~sr:_ ~vdi_info:_ ~id:_ ~similar:_
1147+
~vm:_ =
1148+
assert false
1149+
11461150
let receive_start3 _context ~dbg:_ ~sr:_ ~vdi_info:_ ~mirror_id:_
11471151
~similar:_ ~vm:_ ~url:_ ~verify_dest:_ =
11481152
assert false

ocaml/xapi/storage_smapiv1_migrate.ml

+6
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,12 @@ module MIRROR : SMAPIv2_MIRROR = struct
724724
receive_start_common ~dbg ~sr ~vdi_info ~id ~similar ~vm:(Vm.of_string "0")
725725
(module Local)
726726

727+
let receive_start2 _ctx ~dbg ~sr ~vdi_info ~id ~similar ~vm =
728+
D.debug "%s dbg: %s sr: %s vdi: %s id: %s" __FUNCTION__ dbg (s_of_sr sr)
729+
(string_of_vdi_info vdi_info)
730+
id ;
731+
receive_start_common ~dbg ~sr ~vdi_info ~id ~similar ~vm (module Local)
732+
727733
let receive_start3 _ctx ~dbg ~sr ~vdi_info ~mirror_id ~similar ~vm ~url
728734
~verify_dest =
729735
D.debug "%s dbg: %s sr: %s vdi: %s id: %s vm: %s url: %s verify_dest: %B"

ocaml/xapi/storage_smapiv1_wrapper.ml

+10
Original file line numberDiff line numberDiff line change
@@ -1200,8 +1200,18 @@ functor
12001200
(String.concat "," similar) ;
12011201
Impl.DATA.MIRROR.receive_start context ~dbg ~sr ~vdi_info ~id ~similar
12021202

1203+
let receive_start2 context ~dbg ~sr ~vdi_info ~id ~similar ~vm =
1204+
info
1205+
"DATA.MIRROR.receive_start2 dbg:%s sr:%s id:%s similar:[%s] vm:%s"
1206+
dbg (s_of_sr sr) id
1207+
(String.concat "," similar)
1208+
(s_of_vm vm) ;
1209+
Impl.DATA.MIRROR.receive_start2 context ~dbg ~sr ~vdi_info ~id
1210+
~similar ~vm
1211+
12031212
let receive_start3 _context ~dbg:_ ~sr:_ ~vdi_info:_ ~mirror_id:_
12041213
~similar:_ ~vm:_ =
1214+
(* See Storage_smapiv1_migrate.receive_start3 *)
12051215
u __FUNCTION__
12061216

12071217
let receive_finalize context ~dbg ~id =

ocaml/xapi/storage_smapiv3_migrate.ml

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ module MIRROR : SMAPIv2_MIRROR = struct
2929

3030
let receive_start _ctx = u __FUNCTION__
3131

32+
let receive_start2 _ctx = u __FUNCTION__
33+
3234
let receive_start3 _ctx = u __FUNCTION__
3335

3436
let receive_finalize _ctx = u __FUNCTION__

0 commit comments

Comments
 (0)