Skip to content

Commit

Permalink
Move clear_scheduled_to_be_resident_on
Browse files Browse the repository at this point in the history
Signed-off-by: John Else <john.else@citrix.com>
  • Loading branch information
johnelse committed Jul 8, 2016
1 parent 55cc448 commit e8ba337
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions ocaml/xapi/message_forwarding.ml
Expand Up @@ -797,6 +797,16 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct
~allowed:[`Running; `Paused];
do_op_on ~local_fn ~__context ~host:(Db.VM.get_resident_on ~__context ~self:vm) op

(* Clear scheduled_to_be_resident_on for a VM and all its vGPUs. *)
let clear_scheduled_to_be_resident_on ~__context ~vm =
Db.VM.set_scheduled_to_be_resident_on ~__context ~self:vm ~value:Ref.null;
List.iter
(fun vgpu ->
Db.VGPU.set_scheduled_to_be_resident_on ~__context
~self:vgpu
~value:Ref.null)
(Db.VM.get_VGPUs ~__context ~self:vm)

(* Notes on memory checking/reservation logic:
When computing the hosts free memory we consider all VMs resident_on (ie running
and consuming resources NOW) and scheduled_to_be_resident_on (ie those which are
Expand Down Expand Up @@ -854,16 +864,6 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct
choose_host_for_vm.
*)

(* Clear scheduled_to_be_resident_on for a VM and all its vGPUs. *)
let clear_scheduled_to_be_resident_on ~__context ~vm =
Db.VM.set_scheduled_to_be_resident_on ~__context ~self:vm ~value:Ref.null;
List.iter
(fun vgpu ->
Db.VGPU.set_scheduled_to_be_resident_on ~__context
~self:vgpu
~value:Ref.null)
(Db.VM.get_VGPUs ~__context ~self:vm)

(* Used by VM.start and VM.resume to choose a host with enough resource and to
'allocate_vm_to_host' (ie set the 'scheduled_to_be_resident_on' field) *)
let forward_to_suitable_host ~local_fn ~__context ~vm ~snapshot ?host_op op =
Expand Down

0 comments on commit e8ba337

Please sign in to comment.