Host object updated & minor fix in the collection mapper.
This commit is contained in:
parent
23311c0235
commit
54dc3e5a71
@ -50,7 +50,7 @@ http:
|
||||
|
||||
# List of files/directories which will be served.
|
||||
mounts:
|
||||
'/': './public/http/'
|
||||
#'/': '/path/to/xo-web/dist/'
|
||||
|
||||
# Connection to the Redis server.
|
||||
redis:
|
||||
|
@ -51,7 +51,8 @@ $setDeep = (obj, path, value) ->
|
||||
# @param rule Rule of the current item.
|
||||
# @param item Current item.
|
||||
# @param value Value of the generator item.
|
||||
$computeValue = (rule, item, value) ->
|
||||
$computeValue = (rule, item) ->
|
||||
value = item.generator
|
||||
|
||||
# @param parent The parent object of this entry (necessary for
|
||||
# assignment).
|
||||
@ -219,7 +220,7 @@ class $MappedCollection
|
||||
(value, key) ->
|
||||
# The current hook is runs for all items of the
|
||||
# current rule.
|
||||
for key, item of items
|
||||
for _, item of items
|
||||
# Value of the current field.
|
||||
field = $getDeep item.value, path
|
||||
|
||||
@ -329,7 +330,8 @@ class $MappedCollection
|
||||
rule = @_rules[item._ruleName]
|
||||
|
||||
# Compute the new value.
|
||||
$computeValue rule, item, value
|
||||
item.generator = value
|
||||
$computeValue rule, item
|
||||
|
||||
# Runs related hooks.
|
||||
for hook in @_hooks[rule.name]?.update or []
|
||||
@ -349,9 +351,10 @@ class $MappedCollection
|
||||
_ruleName: rule.name
|
||||
key: key
|
||||
value: undefined
|
||||
generator: value
|
||||
|
||||
# Computes the value.
|
||||
$computeValue rule, item, value
|
||||
$computeValue rule, item
|
||||
|
||||
# Runs related hooks.
|
||||
for hook in @_hooks[rule.name]?.enter or []
|
||||
|
@ -30,7 +30,7 @@ module.exports = (refsToUUIDs) ->
|
||||
helper value
|
||||
|
||||
->
|
||||
key: (value, key) -> value.uuid or key
|
||||
key: (value, key) -> value.uuid ? key
|
||||
|
||||
rules:
|
||||
|
||||
@ -199,10 +199,14 @@ module.exports = (refsToUUIDs) ->
|
||||
|
||||
iSCSI_name: (value) -> value.other_config?.iscsi_iqn
|
||||
|
||||
memory: { # TODO
|
||||
usage: 0
|
||||
size: 0
|
||||
}
|
||||
memory: @dynamic {usage: 0, size: 0},
|
||||
host_metrics:
|
||||
update: (metrics, UUID) ->
|
||||
metrics_UUID = refsToUUIDs[@generator.metrics]
|
||||
return if UUID isnt metrics_UUID
|
||||
{memory_free, memory_total} = metrics
|
||||
@field.usage = memory_total - memory_free
|
||||
@field.size = memory_total
|
||||
|
||||
power_state: 'Running' # TODO
|
||||
|
||||
@ -219,6 +223,15 @@ module.exports = (refsToUUIDs) ->
|
||||
|
||||
$vCPUs: []
|
||||
|
||||
host_metrics:
|
||||
|
||||
test: test
|
||||
|
||||
# Internal object, not exposed.
|
||||
private: true
|
||||
|
||||
value: -> @generator
|
||||
|
||||
VM:
|
||||
|
||||
test: (value) ->
|
||||
@ -334,8 +347,12 @@ module.exports = (refsToUUIDs) ->
|
||||
|
||||
size: get('virtual_size')
|
||||
|
||||
# FIXME: don't know if the good way to do
|
||||
snapshot: get('is_a_snapshot')
|
||||
snapshot_of: get('snapshot_of')
|
||||
|
||||
snapshots: get('snapshots')
|
||||
|
||||
# TODO: Is the name fit?
|
||||
#snapshot_time: get('snapshot_time')
|
||||
|
||||
# FIXME: SR.VDIs -> VDI instead of VDI.SR -> SR.
|
||||
SR: get('SR')
|
||||
|
@ -16,7 +16,7 @@ $_ = require 'underscore'
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
# Helpers for dealing with fibers.
|
||||
{$sleep, $synchronize} = require './fibers-utils'
|
||||
{$synchronize} = require './fibers-utils'
|
||||
|
||||
#=====================================================================
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user