[PATCH 11/11] qemu: Prefer qemu-system-* binaries

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

 



We already prefer them in capabilities, and domcapabilities
should be consistent with that.

This commit is best viewed with 'git show -w'.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c | 33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index b621f39a82..77013a818e 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -583,6 +583,7 @@ struct _virQEMUCaps {
 
 struct virQEMUCapsSearchData {
     virArch arch;
+    const char *binaryFilter;
 };
 
 
@@ -4743,7 +4744,15 @@ virQEMUCapsCompareArch(const void *payload,
     struct virQEMUCapsSearchData *data = (struct virQEMUCapsSearchData *)opaque;
     const virQEMUCaps *qemuCaps = payload;
 
-    return qemuCaps->arch == data->arch;
+    if (qemuCaps->arch != data->arch)
+        return false;
+
+    if (data->binaryFilter &&
+        !strstr(qemuCaps->binary, data->binaryFilter)) {
+        return false;
+    }
+
+    return true;
 }
 
 
@@ -4752,20 +4761,28 @@ virQEMUCapsCacheLookupByArch(virFileCachePtr cache,
                              virArch arch)
 {
     virQEMUCapsPtr ret = NULL;
+    const char *binaryFilters[] = {
+        "qemu-system-",
+        NULL,
+    };
     virArch archs[] = {
         arch,
         virQEMUCapsFindTarget(virArchFromHost(), arch),
     };
+    size_t i;
     size_t j;
 
-    for (j = 0; j < ARRAY_CARDINALITY(archs); j++) {
-        struct virQEMUCapsSearchData data = {
-            .arch = archs[j],
-        };
+    for (i = 0; i < ARRAY_CARDINALITY(binaryFilters); i++) {
+        for (j = 0; j < ARRAY_CARDINALITY(archs); j++) {
+            struct virQEMUCapsSearchData data = {
+                .arch = archs[j],
+                .binaryFilter = binaryFilters[i],
+            };
 
-        ret = virFileCacheLookupByFunc(cache, virQEMUCapsCompareArch, &data);
-        if (ret)
-            goto done;
+            ret = virFileCacheLookupByFunc(cache, virQEMUCapsCompareArch, &data);
+            if (ret)
+                goto done;
+        }
     }
 
     virReportError(VIR_ERR_INVALID_ARG,
-- 
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