The function never fails.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
Notes:
Version 2:
- virCPUDefCopy never returns NULL
- do not remove !*origCPU check in qemuDomainFixupCPUs
- make sure origCPU is set when reconnecting to running domains
src/qemu/qemu_domain.c | 12 ++++--------
src/qemu/qemu_domain.h | 2 +-
src/qemu/qemu_process.c | 8 +++-----
3 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 3dfabfda2f..3469f0d40c 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11050,29 +11050,27 @@ qemuDomainUpdateCPU(virDomainObj *vm,
*
* This function can only be used on an active domain or when restoring a
* domain which was running.
- *
- * Returns 0 on success, -1 on error.
*/
-int
+void
qemuDomainFixupCPUs(virDomainObj *vm,
virCPUDef **origCPU)
{
virArch arch = vm->def->os.arch;
if (!ARCH_IS_X86(arch))
- return 0;
+ return;
if (!vm->def->cpu ||
vm->def->cpu->mode != VIR_CPU_MODE_CUSTOM ||
!vm->def->cpu->model)
- return 0;
+ return;
/* 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
* host-model.
*/
if (!*origCPU)
- return 0;
+ return;
if (virCPUDefFindFeature(vm->def->cpu, "cmt")) {
g_autoptr(virCPUDef) fixedCPU = virCPUDefCopyWithoutModel(vm->def->cpu);
@@ -11093,8 +11091,6 @@ qemuDomainFixupCPUs(virDomainObj *vm,
virCPUDefFree(*origCPU);
*origCPU = g_steal_pointer(&fixedOrig);
}
-
- return 0;
}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 264817eef9..a3089ea449 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -985,7 +985,7 @@ qemuDomainUpdateCPU(virDomainObj *vm,
virCPUDef *cpu,
virCPUDef **origCPU);
-int
+void
qemuDomainFixupCPUs(virDomainObj *vm,
virCPUDef **origCPU);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 7fdb9ac23a..686f6ed6c1 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8278,9 +8278,8 @@ qemuProcessStartWithMemoryState(virConnectPtr conn,
/* No cookie means libvirt which saved the domain was too old to mess up
* the CPU definitions.
*/
- if (cookie &&
- qemuDomainFixupCPUs(vm, &cookie->cpu) < 0)
- return -1;
+ if (cookie)
+ qemuDomainFixupCPUs(vm, &cookie->cpu);
if (cookie && !cookie->slirpHelper)
priv->disableSlirp = true;
@@ -8926,8 +8925,7 @@ qemuProcessRefreshCPU(virQEMUDriver *driver,
* case the host-model is known to not contain features which QEMU
* doesn't know about.
*/
- if (qemuDomainFixupCPUs(vm, &priv->origCPU) < 0)
- return -1;
+ qemuDomainFixupCPUs(vm, &priv->origCPU);
}
return 0;
--
2.44.0