mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-05 22:05:47 +00:00
qemu: capabilities: Probe presence of commands from QMP schema instead of 'query-commands'
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@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
7ca777cc09
commit
d8b6801095
@ -2602,7 +2602,7 @@ virQEMUCapsGetSGXCapabilities(virQEMUCaps *qemuCaps)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virQEMUCapsProbeQMPCommands(virQEMUCaps *qemuCaps,
|
virQEMUCapsProbeQMPCommands(virQEMUCaps *qemuCaps G_GNUC_UNUSED,
|
||||||
qemuMonitor *mon)
|
qemuMonitor *mon)
|
||||||
{
|
{
|
||||||
g_auto(GStrv) commands = NULL;
|
g_auto(GStrv) commands = NULL;
|
||||||
@ -2610,11 +2610,6 @@ virQEMUCapsProbeQMPCommands(virQEMUCaps *qemuCaps,
|
|||||||
if (qemuMonitorGetCommands(mon, &commands) < 0)
|
if (qemuMonitorGetCommands(mon, &commands) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virQEMUCapsProcessStringFlags(qemuCaps,
|
|
||||||
G_N_ELEMENTS(virQEMUCapsCommands),
|
|
||||||
virQEMUCapsCommands,
|
|
||||||
commands);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5520,7 +5515,6 @@ static int
|
|||||||
virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCaps *qemuCaps,
|
virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCaps *qemuCaps,
|
||||||
qemuMonitor *mon)
|
qemuMonitor *mon)
|
||||||
{
|
{
|
||||||
struct virQEMUCapsStringFlags *entry;
|
|
||||||
virJSONValue *schemareply;
|
virJSONValue *schemareply;
|
||||||
g_autoptr(GHashTable) schema = NULL;
|
g_autoptr(GHashTable) schema = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -5533,12 +5527,19 @@ virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCaps *qemuCaps,
|
|||||||
schemareply = NULL;
|
schemareply = NULL;
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsQMPSchemaQueries); i++) {
|
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsQMPSchemaQueries); i++) {
|
||||||
entry = virQEMUCapsQMPSchemaQueries + i;
|
struct virQEMUCapsStringFlags *entry = virQEMUCapsQMPSchemaQueries + i;
|
||||||
|
|
||||||
if (virQEMUQAPISchemaPathExists(entry->value, schema))
|
if (virQEMUQAPISchemaPathExists(entry->value, schema))
|
||||||
virQEMUCapsSet(qemuCaps, entry->flag);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user