add console in spec
This commit is contained in:
parent
4df7235b09
commit
1d9d1ca7dc
@ -78,10 +78,10 @@ module.exports = (refsToUUIDs) ->
|
|||||||
# No `update`: `exit` then `enter` will be called instead.
|
# No `update`: `exit` then `enter` will be called instead.
|
||||||
enter: (VM) ->
|
enter: (VM) ->
|
||||||
if VM.power_state in ['Paused', 'Running']
|
if VM.power_state in ['Paused', 'Running']
|
||||||
@field += parseInt(VM.CPUs.number)
|
@field += VM.CPUs.number
|
||||||
exit: (VM) ->
|
exit: (VM) ->
|
||||||
if VM.power_state in ['Paused', 'Running']
|
if VM.power_state in ['Paused', 'Running']
|
||||||
@field -= parseInt(VM.CPUs.number)
|
@field -= VM.CPUs.number
|
||||||
|
|
||||||
$memory: @dynamic { usage: 0, size: 0 },
|
$memory: @dynamic { usage: 0, size: 0 },
|
||||||
host_metrics:
|
host_metrics:
|
||||||
@ -279,12 +279,13 @@ module.exports = (refsToUUIDs) ->
|
|||||||
VM:
|
VM:
|
||||||
# No `update`: `exit` then `enter` will be called instead.
|
# No `update`: `exit` then `enter` will be called instead.
|
||||||
# TODO: fix problem with vCPU count
|
# TODO: fix problem with vCPU count
|
||||||
update: (VM) ->
|
enter: (VM) ->
|
||||||
if VM.power_state in ['Paused', 'Running']
|
if VM.power_state in ['Paused', 'Running']
|
||||||
@field = @field + parseInt(VM.CPUs.number)
|
@field += VM.CPUs.number
|
||||||
|
console.log @field
|
||||||
exit: (VM) ->
|
exit: (VM) ->
|
||||||
if VM.power_state in ['Paused', 'Running']
|
if VM.power_state in ['Paused', 'Running']
|
||||||
@field -= parseInt(VM.CPUs.number)
|
@field -= VM.CPUs.number
|
||||||
|
|
||||||
host_metrics:
|
host_metrics:
|
||||||
|
|
||||||
@ -325,6 +326,17 @@ module.exports = (refsToUUIDs) ->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
consoles: @dynamic [],
|
||||||
|
console: {
|
||||||
|
# TODO: handle updates and exits.
|
||||||
|
enter: (console, UUID) ->
|
||||||
|
found = do =>
|
||||||
|
for ref in @generator.consoles
|
||||||
|
return true if refsToUUIDs[ref] is UUID
|
||||||
|
false
|
||||||
|
@field.push console if found
|
||||||
|
}
|
||||||
|
|
||||||
# TODO: `0` should not be used when the value is unknown.
|
# TODO: `0` should not be used when the value is unknown.
|
||||||
memory: @dynamic {
|
memory: @dynamic {
|
||||||
usage: null
|
usage: null
|
||||||
@ -349,7 +361,7 @@ module.exports = (refsToUUIDs) ->
|
|||||||
# FIXME: use the RRDs to get this information.
|
# FIXME: use the RRDs to get this information.
|
||||||
|
|
||||||
CPUs: @dynamic {
|
CPUs: @dynamic {
|
||||||
number: get('VCPUs_at_startup')
|
number: number get('VCPUs_at_startup')
|
||||||
}, {
|
}, {
|
||||||
VM_metrics: {
|
VM_metrics: {
|
||||||
update: (metrics, UUID) ->
|
update: (metrics, UUID) ->
|
||||||
@ -377,6 +389,8 @@ module.exports = (refsToUUIDs) ->
|
|||||||
# TODO: removes it when hooks have access to the generator.
|
# TODO: removes it when hooks have access to the generator.
|
||||||
$pool: get '$pool'
|
$pool: get '$pool'
|
||||||
|
|
||||||
|
$snapshots: get ('snapshots')
|
||||||
|
|
||||||
$VBDs: @dynamic [], {
|
$VBDs: @dynamic [], {
|
||||||
VBD: {
|
VBD: {
|
||||||
update: (VBD, UUID) ->
|
update: (VBD, UUID) ->
|
||||||
@ -522,3 +536,10 @@ module.exports = (refsToUUIDs) ->
|
|||||||
VDI: get('VDI')
|
VDI: get('VDI')
|
||||||
|
|
||||||
VM: get('VM')
|
VM: get('VM')
|
||||||
|
|
||||||
|
console:
|
||||||
|
|
||||||
|
test: test
|
||||||
|
|
||||||
|
value: -> @generator
|
||||||
|
private: true
|
||||||
|
Loading…
Reference in New Issue
Block a user