From e8ba337c5c34c9b90c767493de1d37bf7895a402 Mon Sep 17 00:00:00 2001 From: John Else Date: Fri, 8 Jul 2016 18:15:30 +0100 Subject: [PATCH] Move clear_scheduled_to_be_resident_on Signed-off-by: John Else --- ocaml/xapi/message_forwarding.ml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ocaml/xapi/message_forwarding.ml b/ocaml/xapi/message_forwarding.ml index e5d24911c7..1bb3db3193 100644 --- a/ocaml/xapi/message_forwarding.ml +++ b/ocaml/xapi/message_forwarding.ml @@ -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 @@ -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 =