Skip to content

Commit 78e3fdb

Browse files
committed
fixup! Allow selection of image format during VM migration
1 parent 47e0bb9 commit 78e3fdb

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

ocaml/xapi/storage_migrate.ml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -724,13 +724,12 @@ module MigrateLocal = struct
724724
let start ~task ~dbg ~sr ~vdi ~image_format ~dp ~mirror_vm ~copy_vm ~url ~dest
725725
~verify_dest =
726726
SXM.info
727-
"%s sr:%s vdi:%s image_format: %s dp: %s mirror_vm: %s copy_vm: %s url:%s dest:%s \
728-
verify_dest:%B"
727+
"%s sr:%s vdi:%s image_format: %s dp: %s mirror_vm: %s copy_vm: %s \
728+
url:%s dest:%s verify_dest:%B"
729729
__FUNCTION__
730730
(Storage_interface.Sr.string_of sr)
731731
(Storage_interface.Vdi.string_of vdi)
732-
image_format
733-
dp
732+
image_format dp
734733
(Storage_interface.Vm.string_of mirror_vm)
735734
(Storage_interface.Vm.string_of copy_vm)
736735
url
@@ -871,7 +870,13 @@ module MigrateLocal = struct
871870

872871
let local_vdi = add_to_sm_config local_vdi "mirror" ("nbd:" ^ dp) in
873872
let local_vdi = add_to_sm_config local_vdi "base_mirror" mirror_id in
874-
let local_vdi = add_to_sm_config local_vdi "image-format" image_format in
873+
let local_vdi =
874+
match image_format with
875+
| "" ->
876+
local_vdi
877+
| fmt ->
878+
add_to_sm_config local_vdi "image-format" fmt
879+
in
875880
SXM.info "%s About to snapshot VDI = %s" __FUNCTION__
876881
(string_of_vdi_info local_vdi) ;
877882
let snapshot =
@@ -1131,7 +1136,14 @@ module MigrateRemote = struct
11311136
let vdis = List.filter (fun vdi -> vdi.ty <> "cbt_metadata") vdis in
11321137
let leaf_dp = Local.DP.create dbg Uuidx.(to_string (make ())) in
11331138
try
1134-
let vdi_info = {vdi_info with sm_config= [("base_mirror", id)]} in
1139+
let vdi_info = add_to_sm_config vdi_info "base_mirror" id in
1140+
let vdi_info =
1141+
match image_format with
1142+
| "" ->
1143+
vdi_info
1144+
| fmt ->
1145+
add_to_sm_config vdi_info "image-format" fmt
1146+
in
11351147
let leaf = Local.VDI.create dbg sr vdi_info in
11361148
info "Created leaf VDI for mirror receive: %s" (string_of_vdi_info leaf) ;
11371149
on_fail := (fun () -> Local.VDI.destroy dbg sr leaf.vdi) :: !on_fail ;

0 commit comments

Comments
 (0)