mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: process: refactor and rename qemuValidateCpuMax to qemuValidateCpuCount
Next patch will add minimum checking, so use a more generic name. Refactor return values to the commonly used semantics.
This commit is contained in:
parent
99f8fb4c55
commit
adca15cf15
@ -3891,22 +3891,19 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static int
|
||||||
qemuValidateCpuMax(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
|
qemuValidateCpuCount(virDomainDefPtr def,
|
||||||
|
virQEMUCapsPtr qemuCaps)
|
||||||
{
|
{
|
||||||
unsigned int maxCpus;
|
unsigned int maxCpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, def->os.machine);
|
||||||
|
|
||||||
maxCpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, def->os.machine);
|
if (maxCpus > 0 && virDomainDefGetVcpusMax(def) > maxCpus) {
|
||||||
if (!maxCpus)
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
return true;
|
_("Maximum CPUs greater than specified machine type limit"));
|
||||||
|
return -1;
|
||||||
if (virDomainDefGetVcpusMax(def) > maxCpus) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
||||||
"%s", _("Maximum CPUs greater than specified machine type limit"));
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4697,7 +4694,7 @@ qemuProcessLaunch(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qemuValidateCpuMax(vm->def, priv->qemuCaps))
|
if (qemuValidateCpuCount(vm->def, priv->qemuCaps) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuAssignDeviceAliases(vm->def, priv->qemuCaps) < 0)
|
if (qemuAssignDeviceAliases(vm->def, priv->qemuCaps) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user