Various fixes.
This commit is contained in:
parent
1de8f9a92a
commit
3a5c512a62
@ -176,6 +176,8 @@ class $MappedCollection
|
||||
|
||||
rule.value = def.value
|
||||
|
||||
rule.private = !!def.private
|
||||
|
||||
@_rules[name] = rule
|
||||
@_hooks[name] =
|
||||
enter: []
|
||||
|
@ -55,7 +55,12 @@ $handleJsonRpcCall = (api, session, encodedRequest) ->
|
||||
)
|
||||
|
||||
# Checks it is a compliant JSON-RPC 2.0 request.
|
||||
if not request.method or not request.params or request.id is undefined or request.jsonrpc isnt '2.0'
|
||||
if (
|
||||
not request.method? or
|
||||
not request.params? or
|
||||
not request.id? or
|
||||
request.jsonrpc isnt '2.0'
|
||||
)
|
||||
return formatError $API.err.INVALID_REQUEST
|
||||
|
||||
# Executes the requested method on the API.
|
||||
|
@ -61,8 +61,8 @@ module.exports = (refsToUUIDs) ->
|
||||
$CPUs: @dynamic 0,
|
||||
host:
|
||||
# No `update`: `exit` then `enter` will be called instead.
|
||||
enter: (host) -> @field += parseInt(host.CPUs["cpu_count"])
|
||||
exit: (host) -> @field -= parseInt(host.CPUs["cpu_count"])
|
||||
enter: (host) -> @field += +host.CPUs["cpu_count"]
|
||||
exit: (host) -> @field -= +host.CPUs["cpu_count"]
|
||||
|
||||
$running_VMs: @dynamic [],
|
||||
VM:
|
||||
@ -370,7 +370,7 @@ module.exports = (refsToUUIDs) ->
|
||||
{power_state: state} = @value
|
||||
return unless state in ['Paused', 'Running']
|
||||
|
||||
@field.number = metrics.VCPUs_number
|
||||
@field.number = +metrics.VCPUs_number
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,5 +543,6 @@ module.exports = (refsToUUIDs) ->
|
||||
|
||||
test: test
|
||||
|
||||
value: -> @generator
|
||||
private: true
|
||||
|
||||
value: -> @generator
|
||||
|
Loading…
Reference in New Issue
Block a user