conf: Provide error on undefined vcpusched entry

Modify virDomainDefGetVcpuSched to emit an error message if
virDomainDefGetVcpu returns NULL meaning the vcpu could not
be found. Prior to commit id '9cc931f0b' the error message
would have been issued in virDomainDefGetVcpu.
This commit is contained in:
John Ferlan 2016-08-15 10:37:34 -04:00
parent f0551b9bc4
commit 4b15fd0d1f
1 changed files with 5 additions and 1 deletions

View File

@ -1480,8 +1480,12 @@ virDomainDefGetVcpuSched(virDomainDefPtr def,
{
virDomainVcpuDefPtr vcpuinfo;
if (!(vcpuinfo = virDomainDefGetVcpu(def, vcpu)))
if (!(vcpuinfo = virDomainDefGetVcpu(def, vcpu))) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("vCPU '%u' is not present in domain definition"),
vcpu);
return NULL;
}
return &vcpuinfo->sched;
}