Merge pull request #188 from vatesfr/olivierlambert-cpu-weight
Ability to set vCPU weight
This commit is contained in:
commit
c03a0e857e
@ -325,6 +325,9 @@ set = $coroutine (params) ->
|
||||
else
|
||||
yield xapi.call 'VM.remove_from_other_config', ref, 'auto_poweron'
|
||||
|
||||
if 'cpuWeight' of params
|
||||
yield xapi.setVcpuWeight(vm._xapiId, params.cpuWeight)
|
||||
|
||||
# Other fields.
|
||||
for param, fields of {
|
||||
'name_label'
|
||||
@ -362,6 +365,8 @@ set.params = {
|
||||
|
||||
# Kernel arguments for PV VM.
|
||||
PV_args: { type: 'string', optional: true }
|
||||
|
||||
cpuWeight: { type: 'integer', optional: true}
|
||||
}
|
||||
|
||||
set.resolve = {
|
||||
|
@ -308,6 +308,10 @@ const TRANSFORMS = {
|
||||
}
|
||||
}
|
||||
|
||||
if (obj.VCPUs_params && obj.VCPUs_params.weight) {
|
||||
vm.cpuWeight = obj.VCPUs_params.weight
|
||||
}
|
||||
|
||||
if (!isHvm) {
|
||||
vm.PV_args = obj.PV_args
|
||||
}
|
||||
|
@ -1657,6 +1657,11 @@ export default class Xapi extends XapiBase {
|
||||
)
|
||||
}
|
||||
|
||||
async setVcpuWeight (vmId, weight) {
|
||||
const vm = this.getObject(vmId)
|
||||
await this._updateObjectMapProperty(vm, 'VCPUs_params', {weight})
|
||||
}
|
||||
|
||||
_startVm (vm) {
|
||||
debug(`Starting VM ${vm.name_label}`)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user