Merge pull request #245 from vatesfr/pierre-cpu-weight-in-resource-set

vm.set(): only admins can change cpuWeight if VM in a resource set
This commit is contained in:
Julien Fontanet 2016-02-26 12:29:31 +01:00
commit 0e4a6fd2e1

View File

@ -478,6 +478,8 @@ set = $coroutine (params) ->
yield xapi.call 'VM.remove_from_other_config', ref, 'auto_poweron' yield xapi.call 'VM.remove_from_other_config', ref, 'auto_poweron'
if 'cpuWeight' of params if 'cpuWeight' of params
if resourceSet? and this.user.permission isnt 'admin'
throw new Unauthorized()
yield xapi.setVcpuWeight(VM._xapiId, params.cpuWeight) yield xapi.setVcpuWeight(VM._xapiId, params.cpuWeight)
# Other fields. # Other fields.