[PATCH 2/6] qemu: Add -machine suffix automatically

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

 



The QOM type for machine types is the machine type name
followed by the -machine suffix. Since this is always the
case, we can make virQEMUCapsMachineProps more readable
and avoid repetition by not including the suffix there and
adding it automatically while processing the data.

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

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 66745ab4e2..34d162b9d1 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1407,7 +1407,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsSPAPR[] = {
 };
 
 static virQEMUCapsObjectTypeProps virQEMUCapsMachineProps[] = {
-    { "spapr-machine", virQEMUCapsMachinePropsSPAPR,
+    { "spapr", virQEMUCapsMachinePropsSPAPR,
       ARRAY_CARDINALITY(virQEMUCapsMachinePropsSPAPR),
       -1 },
 };
@@ -2358,7 +2358,12 @@ virQEMUCapsProbeQMPMachineProps(virQEMUCapsPtr qemuCaps,
 
     for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsMachineProps); i++) {
         virQEMUCapsObjectTypeProps props = virQEMUCapsMachineProps[i];
-        const char *type = props.type;
+        VIR_AUTOFREE(char *) type = NULL;
+
+        /* The QOM type for machine types is the machine type name
+         * followed by the -machine suffix */
+        if (virAsprintf(&type, "%s-machine", props.type) < 0)
+            return -1;
 
         if ((nvalues = qemuMonitorGetObjectProps(mon, type, &values)) < 0)
             return -1;
-- 
2.21.0

--
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