mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00: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
|
||||
qemuValidateCpuMax(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
|
||||
static int
|
||||
qemuValidateCpuCount(virDomainDefPtr def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
unsigned int maxCpus;
|
||||
unsigned int maxCpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, def->os.machine);
|
||||
|
||||
maxCpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, def->os.machine);
|
||||
if (!maxCpus)
|
||||
return true;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -4697,7 +4694,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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user