mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-04-01 20:05:19 +00:00
qemu_process.c: moving qemuValidateCpuCount to qemu_domain.c
Previous patch removed the call to qemuProcessValidateCpuCount from qemuProcessStartValidateXML, in qemu_process.c. The only caller left is qemuDomainDefValidate, in qemu_domain.c. Instead of having a public function declared inside qemu_process.c that isn't used in that file, this patch moves the function to qemu_domain.c, making in static and renaming it to qemuDomainValidateCpuCount to be compliant with other static functions names in the file. Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
2c4a6a34a3
commit
9c2fbe97c6
@ -3991,6 +3991,29 @@ qemuDomainDefValidateMemory(const virDomainDef *def)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainValidateCpuCount(const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
unsigned int maxCpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, def->os.machine);
|
||||
|
||||
if (virDomainDefGetVcpus(def) == 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Domain requires at least 1 vCPU"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (maxCpus > 0 && virDomainDefGetVcpusMax(def) > maxCpus) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Maximum CPUs greater than specified machine "
|
||||
"type limit %u"), maxCpus);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainDefValidate(const virDomainDef *def,
|
||||
virCapsPtr caps ATTRIBUTE_UNUSED,
|
||||
@ -4085,7 +4108,7 @@ qemuDomainDefValidate(const virDomainDef *def,
|
||||
}
|
||||
}
|
||||
|
||||
if (qemuProcessValidateCpuCount(def, qemuCaps) < 0)
|
||||
if (qemuDomainValidateCpuCount(def, qemuCaps) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (ARCH_IS_X86(def->os.arch) &&
|
||||
|
@ -3898,29 +3898,6 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuProcessValidateCpuCount(const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
unsigned int maxCpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, def->os.machine);
|
||||
|
||||
if (virDomainDefGetVcpus(def) == 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Domain requires at least 1 vCPU"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (maxCpus > 0 && virDomainDefGetVcpusMax(def) > maxCpus) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Maximum CPUs greater than specified machine "
|
||||
"type limit %u"), maxCpus);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
|
||||
virCPUDataPtr cpu)
|
||||
|
@ -47,9 +47,6 @@ 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