render / rpms / libvirt

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