Skip to content

Commit a2cb3fb

Browse files
committed
CA-95722:Prevent migration of VM's onto hosts that are in maintenance mode.
Signed-off-by: Akshay Ramani <[email protected]>
1 parent 9820837 commit a2cb3fb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ocaml/xapi/xapi_vm_migrate.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,10 @@ let assert_can_migrate ~__context ~vm ~dest ~live ~vdi_map ~vif_map ~options =
701701
~host_from:(Helpers.LocalObject source_host_ref)
702702
~host_to:(Helpers.RemoteObject (remote_rpc, session_id, dest_host_ref));
703703

704+
(*Check that the remote host is enabled and not in maintenance mode*)
705+
let check_host_enabled = XenAPI.Host.get_enabled remote_rpc session_id (dest_host_ref) in
706+
if not check_host_enabled then raise (Api_errors.Server_error (Api_errors.host_disabled,[dest_host]));
707+
704708
(* Ignore vdi_map for now since we won't be doing any mirroring. *)
705709
try inter_pool_metadata_transfer ~__context ~remote_rpc ~session_id ~remote_address ~vm ~vdi_map:[] ~vif_map ~dry_run:true ~live:true
706710
with Xmlrpc_client.Connection_reset ->

0 commit comments

Comments
 (0)