|
|
404507 |
From dbdc7ec536154af91ae897663d82c57d11500d23 Mon Sep 17 00:00:00 2001
|
|
|
404507 |
Message-Id: <dbdc7ec536154af91ae897663d82c57d11500d23@dist-git>
|
|
|
404507 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
404507 |
Date: Thu, 7 Dec 2017 11:23:50 +0100
|
|
|
404507 |
Subject: [PATCH] qemu: Make sure host-model uses CPU model supported by QEMU
|
|
|
404507 |
|
|
|
404507 |
When reconnecting to a running domain started by old libvirt, which did
|
|
|
404507 |
not change host-model into a custom CPU definition, we replace the CPU
|
|
|
404507 |
definition with a specific CPU model from host capabilities. However,
|
|
|
404507 |
that CPU model may not be supported by the running qemu process. We need
|
|
|
404507 |
to translate the CPU model to one of the models which libvirt could have
|
|
|
404507 |
used when starting the domain.
|
|
|
404507 |
|
|
|
404507 |
https://bugzilla.redhat.com/show_bug.cgi?id=1521202
|
|
|
404507 |
|
|
|
404507 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
404507 |
(cherry picked from commit ce73de441d35e17a29b83b8741e668a6ddc013ba)
|
|
|
404507 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
404507 |
---
|
|
|
404507 |
src/qemu/qemu_process.c | 30 ++++++++++++++++++++++++++++++
|
|
|
404507 |
1 file changed, 30 insertions(+)
|
|
|
404507 |
|
|
|
404507 |
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
|
404507 |
index 91426ad3c3..701528c42c 100644
|
|
|
404507 |
--- a/src/qemu/qemu_process.c
|
|
|
404507 |
+++ b/src/qemu/qemu_process.c
|
|
|
404507 |
@@ -3850,6 +3850,30 @@ qemuProcessUpdateAndVerifyCPU(virQEMUDriverPtr driver,
|
|
|
404507 |
}
|
|
|
404507 |
|
|
|
404507 |
|
|
|
404507 |
+static virDomainCapsCPUModelsPtr
|
|
|
404507 |
+qemuProcessFetchCPUDefinitions(virQEMUDriverPtr driver,
|
|
|
404507 |
+ virDomainObjPtr vm,
|
|
|
404507 |
+ qemuDomainAsyncJob asyncJob)
|
|
|
404507 |
+{
|
|
|
404507 |
+ qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
404507 |
+ virDomainCapsCPUModelsPtr models = NULL;
|
|
|
404507 |
+
|
|
|
404507 |
+ if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
|
|
404507 |
+ goto error;
|
|
|
404507 |
+
|
|
|
404507 |
+ models = virQEMUCapsFetchCPUDefinitions(priv->mon);
|
|
|
404507 |
+
|
|
|
404507 |
+ if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
|
|
404507 |
+ goto error;
|
|
|
404507 |
+
|
|
|
404507 |
+ return models;
|
|
|
404507 |
+
|
|
|
404507 |
+ error:
|
|
|
404507 |
+ virObjectUnref(models);
|
|
|
404507 |
+ return NULL;
|
|
|
404507 |
+}
|
|
|
404507 |
+
|
|
|
404507 |
+
|
|
|
404507 |
static int
|
|
|
404507 |
qemuProcessUpdateCPU(virQEMUDriverPtr driver,
|
|
|
404507 |
virDomainObjPtr vm,
|
|
|
404507 |
@@ -3857,6 +3881,7 @@ qemuProcessUpdateCPU(virQEMUDriverPtr driver,
|
|
|
404507 |
{
|
|
|
404507 |
virCPUDataPtr cpu = NULL;
|
|
|
404507 |
virCPUDataPtr disabled = NULL;
|
|
|
404507 |
+ virDomainCapsCPUModelsPtr models = NULL;
|
|
|
404507 |
int ret = -1;
|
|
|
404507 |
|
|
|
404507 |
if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < 0)
|
|
|
404507 |
@@ -3865,11 +3890,16 @@ qemuProcessUpdateCPU(virQEMUDriverPtr driver,
|
|
|
404507 |
if (qemuProcessUpdateLiveGuestCPU(vm, cpu, disabled) < 0)
|
|
|
404507 |
goto cleanup;
|
|
|
404507 |
|
|
|
404507 |
+ if (!(models = qemuProcessFetchCPUDefinitions(driver, vm, asyncJob)) ||
|
|
|
404507 |
+ virCPUTranslate(vm->def->os.arch, vm->def->cpu, models) < 0)
|
|
|
404507 |
+ goto cleanup;
|
|
|
404507 |
+
|
|
|
404507 |
ret = 0;
|
|
|
404507 |
|
|
|
404507 |
cleanup:
|
|
|
404507 |
virCPUDataFree(cpu);
|
|
|
404507 |
virCPUDataFree(disabled);
|
|
|
404507 |
+ virObjectUnref(models);
|
|
|
404507 |
return ret;
|
|
|
404507 |
}
|
|
|
404507 |
|
|
|
404507 |
--
|
|
|
404507 |
2.15.1
|
|
|
404507 |
|