[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 25/33] qemu: Make virQEMUCapsInitCPUModel testable



Signed-off-by: Jiri Denemark <jdenemar redhat com>
---
 src/qemu/qemu_capabilities.c | 19 ++++++++++++++-----
 src/qemu/qemu_capspriv.h     | 10 ++++++++++
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index a77e300b7..3163bba8a 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3204,7 +3204,7 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps,
  *          1 when the caller should fall back to using virCapsPtr->host.cpu,
  *         -1 on error.
  */
-static int
+int
 virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
                         virDomainVirtType type,
                         virCPUDefPtr cpu)
@@ -3268,6 +3268,18 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
 }
 
 
+void
+virQEMUCapsSetCPUModelInfo(virQEMUCapsPtr qemuCaps,
+                           virDomainVirtType type,
+                           qemuMonitorCPUModelInfoPtr modelInfo)
+{
+    if (type == VIR_DOMAIN_VIRT_KVM)
+        qemuCaps->kvmCPUModelInfo = modelInfo;
+    else
+        qemuCaps->tcgCPUModelInfo = modelInfo;
+}
+
+
 static int
 virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
                                 xmlXPathContextPtr ctxt,
@@ -3354,10 +3366,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
         }
     }
 
-    if (type == VIR_DOMAIN_VIRT_KVM)
-        qemuCaps->kvmCPUModelInfo = hostCPU;
-    else
-        qemuCaps->tcgCPUModelInfo = hostCPU;
+    virQEMUCapsSetCPUModelInfo(qemuCaps, type, hostCPU);
     hostCPU = NULL;
     ret = 0;
 
diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
index 75499d462..d4f13a2d2 100644
--- a/src/qemu/qemu_capspriv.h
+++ b/src/qemu/qemu_capspriv.h
@@ -73,4 +73,14 @@ void
 virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
                             virCapsPtr caps,
                             virDomainVirtType type);
+
+int
+virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
+                        virDomainVirtType type,
+                        virCPUDefPtr cpu);
+
+void
+virQEMUCapsSetCPUModelInfo(virQEMUCapsPtr qemuCaps,
+                           virDomainVirtType type,
+                           qemuMonitorCPUModelInfoPtr modelInfo);
 #endif
-- 
2.11.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]