[PATCH 1/3] qemu: capabilities: Probe presence of commands from QMP schema instead of 'query-commands'

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

 



Move the probing code to extract the data from the QMP schema rather
than invoking 'query-commands'. This patch doesn't yet remove the actual
invocation of 'query-commands', just moves the actual probing.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index c9f4b17208..76f3c78617 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2605,7 +2605,7 @@ virQEMUCapsGetSGXCapabilities(virQEMUCaps *qemuCaps)


 static int
-virQEMUCapsProbeQMPCommands(virQEMUCaps *qemuCaps,
+virQEMUCapsProbeQMPCommands(virQEMUCaps *qemuCaps G_GNUC_UNUSED,
                             qemuMonitor *mon)
 {
     g_auto(GStrv) commands = NULL;
@@ -2613,11 +2613,6 @@ virQEMUCapsProbeQMPCommands(virQEMUCaps *qemuCaps,
     if (qemuMonitorGetCommands(mon, &commands) < 0)
         return -1;

-    virQEMUCapsProcessStringFlags(qemuCaps,
-                                  G_N_ELEMENTS(virQEMUCapsCommands),
-                                  virQEMUCapsCommands,
-                                  commands);
-
     return 0;
 }

@@ -5523,7 +5518,6 @@ static int
 virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCaps *qemuCaps,
                                       qemuMonitor *mon)
 {
-    struct virQEMUCapsStringFlags *entry;
     virJSONValue *schemareply;
     g_autoptr(GHashTable) schema = NULL;
     size_t i;
@@ -5536,12 +5530,19 @@ virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCaps *qemuCaps,
     schemareply = NULL;

     for (i = 0; i < G_N_ELEMENTS(virQEMUCapsQMPSchemaQueries); i++) {
-        entry = virQEMUCapsQMPSchemaQueries + i;
+        struct virQEMUCapsStringFlags *entry = virQEMUCapsQMPSchemaQueries + i;

         if (virQEMUQAPISchemaPathExists(entry->value, schema))
             virQEMUCapsSet(qemuCaps, entry->flag);
     }

+    for (i = 0; i < G_N_ELEMENTS(virQEMUCapsCommands); i++) {
+        struct virQEMUCapsStringFlags *cmd = virQEMUCapsCommands + i;
+
+        if (virQEMUQAPISchemaPathExists(cmd->value, schema))
+            virQEMUCapsSet(qemuCaps, cmd->flag);
+    }
+
     return 0;
 }

-- 
2.41.0




[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