mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
qemu: monitor: Remove qemuMonitorGetEvents
Modern code uses QMP schema to query for supported event types. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Neal Gompa <ngompa13@gmail.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
6073378990
commit
5c455694ab
@ -3818,18 +3818,6 @@ qemuMonitorGetCommands(qemuMonitor *mon,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorGetEvents(qemuMonitor *mon,
|
||||
char ***events)
|
||||
{
|
||||
VIR_DEBUG("events=%p", events);
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
return qemuMonitorJSONGetEvents(mon, events);
|
||||
}
|
||||
|
||||
|
||||
GHashTable *
|
||||
qemuMonitorGetCommandLineOptions(qemuMonitor *mon)
|
||||
{
|
||||
|
@ -1240,8 +1240,6 @@ qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig);
|
||||
|
||||
int qemuMonitorGetCommands(qemuMonitor *mon,
|
||||
char ***commands);
|
||||
int qemuMonitorGetEvents(qemuMonitor *mon,
|
||||
char ***events);
|
||||
GHashTable *qemuMonitorGetCommandLineOptions(qemuMonitor *mon);
|
||||
|
||||
int qemuMonitorGetKVMState(qemuMonitor *mon,
|
||||
|
@ -6242,63 +6242,6 @@ int qemuMonitorJSONGetCommands(qemuMonitor *mon,
|
||||
}
|
||||
|
||||
|
||||
int qemuMonitorJSONGetEvents(qemuMonitor *mon,
|
||||
char ***events)
|
||||
{
|
||||
int ret = -1;
|
||||
virJSONValue *cmd;
|
||||
virJSONValue *reply = NULL;
|
||||
virJSONValue *data;
|
||||
char **eventlist = NULL;
|
||||
size_t n = 0;
|
||||
size_t i;
|
||||
|
||||
*events = NULL;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("query-events", NULL)))
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorJSONHasError(reply, "CommandNotFound")) {
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0)
|
||||
goto cleanup;
|
||||
|
||||
data = virJSONValueObjectGetArray(reply, "return");
|
||||
n = virJSONValueArraySize(data);
|
||||
|
||||
/* null-terminated list */
|
||||
eventlist = g_new0(char *, n + 1);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
virJSONValue *child = virJSONValueArrayGet(data, i);
|
||||
const char *tmp;
|
||||
|
||||
if (!(tmp = virJSONValueObjectGetString(child, "name"))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("query-events reply data was missing 'name'"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
eventlist[i] = g_strdup(tmp);
|
||||
}
|
||||
|
||||
ret = n;
|
||||
*events = g_steal_pointer(&eventlist);
|
||||
|
||||
cleanup:
|
||||
g_strfreev(eventlist);
|
||||
virJSONValueFree(cmd);
|
||||
virJSONValueFree(reply);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuMonitorJSONGetCommandLineOptionsWorker(size_t pos G_GNUC_UNUSED,
|
||||
virJSONValue *item,
|
||||
|
@ -416,9 +416,6 @@ int qemuMonitorJSONGetCPUModelComparison(qemuMonitor *mon,
|
||||
int qemuMonitorJSONGetCommands(qemuMonitor *mon,
|
||||
char ***commands)
|
||||
ATTRIBUTE_NONNULL(2);
|
||||
int qemuMonitorJSONGetEvents(qemuMonitor *mon,
|
||||
char ***events)
|
||||
ATTRIBUTE_NONNULL(2);
|
||||
GHashTable *qemuMonitorJSONGetCommandLineOptions(qemuMonitor *mon);
|
||||
|
||||
int qemuMonitorJSONGetKVMState(qemuMonitor *mon,
|
||||
|
Loading…
Reference in New Issue
Block a user