* [Qemu-devel] [PATCH] hmp: Add info machines
@ 2014-08-27 9:24 zhanghailiang
2014-08-27 10:00 ` Paolo Bonzini
0 siblings, 1 reply; 5+ messages in thread
From: zhanghailiang @ 2014-08-27 9:24 UTC (permalink / raw)
To: qemu-devel
Cc: zhanghailiang, luonengjun, peter.huangpeng, lcapitulino, hani,
stefanha
This is the hmp counterpart of qmp query_machines
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
---
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,
},
};
--
1.7.12.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] hmp: Add info machines
2014-08-27 9:24 [Qemu-devel] [PATCH] hmp: Add info machines zhanghailiang
@ 2014-08-27 10:00 ` Paolo Bonzini
2014-08-28 1:44 ` zhanghailiang
0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2014-08-27 10:00 UTC (permalink / raw)
To: zhanghailiang, qemu-devel
Cc: hani, luonengjun, peter.huangpeng, stefanha, lcapitulino
Il 27/08/2014 11:24, zhanghailiang ha scritto:
> This is the hmp counterpart of qmp query_machines
>
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> ---
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] hmp: Add info machines
2014-08-27 10:00 ` Paolo Bonzini
@ 2014-08-28 1:44 ` zhanghailiang
2014-08-28 2:43 ` Amos Kong
0 siblings, 1 reply; 5+ messages in thread
From: zhanghailiang @ 2014-08-28 1:44 UTC (permalink / raw)
To: Paolo Bonzini
Cc: luonengjun, qemu-devel, lcapitulino, hani, stefanha,
peter.huangpeng
On 2014/8/27 18:00, Paolo Bonzini wrote:
> Il 27/08/2014 11:24, zhanghailiang ha scritto:
>> This is the hmp counterpart of qmp query_machines
>>
>> Signed-off-by: zhanghailiang<zhang.zhanghailiang@huawei.com>
>> ---
>> 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".
>
Hmm, i just looked into the qmp commands and hmp commands,
And found there is qmp_query_machines but no hmp_info_machines...
Sorry for the noise;)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] hmp: Add info machines
2014-08-28 1:44 ` zhanghailiang
@ 2014-08-28 2:43 ` Amos Kong
2014-08-28 4:56 ` zhanghailiang
0 siblings, 1 reply; 5+ messages in thread
From: Amos Kong @ 2014-08-28 2:43 UTC (permalink / raw)
To: zhanghailiang
Cc: luonengjun, qemu-devel, lcapitulino, hani, Stefan Hajnoczi,
Paolo Bonzini, peter.huangpeng
[-- Attachment #1: Type: text/plain, Size: 3592 bytes --]
On Thu, Aug 28, 2014 at 9:44 AM, zhanghailiang <
zhang.zhanghailiang@huawei.com> wrote:
> On 2014/8/27 18:00, Paolo Bonzini wrote:
>
>> Il 27/08/2014 11:24, zhanghailiang ha scritto:
>>
>>> This is the hmp counterpart of qmp query_machines
>>>
>>> Signed-off-by: zhanghailiang<zhang.zhanghailiang@huawei.com>
>>> ---
>>> 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".
>>
>>
> Hmm, i just looked into the qmp commands and hmp commands,
> And found there is qmp_query_machines but no hmp_info_machines...
>
> Sorry for the noise;)
>
>
There exists some QMP commands that don't have corresponding HMP commands.
QMP is the latest and recommended interface for management tools.
HMP command is not always necessary, unless you have a good reason :-)
[-- Attachment #2: Type: text/html, Size: 4737 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] hmp: Add info machines
2014-08-28 2:43 ` Amos Kong
@ 2014-08-28 4:56 ` zhanghailiang
0 siblings, 0 replies; 5+ messages in thread
From: zhanghailiang @ 2014-08-28 4:56 UTC (permalink / raw)
To: Amos Kong
Cc: luonengjun, qemu-devel, lcapitulino, hani, Stefan Hajnoczi,
Paolo Bonzini, peter.huangpeng
On 2014/8/28 10:43, Amos Kong wrote:
> On Thu, Aug 28, 2014 at 9:44 AM, zhanghailiang<
> zhang.zhanghailiang@huawei.com> wrote:
>
>> On 2014/8/27 18:00, Paolo Bonzini wrote:
>>
>>> Il 27/08/2014 11:24, zhanghailiang ha scritto:
>>>
>>>> This is the hmp counterpart of qmp query_machines
>>>>
>>>> Signed-off-by: zhanghailiang<zhang.zhanghailiang@huawei.com>
>>>> ---
>>>> 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".
>>>
>>>
>> Hmm, i just looked into the qmp commands and hmp commands,
>> And found there is qmp_query_machines but no hmp_info_machines...
>>
>> Sorry for the noise;)
>>
>>
> There exists some QMP commands that don't have corresponding HMP commands.
> QMP is the latest and recommended interface for management tools.
> HMP command is not always necessary, unless you have a good reason :-)
>
Got it, Thanks.:)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-08-28 4:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-27 9:24 [Qemu-devel] [PATCH] hmp: Add info machines zhanghailiang
2014-08-27 10:00 ` Paolo Bonzini
2014-08-28 1:44 ` zhanghailiang
2014-08-28 2:43 ` Amos Kong
2014-08-28 4:56 ` zhanghailiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).