Merge pull request #268 from vatesfr/abhamonr-stats-with-halted-vm

Throw an error if a vm is halted and its stats are requested.
This commit is contained in:
Julien Fontanet 2016-03-25 17:37:27 +01:00
commit 60ba5fbc72

View File

@ -528,6 +528,11 @@ export default class XapiStats {
async getVmPoints (xapi, vmId, granularity) {
const vm = xapi.getObject(vmId)
const host = vm.$resident_on
if (!host) {
throw new Error(`VM ${vmId} is halted or host could not be found.`)
}
return this._getAndUpdatePoints(xapi, host, vm.uuid, granularity)
}
}