From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMa1y-0003dB-6M for qemu-devel@nongnu.org; Wed, 27 Aug 2014 06:00:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMa1r-0002vu-TT for qemu-devel@nongnu.org; Wed, 27 Aug 2014 06:00:41 -0400 Received: from mail-wg0-x22b.google.com ([2a00:1450:400c:c00::22b]:44631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMa1r-0002vK-Gc for qemu-devel@nongnu.org; Wed, 27 Aug 2014 06:00:35 -0400 Received: by mail-wg0-f43.google.com with SMTP id l18so15486668wgh.26 for ; Wed, 27 Aug 2014 03:00:32 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <53FDAC3C.3030008@redhat.com> Date: Wed, 27 Aug 2014 12:00:28 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1409131452-11064-1-git-send-email-zhang.zhanghailiang@huawei.com> In-Reply-To: <1409131452-11064-1-git-send-email-zhang.zhanghailiang@huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] hmp: Add info machines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang , qemu-devel@nongnu.org Cc: hani@linux.com, luonengjun@huawei.com, peter.huangpeng@huawei.com, stefanha@redhat.com, lcapitulino@redhat.com Il 27/08/2014 11:24, zhanghailiang ha scritto: > This is the hmp counterpart of qmp query_machines > > Signed-off-by: zhanghailiang > --- > hmp-commands.hx | 2 ++ > hmp.c | 22 ++++++++++++++++++++++ > hmp.h | 1 + > monitor.c | 7 +++++++ > 4 files changed, 32 insertions(+) > > diff --git a/hmp-commands.hx b/hmp-commands.hx > index d0943b1..1d04235 100644 > --- a/hmp-commands.hx > +++ b/hmp-commands.hx > @@ -1780,6 +1780,8 @@ show qdev device model list > show roms > @item info tpm > show the TPM device > +@item info machines > +show supported machines information > @end table > ETEXI > > diff --git a/hmp.c b/hmp.c > index 4d1838e..603f2f5 100644 > --- a/hmp.c > +++ b/hmp.c > @@ -725,6 +725,28 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict) > qapi_free_TPMInfoList(info_list); > } > > +void hmp_info_machines(Monitor *mon, const QDict *qdict) > +{ > + MachineInfoList *mach_list = NULL, *cur_item = NULL; > + > + mach_list = qmp_query_machines(NULL); > + for (cur_item = mach_list; cur_item; cur_item = cur_item->next) { > + MachineInfo *machine; > + char default_chr = ' '; > + > + machine = cur_item->value; > + if (machine->is_default) { > + default_chr = '*'; > + } > + monitor_printf(mon, "%c %s:\n", default_chr, machine->name); > + monitor_printf(mon, " max_cpus: %" PRId64 "\n", machine->cpu_max); > + if (machine->has_alias) { > + monitor_printf(mon, " alias: %s\n", machine->alias); > + } > + } > + qapi_free_MachineInfoList(mach_list); > +} > + > void hmp_quit(Monitor *mon, const QDict *qdict) > { > monitor_suspend(mon); > diff --git a/hmp.h b/hmp.h > index 4fd3c4a..374e841 100644 > --- a/hmp.h > +++ b/hmp.h > @@ -38,6 +38,7 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict); > void hmp_info_pci(Monitor *mon, const QDict *qdict); > void hmp_info_block_jobs(Monitor *mon, const QDict *qdict); > void hmp_info_tpm(Monitor *mon, const QDict *qdict); > +void hmp_info_machines(Monitor *mon, const QDict *qdict); > void hmp_quit(Monitor *mon, const QDict *qdict); > void hmp_stop(Monitor *mon, const QDict *qdict); > void hmp_system_reset(Monitor *mon, const QDict *qdict); > diff --git a/monitor.c b/monitor.c > index 34cee74..adc3645 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -2921,6 +2921,13 @@ static mon_cmd_t info_cmds[] = { > .mhandler.cmd = hmp_info_memdev, > }, > { > + .name = "machines", > + .args_type = "", > + .params = "", > + .help = "show supported machines information", > + .mhandler.cmd = hmp_info_machines, > + }, > + { > .name = NULL, > }, > }; > What is this useful for? You can use "-machine help". Paolo