Skip to content

Commit a465056

Browse files
committed
CA-419227 Move force_state_reset after refresh_vm
In the case of cross pool SXM, the running VM will be created on destination host with initial halted state. The state shall be changed by refresh_vm. The function force_state_reset before it will incorrectly clear some vm config. Move force_state_reset after refresh_vm fater refresh_vm in pool_migrate_complete to solve it. Signed-off-by: Changlei Li <changlei.li@cloud.com>
1 parent d4c99a8 commit a465056

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ocaml/xapi/xapi_vm_migrate.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -489,18 +489,18 @@ let pool_migrate_complete ~__context ~vm ~host:_ =
489489
~value:`restart_device_model ;
490490
let dbg = Context.string_of_task __context in
491491
let queue_name = Xapi_xenops_queue.queue_of_vm ~__context ~self:vm in
492-
(* Reset the state, which will update allowed operations, clear reservations
493-
for halted VMs, disconnect devices *)
494-
let power_state = Db.VM.get_power_state ~__context ~self:vm in
495-
Xapi_vm_lifecycle.force_state_reset_keep_current_operations ~__context
496-
~self:vm ~value:power_state ;
497492
if Xapi_xenops.vm_exists_in_xenopsd queue_name dbg id then (
498493
remove_stale_pcis ~__context ~vm ;
499494
Xapi_xenops.set_resident_on ~__context ~self:vm ;
500495
Xapi_xenops.add_caches id ;
501496
Xapi_xenops.refresh_vm ~__context ~self:vm ;
502497
Monitor_dbcalls_cache.clear_cache_for_vm ~vm_uuid:id
503498
) ;
499+
(* Reset the state, which will update allowed operations, clear reservations
500+
for halted VMs, disconnect devices *)
501+
let power_state = Db.VM.get_power_state ~__context ~self:vm in
502+
Xapi_vm_lifecycle.force_state_reset_keep_current_operations ~__context
503+
~self:vm ~value:power_state ;
504504
Xapi_vm_group_helpers.maybe_update_vm_anti_affinity_alert_for_vm ~__context
505505
~vm
506506

0 commit comments

Comments
 (0)