Next patch will add minimum checking, so use a more generic name. Refactor return values to the commonly used semantics. --- src/qemu/qemu_process.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index f083f3f..be0567a 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3861,22 +3861,19 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver, } -static bool -qemuValidateCpuMax(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) +static int +qemuValidateCpuCount(virDomainDefPtr def, + virQEMUCapsPtr qemuCaps) { - unsigned int maxCpus; - - maxCpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, def->os.machine); - if (!maxCpus) - return true; + unsigned int maxCpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, def->os.machine); - if (virDomainDefGetVcpusMax(def) > maxCpus) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("Maximum CPUs greater than specified machine type limit")); - return false; + if (maxCpus > 0 && virDomainDefGetVcpusMax(def) > maxCpus) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Maximum CPUs greater than specified machine type limit")); + return -1; } - return true; + return 0; } @@ -4667,7 +4664,7 @@ qemuProcessLaunch(virConnectPtr conn, } } - if (!qemuValidateCpuMax(vm->def, priv->qemuCaps)) + if (qemuValidateCpuCount(vm->def, priv->qemuCaps) < 0) goto cleanup; if (qemuAssignDeviceAliases(vm->def, priv->qemuCaps) < 0) -- 2.6.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list