Do not rely on VM metrics for memory when not running.

This commit is contained in:
Julien Fontanet 2013-12-19 15:02:52 +01:00
parent f637cab5ec
commit 1c98a05b4f

View File

@ -283,17 +283,22 @@ module.exports = (refsToUUIDs) ->
address: -> null # TODO
# TODO: `0` should not be used when the value is unknown.
memory: @dynamic {usage: null, size: null}, {
memory: @dynamic {
usage: null
size: get 'memory_dynamic_min'
}, {
VM_metrics: {
update: (metrics, UUID) ->
return if UUID isnt refsToUUIDs[@generator.metrics]
# Do not trust the metrics if the VM is not running.
{power_state: state} = @value
return unless state in ['Paused', 'Running']
@field.size = +metrics.memory_actual
}
}
memory_dynamic: get('memory_dynamic_min')
power_state: get('power_state')
# TODO: initialize this value with `VCPUs_at_startup`.