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:
commit
60ba5fbc72
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user