Skip to content

Commit

Permalink
Merge pull request #2727 from zli/CA-218221
Browse files Browse the repository at this point in the history
CA-218221: make sure SXM destination VDI has the same size as the source
  • Loading branch information
lindig authored Aug 12, 2016
2 parents 8ad77ec + 33f0e84 commit 8f47a36
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions ocaml/xapi/storage_migrate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,12 @@ let receive_start ~dbg ~sr ~vdi_info ~id ~similar =
| Some vdi ->
debug "Cloning VDI %s" vdi.vdi;
let vdi = add_to_sm_config vdi "base_mirror" id in
Local.VDI.clone ~dbg ~sr ~vdi_info:vdi
let vdi_clone = Local.VDI.clone ~dbg ~sr ~vdi_info:vdi in
if vdi_clone.virtual_size <> vdi_info.virtual_size then begin
let new_size = Local.VDI.resize ~dbg ~sr ~vdi:vdi_clone.vdi ~new_size:vdi_info.virtual_size in
debug "Resize local VDI %s to %Ld: result %Ld" vdi_clone.vdi vdi_info.virtual_size new_size;
end;
vdi_clone
| None ->
debug "Creating a blank remote VDI";
Local.VDI.create ~dbg ~sr ~vdi_info
Expand Down Expand Up @@ -826,7 +831,12 @@ let copy ~task ~dbg ~sr ~vdi ~dp ~url ~dest =
let remote_base = match nearest with
| Some vdi ->
debug "Cloning VDI %s" vdi.vdi;
Remote.VDI.clone ~dbg ~sr:dest ~vdi_info:vdi
let vdi_clone = Remote.VDI.clone ~dbg ~sr:dest ~vdi_info:vdi in
if vdi_clone.virtual_size <> local_vdi.virtual_size then begin
let new_size = Remote.VDI.resize ~dbg ~sr:dest ~vdi:vdi_clone.vdi ~new_size:local_vdi.virtual_size in
debug "Resize remote VDI %s to %Ld: result %Ld" vdi_clone.vdi local_vdi.virtual_size new_size;
end;
vdi_clone
| None ->
debug "Creating a blank remote VDI";
Remote.VDI.create ~dbg ~sr:dest ~vdi_info:{ local_vdi with sm_config = [] } in
Expand Down

0 comments on commit 8f47a36

Please sign in to comment.