提交 9a8e0402 编写于 作者: D Daniel Henrique Barboza 提交者: John Ferlan

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: NDaniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 8aad8432
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册