mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: Don't report errors from virDomainDefGetVcpu
Most callers make sure that it's never called with an out of range vCPU. Every other caller reports a different error explicitly. Drop the error reporting and clean up some dead code paths.
This commit is contained in:
parent
c7d5dd3974
commit
9cc931f0bb
@ -1427,12 +1427,8 @@ virDomainVcpuDefPtr
|
||||
virDomainDefGetVcpu(virDomainDefPtr def,
|
||||
unsigned int vcpu)
|
||||
{
|
||||
if (vcpu >= def->maxvcpus) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("vCPU '%u' is not present in domain definition"),
|
||||
vcpu);
|
||||
if (vcpu >= def->maxvcpus)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &def->vcpus[vcpu];
|
||||
}
|
||||
|
@ -4606,14 +4606,11 @@ qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver,
|
||||
unsigned int vcpu)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virDomainVcpuDefPtr vcpuinfo;
|
||||
virDomainVcpuDefPtr vcpuinfo = virDomainDefGetVcpu(vm->def, vcpu);
|
||||
int ret = -1;
|
||||
int rc;
|
||||
int oldvcpus = virDomainDefGetVcpus(vm->def);
|
||||
|
||||
if (!(vcpuinfo = virDomainDefGetVcpu(vm->def, vcpu)))
|
||||
return -1;
|
||||
|
||||
if (vcpuinfo->online) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("vCPU '%u' is already online"), vcpu);
|
||||
@ -4658,14 +4655,11 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver,
|
||||
unsigned int vcpu)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virDomainVcpuDefPtr vcpuinfo;
|
||||
virDomainVcpuDefPtr vcpuinfo = virDomainDefGetVcpu(vm->def, vcpu);
|
||||
int ret = -1;
|
||||
int rc;
|
||||
int oldvcpus = virDomainDefGetVcpus(vm->def);
|
||||
|
||||
if (!(vcpuinfo = virDomainDefGetVcpu(vm->def, vcpu)))
|
||||
return -1;
|
||||
|
||||
if (!vcpuinfo->online) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("vCPU '%u' is already offline"), vcpu);
|
||||
|
Loading…
Reference in New Issue
Block a user