diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2012-08-10 11:04:11 -0500 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2012-08-13 16:10:18 -0300 |
commit | 01d3c80d6876c7de6b07bee92b1b2440b48e60c9 (patch) | |
tree | 211e40a738183305cb43accfef129ac689f28714 /vl.c | |
parent | 5192082097549c5b3aa7c913c6853d97a68172cb (diff) | |
download | qemu-01d3c80d6876c7de6b07bee92b1b2440b48e60c9.tar.gz qemu-01d3c80d6876c7de6b07bee92b1b2440b48e60c9.tar.bz2 qemu-01d3c80d6876c7de6b07bee92b1b2440b48e60c9.zip |
qapi: add query-machines command
This provides the same output as -M ? but in a structured way.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -1213,6 +1213,37 @@ QEMUMachine *find_default_machine(void) return NULL; } +MachineInfoList *qmp_query_machines(Error **errp) +{ + MachineInfoList *mach_list = NULL; + QEMUMachine *m; + + for (m = first_machine; m; m = m->next) { + MachineInfoList *entry; + MachineInfo *info; + + info = g_malloc0(sizeof(*info)); + if (m->is_default) { + info->has_is_default = true; + info->is_default = true; + } + + if (m->alias) { + info->has_alias = true; + info->alias = g_strdup(m->alias); + } + + info->name = g_strdup(m->name); + + entry = g_malloc0(sizeof(*entry)); + entry->value = info; + entry->next = mach_list; + mach_list = entry; + } + + return mach_list; +} + /***********************************************************/ /* main execution loop */ |