From 3d37260d5cc9832b5d8e225cccb04f77bc85db12 Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Thu, 19 Dec 2013 14:05:16 +0100 Subject: [PATCH] Halted VMs are now available from their pool. --- src/spec.coffee | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/spec.coffee b/src/spec.coffee index 4dff6700c..aeb5bea71 100644 --- a/src/spec.coffee +++ b/src/spec.coffee @@ -135,13 +135,14 @@ module.exports = (refsToUUIDs) -> update: (VM) -> # Unless this VM belongs to this pool, there is no need # to continue. - return unless VM.$connectionId is @value.UUID + return unless VM.$pool is @value.UUID + + remove @field, VM.UUID # If this VM is running or paused, it is necessarily on # a host. - if state is 'Paused' or state is 'Runnning' - remove @field, VM.UUID - return + state = VM.power_state + return if state is 'Paused' or state is 'Running' # TODO: Check whether this VM belong to a local SR. local = false @@ -298,6 +299,9 @@ module.exports = (refsToUUIDs) -> # VM is not on a host. $container: get('resident_on') + # TODO: removes it when hooks have access to the generator. + $pool: get '$pool' + $VBDs: @dynamic [], { VBD: { update: (VBD, UUID) ->