Skip to content

Commit

Permalink
CA-380580: cross-pool migration: no CPU checks for halted VMs
Browse files Browse the repository at this point in the history
CPU checks are needed only for running VMs that are being migrated, to
check for compatibility with the remote-host's CPUs.

NOTE: This is the rebase of the initial work from 3d039f3
that had to be reverted with the fix from df7cbfd incorporated.

Signed-off-by: Rob Hoes <[email protected]>
  • Loading branch information
robhoes authored and last-genius committed Dec 12, 2024
1 parent 33b6315 commit b0f93fc
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ocaml/xapi/xapi_vm_migrate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,7 @@ let migrate_send' ~__context ~vm ~dest ~live:_ ~vdi_map ~vif_map ~vgpu_map
We look at the VDIs of the VM, the VDIs of all of the snapshots, and any
suspend-image VDIs. *)
let vm_uuid = Db.VM.get_uuid ~__context ~self:vm in
let power_state = Db.VM.get_power_state ~__context ~self:vm in
let vbds = Db.VM.get_VBDs ~__context ~self:vm in
let vifs = Db.VM.get_VIFs ~__context ~self:vm in
let snapshots = Db.VM.get_snapshots ~__context ~self:vm in
Expand Down Expand Up @@ -1249,17 +1250,18 @@ let migrate_send' ~__context ~vm ~dest ~live:_ ~vdi_map ~vif_map ~vgpu_map
in
let suspends_vdis =
List.fold_left
(fun acc vm ->
if Db.VM.get_power_state ~__context ~self:vm = `Suspended then
let vdi = Db.VM.get_suspend_VDI ~__context ~self:vm in
(fun acc vm_or_snapshot ->
if Db.VM.get_power_state ~__context ~self:vm_or_snapshot = `Suspended
then
let vdi = Db.VM.get_suspend_VDI ~__context ~self:vm_or_snapshot in
let sr = Db.VDI.get_SR ~__context ~self:vdi in
if
is_intra_pool
&& Helpers.host_has_pbd_for_sr ~__context ~host:remote.dest_host ~sr
then
acc
else
get_vdi_mirror __context vm vdi false :: acc
get_vdi_mirror __context vm_or_snapshot vdi false :: acc
else
acc
)
Expand Down Expand Up @@ -1466,7 +1468,7 @@ let migrate_send' ~__context ~vm ~dest ~live:_ ~vdi_map ~vif_map ~vgpu_map
in
inter_pool_metadata_transfer ~__context ~remote ~vm ~vdi_map
~vif_map ~vgpu_map ~dry_run:false ~live:true ~copy
~check_cpu:(not force)
~check_cpu:((not force) && power_state <> `Halted)
in
let vm = List.hd vms in
let () =
Expand Down Expand Up @@ -1863,7 +1865,7 @@ let assert_can_migrate ~__context ~vm ~dest ~live:_ ~vdi_map ~vif_map ~options
not
(inter_pool_metadata_transfer ~__context ~remote ~vm ~vdi_map
~vif_map ~vgpu_map ~dry_run:true ~live:true ~copy
~check_cpu:(not force)
~check_cpu:((not force) && power_state <> `Halted)
= []
)
then
Expand Down

0 comments on commit b0f93fc

Please sign in to comment.