From 08d9d5f63f03898772fd8c636d217d2d00e14919 Mon Sep 17 00:00:00 2001 Message-Id: <08d9d5f63f03898772fd8c636d217d2d00e14919@dist-git> From: Jiri Denemark Date: Fri, 7 Apr 2017 17:03:38 +0200 Subject: [PATCH] qemu: Introduce virQEMUCapsSetHostModel A simple helper as a complement to virQEMUCapsGetHostModel. Signed-off-by: Jiri Denemark (cherry picked from commit bffc3b9fe501ff122ad81ddf42ecdb69f70ff70a) https://bugzilla.redhat.com/show_bug.cgi?id=1444421 Signed-off-by: Jiri Denemark --- src/qemu/qemu_capabilities.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index eb6b674b4..2bbc9253a 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2425,6 +2425,18 @@ virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps, } +static void +virQEMUCapsSetHostModel(virQEMUCapsPtr qemuCaps, + virDomainVirtType type, + virCPUDefPtr cpu) +{ + if (type == VIR_DOMAIN_VIRT_KVM) + qemuCaps->kvmCPUModel = cpu; + else + qemuCaps->tcgCPUModel = cpu; +} + + bool virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps, virCapsPtr caps, @@ -3301,10 +3313,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, goto error; } - if (type == VIR_DOMAIN_VIRT_KVM) - qemuCaps->kvmCPUModel = cpu; - else - qemuCaps->tcgCPUModel = cpu; + virQEMUCapsSetHostModel(qemuCaps, type, cpu); cleanup: virCPUDefFree(hostCPU); -- 2.12.2