qemu_monitor: Remove helpers for 'query-commands'

Now that we don't use it for probing at all we can remove all the
corresponding monitor code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-07-14 15:25:08 +02:00
parent 0af5a514ee
commit 033c4fcddf
5 changed files with 0 additions and 122 deletions

View File

@ -3308,18 +3308,6 @@ qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig)
}
int
qemuMonitorGetCommands(qemuMonitor *mon,
char ***commands)
{
VIR_DEBUG("commands=%p", commands);
QEMU_CHECK_MONITOR(mon);
return qemuMonitorJSONGetCommands(mon, commands);
}
GHashTable *
qemuMonitorGetCommandLineOptions(qemuMonitor *mon)
{

View File

@ -1171,8 +1171,6 @@ int qemuMonitorGetCPUModelComparison(qemuMonitor *mon,
qemuMonitorCPUModelInfo *
qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig);
int qemuMonitorGetCommands(qemuMonitor *mon,
char ***commands);
GHashTable *qemuMonitorGetCommandLineOptions(qemuMonitor *mon);
int qemuMonitorGetKVMState(qemuMonitor *mon,

View File

@ -5256,50 +5256,6 @@ qemuMonitorJSONGetCPUModelComparison(qemuMonitor *mon,
}
int qemuMonitorJSONGetCommands(qemuMonitor *mon,
char ***commands)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virJSONValue *data;
g_auto(GStrv) commandlist = NULL;
size_t n = 0;
size_t i;
*commands = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("query-commands", NULL)))
return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
return -1;
if (!(data = qemuMonitorJSONGetReply(cmd, reply, VIR_JSON_TYPE_ARRAY)))
return -1;
n = virJSONValueArraySize(data);
/* null-terminated list */
commandlist = 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-commands reply data was missing 'name'"));
return -1;
}
commandlist[i] = g_strdup(tmp);
}
*commands = g_steal_pointer(&commandlist);
return n;
}
static int
qemuMonitorJSONGetCommandLineOptionsWorker(size_t pos G_GNUC_UNUSED,
virJSONValue *item,

View File

@ -472,11 +472,6 @@ qemuMonitorJSONGetCPUModelComparison(qemuMonitor *mon,
char **result)
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
int
qemuMonitorJSONGetCommands(qemuMonitor *mon,
char ***commands)
ATTRIBUTE_NONNULL(2);
GHashTable *
qemuMonitorJSONGetCommandLineOptions(qemuMonitor *mon);

View File

@ -491,64 +491,6 @@ testQemuMonitorJSONGetCPUDefinitions(const void *opaque)
}
static int
testQemuMonitorJSONGetCommands(const void *opaque)
{
const testGenericData *data = opaque;
virDomainXMLOption *xmlopt = data->xmlopt;
g_auto(GStrv) commands = NULL;
int ncommands = 0;
g_autoptr(qemuMonitorTest) test = NULL;
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
return -1;
if (qemuMonitorTestAddItem(test, "query-commands",
"{ "
" \"return\": [ "
" { "
" \"name\": \"system_wakeup\" "
" }, "
" { "
" \"name\": \"cont\" "
" }, "
" { "
" \"name\": \"quit\" "
" } "
" ]"
"}") < 0)
return -1;
if ((ncommands = qemuMonitorGetCommands(qemuMonitorTestGetMonitor(test),
&commands)) < 0)
return -1;
if (ncommands != 3) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"ncommands %d is not 3", ncommands);
return -1;
}
#define CHECK(i, wantname) \
do { \
if (STRNEQ(commands[i], (wantname))) { \
virReportError(VIR_ERR_INTERNAL_ERROR, \
"name %s is not %s", \
commands[i], (wantname)); \
return -1; \
} \
} while (0)
CHECK(0, "system_wakeup");
CHECK(1, "cont");
CHECK(2, "quit");
#undef CHECK
return 0;
}
static int
testQemuMonitorJSONGetTPMModels(const void *opaque)
{
@ -2888,7 +2830,6 @@ mymain(void)
DO_TEST(GetVersion);
DO_TEST(GetMachines);
DO_TEST(GetCPUDefinitions);
DO_TEST(GetCommands);
DO_TEST(GetTPMModels);
if (qemuMonitorJSONTestAttachChardev(driver.xmlopt, qapiData.schema) < 0)
ret = -1;