qemu: Change return type of qemuDomainFixupCPUs to void

The function never fails.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Jiri Denemark 2024-04-17 14:28:24 +02:00
parent efac33bfaa
commit 6eb4c6ad20
3 changed files with 8 additions and 14 deletions

View File

@ -11050,29 +11050,27 @@ qemuDomainUpdateCPU(virDomainObj *vm,
* *
* This function can only be used on an active domain or when restoring a * This function can only be used on an active domain or when restoring a
* domain which was running. * domain which was running.
*
* Returns 0 on success, -1 on error.
*/ */
int void
qemuDomainFixupCPUs(virDomainObj *vm, qemuDomainFixupCPUs(virDomainObj *vm,
virCPUDef **origCPU) virCPUDef **origCPU)
{ {
virArch arch = vm->def->os.arch; virArch arch = vm->def->os.arch;
if (!ARCH_IS_X86(arch)) if (!ARCH_IS_X86(arch))
return 0; return;
if (!vm->def->cpu || if (!vm->def->cpu ||
vm->def->cpu->mode != VIR_CPU_MODE_CUSTOM || vm->def->cpu->mode != VIR_CPU_MODE_CUSTOM ||
!vm->def->cpu->model) !vm->def->cpu->model)
return 0; return;
/* Missing origCPU means QEMU created exactly the same virtual CPU which /* Missing origCPU means QEMU created exactly the same virtual CPU which
* we asked for or libvirt was too old to mess up the translation from * we asked for or libvirt was too old to mess up the translation from
* host-model. * host-model.
*/ */
if (!*origCPU) if (!*origCPU)
return 0; return;
if (virCPUDefFindFeature(vm->def->cpu, "cmt")) { if (virCPUDefFindFeature(vm->def->cpu, "cmt")) {
g_autoptr(virCPUDef) fixedCPU = virCPUDefCopyWithoutModel(vm->def->cpu); g_autoptr(virCPUDef) fixedCPU = virCPUDefCopyWithoutModel(vm->def->cpu);
@ -11093,8 +11091,6 @@ qemuDomainFixupCPUs(virDomainObj *vm,
virCPUDefFree(*origCPU); virCPUDefFree(*origCPU);
*origCPU = g_steal_pointer(&fixedOrig); *origCPU = g_steal_pointer(&fixedOrig);
} }
return 0;
} }

View File

@ -985,7 +985,7 @@ qemuDomainUpdateCPU(virDomainObj *vm,
virCPUDef *cpu, virCPUDef *cpu,
virCPUDef **origCPU); virCPUDef **origCPU);
int void
qemuDomainFixupCPUs(virDomainObj *vm, qemuDomainFixupCPUs(virDomainObj *vm,
virCPUDef **origCPU); virCPUDef **origCPU);

View File

@ -8278,9 +8278,8 @@ qemuProcessStartWithMemoryState(virConnectPtr conn,
/* No cookie means libvirt which saved the domain was too old to mess up /* No cookie means libvirt which saved the domain was too old to mess up
* the CPU definitions. * the CPU definitions.
*/ */
if (cookie && if (cookie)
qemuDomainFixupCPUs(vm, &cookie->cpu) < 0) qemuDomainFixupCPUs(vm, &cookie->cpu);
return -1;
if (cookie && !cookie->slirpHelper) if (cookie && !cookie->slirpHelper)
priv->disableSlirp = true; priv->disableSlirp = true;
@ -8926,8 +8925,7 @@ qemuProcessRefreshCPU(virQEMUDriver *driver,
* case the host-model is known to not contain features which QEMU * case the host-model is known to not contain features which QEMU
* doesn't know about. * doesn't know about.
*/ */
if (qemuDomainFixupCPUs(vm, &priv->origCPU) < 0) qemuDomainFixupCPUs(vm, &priv->origCPU);
return -1;
} }
return 0; return 0;