|
|
3e5111 |
From 241d9b0d3945072ad74f9a0a5dcdb541cc2ad50b Mon Sep 17 00:00:00 2001
|
|
|
3e5111 |
Message-Id: <241d9b0d3945072ad74f9a0a5dcdb541cc2ad50b@dist-git>
|
|
|
3e5111 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
Date: Wed, 29 Mar 2017 13:33:50 +0200
|
|
|
3e5111 |
Subject: [PATCH] qemu: Add migratable parameter to virQEMUCapsInitCPUModel
|
|
|
3e5111 |
|
|
|
3e5111 |
The caller can ask for a migratable CPU model by passing true for the
|
|
|
3e5111 |
new parameter.
|
|
|
3e5111 |
|
|
|
3e5111 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
(cherry picked from commit 00e0cbcb567a57c7b5a145d7fd3fb662779f6bec)
|
|
|
3e5111 |
|
|
|
3e5111 |
https://bugzilla.redhat.com/show_bug.cgi?id=1444421
|
|
|
3e5111 |
|
|
|
3e5111 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
---
|
|
|
3e5111 |
src/qemu/qemu_capabilities.c | 36 +++++++++++++++++++++++++-----------
|
|
|
3e5111 |
src/qemu/qemu_capspriv.h | 3 ++-
|
|
|
3e5111 |
tests/cputest.c | 2 +-
|
|
|
3e5111 |
3 files changed, 28 insertions(+), 13 deletions(-)
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
|
|
3e5111 |
index b71de9633..eb6b674b4 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_capabilities.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_capabilities.c
|
|
|
3e5111 |
@@ -3118,7 +3118,8 @@ virQEMUCapsCPUFilterFeatures(const char *name,
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
qemuMonitorCPUModelInfoPtr modelInfo,
|
|
|
3e5111 |
- virCPUDefPtr cpu)
|
|
|
3e5111 |
+ virCPUDefPtr cpu,
|
|
|
3e5111 |
+ bool migratable)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
size_t i;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -3146,8 +3147,12 @@ virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
|
|
|
3e5111 |
if (VIR_STRDUP(feature->name, prop->name) < 0)
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
- feature->policy = prop->value.boolean ? VIR_CPU_FEATURE_REQUIRE
|
|
|
3e5111 |
- : VIR_CPU_FEATURE_DISABLE;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ if (!prop->value.boolean ||
|
|
|
3e5111 |
+ (migratable && prop->migratable == VIR_TRISTATE_BOOL_NO))
|
|
|
3e5111 |
+ feature->policy = VIR_CPU_FEATURE_DISABLE;
|
|
|
3e5111 |
+ else
|
|
|
3e5111 |
+ feature->policy = VIR_CPU_FEATURE_REQUIRE;
|
|
|
3e5111 |
cpu->nfeatures++;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -3164,7 +3169,8 @@ static int
|
|
|
3e5111 |
virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
virDomainVirtType type,
|
|
|
3e5111 |
qemuMonitorCPUModelInfoPtr model,
|
|
|
3e5111 |
- virCPUDefPtr cpu)
|
|
|
3e5111 |
+ virCPUDefPtr cpu,
|
|
|
3e5111 |
+ bool migratable)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
virCPUDataPtr data = NULL;
|
|
|
3e5111 |
unsigned long long sigFamily = 0;
|
|
|
3e5111 |
@@ -3185,9 +3191,13 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
|
|
|
3e5111 |
switch (prop->type) {
|
|
|
3e5111 |
case QEMU_MONITOR_CPU_PROPERTY_BOOLEAN:
|
|
|
3e5111 |
- if (prop->value.boolean &&
|
|
|
3e5111 |
- virCPUx86DataAddFeature(data, prop->name) < 0)
|
|
|
3e5111 |
+ if (!prop->value.boolean ||
|
|
|
3e5111 |
+ (migratable && prop->migratable == VIR_TRISTATE_BOOL_NO))
|
|
|
3e5111 |
+ continue;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ if (virCPUx86DataAddFeature(data, prop->name) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
break;
|
|
|
3e5111 |
|
|
|
3e5111 |
case QEMU_MONITOR_CPU_PROPERTY_STRING:
|
|
|
3e5111 |
@@ -3226,13 +3236,14 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
|
|
|
3e5111 |
/**
|
|
|
3e5111 |
* Returns 0 when host CPU model provided by QEMU was filled in qemuCaps,
|
|
|
3e5111 |
- * 1 when the caller should fall back to using virCapsPtr->host.cpu,
|
|
|
3e5111 |
+ * 1 when the caller should fall back to other methods
|
|
|
3e5111 |
* -1 on error.
|
|
|
3e5111 |
*/
|
|
|
3e5111 |
int
|
|
|
3e5111 |
virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
virDomainVirtType type,
|
|
|
3e5111 |
- virCPUDefPtr cpu)
|
|
|
3e5111 |
+ virCPUDefPtr cpu,
|
|
|
3e5111 |
+ bool migratable)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
qemuMonitorCPUModelInfoPtr model;
|
|
|
3e5111 |
int ret = 1;
|
|
|
3e5111 |
@@ -3242,10 +3253,13 @@ virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
else
|
|
|
3e5111 |
model = qemuCaps->tcgCPUModelInfo;
|
|
|
3e5111 |
|
|
|
3e5111 |
+ if (migratable && model && !model->migratability)
|
|
|
3e5111 |
+ return 1;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
if (ARCH_IS_S390(qemuCaps->arch))
|
|
|
3e5111 |
- ret = virQEMUCapsInitCPUModelS390(qemuCaps, model, cpu);
|
|
|
3e5111 |
+ ret = virQEMUCapsInitCPUModelS390(qemuCaps, model, cpu, migratable);
|
|
|
3e5111 |
else if (ARCH_IS_X86(qemuCaps->arch))
|
|
|
3e5111 |
- ret = virQEMUCapsInitCPUModelX86(qemuCaps, type, model, cpu);
|
|
|
3e5111 |
+ ret = virQEMUCapsInitCPUModelX86(qemuCaps, type, model, cpu, migratable);
|
|
|
3e5111 |
|
|
|
3e5111 |
if (ret == 0)
|
|
|
3e5111 |
cpu->fallback = VIR_CPU_FALLBACK_FORBID;
|
|
|
3e5111 |
@@ -3274,7 +3288,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
cpu->match = VIR_CPU_MATCH_EXACT;
|
|
|
3e5111 |
cpu->fallback = VIR_CPU_FALLBACK_ALLOW;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if ((rc = virQEMUCapsInitCPUModel(qemuCaps, type, cpu)) < 0) {
|
|
|
3e5111 |
+ if ((rc = virQEMUCapsInitCPUModel(qemuCaps, type, cpu, false)) < 0) {
|
|
|
3e5111 |
goto error;
|
|
|
3e5111 |
} else if (rc == 1) {
|
|
|
3e5111 |
VIR_DEBUG("No host CPU model info from QEMU; probing host CPU directly");
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
|
|
|
3e5111 |
index 61ccd4517..1baaaf334 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_capspriv.h
|
|
|
3e5111 |
+++ b/src/qemu/qemu_capspriv.h
|
|
|
3e5111 |
@@ -81,7 +81,8 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
int
|
|
|
3e5111 |
virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
virDomainVirtType type,
|
|
|
3e5111 |
- virCPUDefPtr cpu);
|
|
|
3e5111 |
+ virCPUDefPtr cpu,
|
|
|
3e5111 |
+ bool migratable);
|
|
|
3e5111 |
|
|
|
3e5111 |
void
|
|
|
3e5111 |
virQEMUCapsSetCPUModelInfo(virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
diff --git a/tests/cputest.c b/tests/cputest.c
|
|
|
3e5111 |
index 3d3e43f16..8c07cf4f6 100644
|
|
|
3e5111 |
--- a/tests/cputest.c
|
|
|
3e5111 |
+++ b/tests/cputest.c
|
|
|
3e5111 |
@@ -709,7 +709,7 @@ cpuTestJSONCPUID(const void *arg)
|
|
|
3e5111 |
cpu->match = VIR_CPU_MATCH_EXACT;
|
|
|
3e5111 |
cpu->fallback = VIR_CPU_FALLBACK_FORBID;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (virQEMUCapsInitCPUModel(qemuCaps, VIR_DOMAIN_VIRT_KVM, cpu) != 0)
|
|
|
3e5111 |
+ if (virQEMUCapsInitCPUModel(qemuCaps, VIR_DOMAIN_VIRT_KVM, cpu, false) != 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
ret = cpuTestCompareXML(data->arch, cpu, result, false);
|
|
|
3e5111 |
--
|
|
|
3e5111 |
2.12.2
|
|
|
3e5111 |
|