Do not rely on VM metrics for memory when not running.
This commit is contained in:
parent
f637cab5ec
commit
1c98a05b4f
@ -283,17 +283,22 @@ module.exports = (refsToUUIDs) ->
|
|||||||
address: -> null # TODO
|
address: -> null # TODO
|
||||||
|
|
||||||
# TODO: `0` should not be used when the value is unknown.
|
# 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: {
|
VM_metrics: {
|
||||||
update: (metrics, UUID) ->
|
update: (metrics, UUID) ->
|
||||||
return if UUID isnt refsToUUIDs[@generator.metrics]
|
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
|
@field.size = +metrics.memory_actual
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memory_dynamic: get('memory_dynamic_min')
|
|
||||||
|
|
||||||
power_state: get('power_state')
|
power_state: get('power_state')
|
||||||
|
|
||||||
# TODO: initialize this value with `VCPUs_at_startup`.
|
# TODO: initialize this value with `VCPUs_at_startup`.
|
||||||
|
Loading…
Reference in New Issue
Block a user