mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
qemu_process.c: make qemuValidateCpuCount public
qemuValidateCpuCount validates the maxCpus value of a domain at startup time, preventing it to start if the value exceeds a maximum. This checking is also done at qemu_domain.c, qemuDomainDefValidate. However, it is done only for x86 (and even then, in a specific scenario). We want this check to be done for all archs. To accomplish this, let's first make qemuValidateCpuCount public so it can be used inside qemuDomainDefValidate. The function was renamed to qemuProcessValidateCpuCount to be compliant with the other public methods at qemu_process.h. The method signature was slightly adapted to fit the const 'def' variable used in qemuDomainDefValidate. This change has no downside in in its original usage at qemuProcessStartValidateXML. Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
8aad8432f6
commit
9a8e040264
@ -3898,9 +3898,9 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuValidateCpuCount(virDomainDefPtr def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
int
|
||||
qemuProcessValidateCpuCount(const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
unsigned int maxCpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, def->os.machine);
|
||||
|
||||
@ -5165,7 +5165,7 @@ qemuProcessStartValidateXML(virQEMUDriverPtr driver,
|
||||
* If back compat isn't a concern, XML validation should probably
|
||||
* be done at parse time.
|
||||
*/
|
||||
if (qemuValidateCpuCount(vm->def, qemuCaps) < 0)
|
||||
if (qemuProcessValidateCpuCount(vm->def, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
/* checks below should not be executed when starting a qemu process for a
|
||||
|
@ -47,6 +47,9 @@ int qemuProcessDestroyMemoryBackingPath(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainMemoryDefPtr mem);
|
||||
|
||||
int qemuProcessValidateCpuCount(const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps);
|
||||
|
||||
void qemuProcessReconnectAll(virQEMUDriverPtr driver);
|
||||
|
||||
typedef struct _qemuProcessIncomingDef qemuProcessIncomingDef;
|
||||
|
Loading…
x
Reference in New Issue
Block a user