[PATCH v5 30/36] qemu_driver: Consolidate code to baseline using libvirt

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

 



Simple cut/paste operations within function
qemuConnectBaselineHypervisorCPU to group together code specific to
computing baseline using only libvirt utility functions.

This is done in anticipation of creating new utility functions for
1) baseline using libvirt utilities (this code)
2) baseline using qemu qmp command (future)

Future patches are easier to follow if the code for using libvirt is
consolidated.

Signed-off-by: Chris Venteicher <cventeic@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7d9e17e72c..007f64d6ad 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13657,7 +13657,6 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn,
     virQEMUCapsPtr qemuCaps = NULL;
     virArch arch;
     virDomainVirtType virttype;
-    virDomainCapsCPUModelsPtr cpuModels;
     bool migratable;
     virCPUDefPtr cpu = NULL;
     char *cpustr = NULL;
@@ -13669,8 +13668,6 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn,
     if (virConnectBaselineHypervisorCPUEnsureACL(conn) < 0)
         goto cleanup;
 
-    migratable = !!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE);
-
     if (!(cpus = virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_AUTO)))
         goto cleanup;
 
@@ -13683,17 +13680,21 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn,
     if (!qemuCaps)
         goto cleanup;
 
-    if (!(cpuModels = virQEMUCapsGetCPUDefinitions(qemuCaps, virttype)) ||
-        cpuModels->nmodels == 0) {
-        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
-                       _("QEMU '%s' does not support any CPU models for "
-                         "virttype '%s'"),
-                       virQEMUCapsGetBinary(qemuCaps),
-                       virDomainVirtTypeToString(virttype));
-        goto cleanup;
-    }
-
     if (ARCH_IS_X86(arch)) {
+        migratable = !!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE);
+
+        virDomainCapsCPUModelsPtr cpuModels;
+
+        if (!(cpuModels = virQEMUCapsGetCPUDefinitions(qemuCaps, virttype)) ||
+            cpuModels->nmodels == 0) {
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+                           _("QEMU '%s' does not support any CPU models for "
+                             "virttype '%s'"),
+                           virQEMUCapsGetBinary(qemuCaps),
+                           virDomainVirtTypeToString(virttype));
+            goto cleanup;
+        }
+
         int rc = virQEMUCapsGetCPUFeatures(qemuCaps, virttype,
                                            migratable, &features);
         if (rc < 0)
-- 
2.17.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux