Re: [Qemu-devel] [PATCH 7/7] monitor: QMP/HMP support for retrieving VNVRAM details
On Thu, 23 May 2013 13:44:47 -0400 Corey Bryant cor...@linux.vnet.ibm.com wrote: Signed-off-by: Corey Bryant cor...@linux.vnet.ibm.com Looks good to me, only one small nit below. --- hmp.c| 32 hmp.h|1 + monitor.c|7 + qapi-schema.json | 47 +++ qmp-commands.hx | 41 +++ vnvram.c | 71 ++ 6 files changed, 199 insertions(+), 0 deletions(-) diff --git a/hmp.c b/hmp.c index 4fb76ec..a144f73 100644 --- a/hmp.c +++ b/hmp.c @@ -653,6 +653,38 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict) qapi_free_TPMInfoList(info_list); } +void hmp_info_vnvram(Monitor *mon, const QDict *dict) +{ +VNVRAMInfoList *info_list, *info; +Error *err = NULL; +unsigned int c = 0; + +info_list = qmp_query_vnvram(err); +if (err) { +monitor_printf(mon, VNVRAM not found\n); +error_free(err); +return; +} + +for (info = info_list; info; info = info-next) { +VNVRAMInfo *ni = info-value; +VNVRAMEntryInfoList *einfo_list = ni-entries, *einfo; +unsigned int d = 0; +monitor_printf(mon, vnvram%u: drive-id=%s + virtual-disk-size=%PRId64 vnvram-size=%PRIu64\n, + c++, ni-drive_id, ni-virtual_disk_size, + ni-vnvram_size); + +for (einfo = einfo_list; einfo; einfo = einfo-next) { +VNVRAMEntryInfo *nei = einfo-value; +monitor_printf(mon, entry%u: name=%s cur-size=%PRIu64 + max-size=%PRIu64\n, + d++, nei-name, nei-cur_size, nei-max_size); +} +} +qapi_free_VNVRAMInfoList(info_list); +} + void hmp_quit(Monitor *mon, const QDict *qdict) { monitor_suspend(mon); diff --git a/hmp.h b/hmp.h index 95fe76e..e26daf2 100644 --- a/hmp.h +++ b/hmp.h @@ -37,6 +37,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_vnvram(Monitor *mon, const QDict *dict); 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 62aaebe..c10fe15 100644 --- a/monitor.c +++ b/monitor.c @@ -2764,6 +2764,13 @@ static mon_cmd_t info_cmds[] = { .mhandler.cmd = hmp_info_tpm, }, { +.name = vnvram, +.args_type = , +.params = , +.help = show VNVRAM information, +.mhandler.cmd = hmp_info_vnvram, +}, +{ .name = NULL, }, }; diff --git a/qapi-schema.json b/qapi-schema.json index 9302e7d..73d42d6 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3619,3 +3619,50 @@ '*cpuid-input-ecx': 'int', 'cpuid-register': 'X86CPURegister32', 'features': 'int' } } + +# @VNVRAMEntryInfo: +# +# Information about an entry in the VNVRAM. +# +# @name: name of the entry +# +# @cur-size: current size of the entry's blob in bytes It's preferable not to abbreviate, you can have current-size. +# +# @max-size: max size of the entry's blob in bytes +# +# Since: 1.6 +# +## +{ 'type': 'VNVRAMEntryInfo', + 'data': {'name': 'str', 'cur-size': 'int', 'max-size': 'int', } } + +## +# @VNVRAMInfo: +# +# Information about the VNVRAM device. +# +# @drive-id: ID of the VNVRAM (and associated drive) +# +# @virtual-disk-size: Virtual size of the associated disk drive in bytes +# +# @vnvram-size: Size of the VNVRAM in bytes +# +# @entries: Array of @VNVRAMEntryInfo +# +# Since: 1.6 +# +## +{ 'type': 'VNVRAMInfo', + 'data': {'drive-id': 'str', 'virtual-disk-size': 'int', + 'vnvram-size': 'int', 'entries' : ['VNVRAMEntryInfo']} } + +## +# @query-vnvram: +# +# Return information about the VNVRAM devices. +# +# Returns: @VNVRAMInfo on success +# +# Since: 1.6 +## +{ 'command': 'query-vnvram', 'returns': ['VNVRAMInfo'] } diff --git a/qmp-commands.hx b/qmp-commands.hx index ffd130e..56a57b7 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -2932,3 +2932,44 @@ Example: - { return: {} } EQMP + +{ +.name = query-vnvram, +.args_type = , +.mhandler.cmd_new = qmp_marshal_input_query_vnvram, +}, + +SQMP +query-vnvram + + +Show VNVRAM info. + +Return a json-array of json-objects representing VNVRAMs. Each VNVRAM +is described by a json-object with the following: + +- drive-id: ID of the VNVRAM (json-string) +- vitual-disk-size: Virtual size of associated disk drive in
Re: [Qemu-devel] [PATCH 7/7] monitor: QMP/HMP support for retrieving VNVRAM details
On 05/29/2013 01:15 PM, Luiz Capitulino wrote: On Thu, 23 May 2013 13:44:47 -0400 Corey Bryant cor...@linux.vnet.ibm.com wrote: Signed-off-by: Corey Bryant cor...@linux.vnet.ibm.com Looks good to me, only one small nit below. It looks like this series is going to get dropped, but thanks for the review! -- Regards, Corey Bryant --- hmp.c| 32 hmp.h|1 + monitor.c|7 + qapi-schema.json | 47 +++ qmp-commands.hx | 41 +++ vnvram.c | 71 ++ 6 files changed, 199 insertions(+), 0 deletions(-) diff --git a/hmp.c b/hmp.c index 4fb76ec..a144f73 100644 --- a/hmp.c +++ b/hmp.c @@ -653,6 +653,38 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict) qapi_free_TPMInfoList(info_list); } +void hmp_info_vnvram(Monitor *mon, const QDict *dict) +{ +VNVRAMInfoList *info_list, *info; +Error *err = NULL; +unsigned int c = 0; + +info_list = qmp_query_vnvram(err); +if (err) { +monitor_printf(mon, VNVRAM not found\n); +error_free(err); +return; +} + +for (info = info_list; info; info = info-next) { +VNVRAMInfo *ni = info-value; +VNVRAMEntryInfoList *einfo_list = ni-entries, *einfo; +unsigned int d = 0; +monitor_printf(mon, vnvram%u: drive-id=%s + virtual-disk-size=%PRId64 vnvram-size=%PRIu64\n, + c++, ni-drive_id, ni-virtual_disk_size, + ni-vnvram_size); + +for (einfo = einfo_list; einfo; einfo = einfo-next) { +VNVRAMEntryInfo *nei = einfo-value; +monitor_printf(mon, entry%u: name=%s cur-size=%PRIu64 + max-size=%PRIu64\n, + d++, nei-name, nei-cur_size, nei-max_size); +} +} +qapi_free_VNVRAMInfoList(info_list); +} + void hmp_quit(Monitor *mon, const QDict *qdict) { monitor_suspend(mon); diff --git a/hmp.h b/hmp.h index 95fe76e..e26daf2 100644 --- a/hmp.h +++ b/hmp.h @@ -37,6 +37,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_vnvram(Monitor *mon, const QDict *dict); 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 62aaebe..c10fe15 100644 --- a/monitor.c +++ b/monitor.c @@ -2764,6 +2764,13 @@ static mon_cmd_t info_cmds[] = { .mhandler.cmd = hmp_info_tpm, }, { +.name = vnvram, +.args_type = , +.params = , +.help = show VNVRAM information, +.mhandler.cmd = hmp_info_vnvram, +}, +{ .name = NULL, }, }; diff --git a/qapi-schema.json b/qapi-schema.json index 9302e7d..73d42d6 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3619,3 +3619,50 @@ '*cpuid-input-ecx': 'int', 'cpuid-register': 'X86CPURegister32', 'features': 'int' } } + +# @VNVRAMEntryInfo: +# +# Information about an entry in the VNVRAM. +# +# @name: name of the entry +# +# @cur-size: current size of the entry's blob in bytes It's preferable not to abbreviate, you can have current-size. +# +# @max-size: max size of the entry's blob in bytes +# +# Since: 1.6 +# +## +{ 'type': 'VNVRAMEntryInfo', + 'data': {'name': 'str', 'cur-size': 'int', 'max-size': 'int', } } + +## +# @VNVRAMInfo: +# +# Information about the VNVRAM device. +# +# @drive-id: ID of the VNVRAM (and associated drive) +# +# @virtual-disk-size: Virtual size of the associated disk drive in bytes +# +# @vnvram-size: Size of the VNVRAM in bytes +# +# @entries: Array of @VNVRAMEntryInfo +# +# Since: 1.6 +# +## +{ 'type': 'VNVRAMInfo', + 'data': {'drive-id': 'str', 'virtual-disk-size': 'int', + 'vnvram-size': 'int', 'entries' : ['VNVRAMEntryInfo']} } + +## +# @query-vnvram: +# +# Return information about the VNVRAM devices. +# +# Returns: @VNVRAMInfo on success +# +# Since: 1.6 +## +{ 'command': 'query-vnvram', 'returns': ['VNVRAMInfo'] } diff --git a/qmp-commands.hx b/qmp-commands.hx index ffd130e..56a57b7 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -2932,3 +2932,44 @@ Example: - { return: {} } EQMP + +{ +.name = query-vnvram, +.args_type = , +.mhandler.cmd_new = qmp_marshal_input_query_vnvram, +}, + +SQMP +query-vnvram + + +Show VNVRAM info. + +Return a json-array of json-objects representing VNVRAMs. Each VNVRAM +is described by a json-object with the following: + +- drive-id: ID of the VNVRAM (json-string) +- vitual-disk-size: Virtual size of
[Qemu-devel] [PATCH 7/7] monitor: QMP/HMP support for retrieving VNVRAM details
Signed-off-by: Corey Bryant cor...@linux.vnet.ibm.com --- hmp.c| 32 hmp.h|1 + monitor.c|7 + qapi-schema.json | 47 +++ qmp-commands.hx | 41 +++ vnvram.c | 71 ++ 6 files changed, 199 insertions(+), 0 deletions(-) diff --git a/hmp.c b/hmp.c index 4fb76ec..a144f73 100644 --- a/hmp.c +++ b/hmp.c @@ -653,6 +653,38 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict) qapi_free_TPMInfoList(info_list); } +void hmp_info_vnvram(Monitor *mon, const QDict *dict) +{ +VNVRAMInfoList *info_list, *info; +Error *err = NULL; +unsigned int c = 0; + +info_list = qmp_query_vnvram(err); +if (err) { +monitor_printf(mon, VNVRAM not found\n); +error_free(err); +return; +} + +for (info = info_list; info; info = info-next) { +VNVRAMInfo *ni = info-value; +VNVRAMEntryInfoList *einfo_list = ni-entries, *einfo; +unsigned int d = 0; +monitor_printf(mon, vnvram%u: drive-id=%s + virtual-disk-size=%PRId64 vnvram-size=%PRIu64\n, + c++, ni-drive_id, ni-virtual_disk_size, + ni-vnvram_size); + +for (einfo = einfo_list; einfo; einfo = einfo-next) { +VNVRAMEntryInfo *nei = einfo-value; +monitor_printf(mon, entry%u: name=%s cur-size=%PRIu64 + max-size=%PRIu64\n, + d++, nei-name, nei-cur_size, nei-max_size); +} +} +qapi_free_VNVRAMInfoList(info_list); +} + void hmp_quit(Monitor *mon, const QDict *qdict) { monitor_suspend(mon); diff --git a/hmp.h b/hmp.h index 95fe76e..e26daf2 100644 --- a/hmp.h +++ b/hmp.h @@ -37,6 +37,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_vnvram(Monitor *mon, const QDict *dict); 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 62aaebe..c10fe15 100644 --- a/monitor.c +++ b/monitor.c @@ -2764,6 +2764,13 @@ static mon_cmd_t info_cmds[] = { .mhandler.cmd = hmp_info_tpm, }, { +.name = vnvram, +.args_type = , +.params = , +.help = show VNVRAM information, +.mhandler.cmd = hmp_info_vnvram, +}, +{ .name = NULL, }, }; diff --git a/qapi-schema.json b/qapi-schema.json index 9302e7d..73d42d6 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3619,3 +3619,50 @@ '*cpuid-input-ecx': 'int', 'cpuid-register': 'X86CPURegister32', 'features': 'int' } } + +# @VNVRAMEntryInfo: +# +# Information about an entry in the VNVRAM. +# +# @name: name of the entry +# +# @cur-size: current size of the entry's blob in bytes +# +# @max-size: max size of the entry's blob in bytes +# +# Since: 1.6 +# +## +{ 'type': 'VNVRAMEntryInfo', + 'data': {'name': 'str', 'cur-size': 'int', 'max-size': 'int', } } + +## +# @VNVRAMInfo: +# +# Information about the VNVRAM device. +# +# @drive-id: ID of the VNVRAM (and associated drive) +# +# @virtual-disk-size: Virtual size of the associated disk drive in bytes +# +# @vnvram-size: Size of the VNVRAM in bytes +# +# @entries: Array of @VNVRAMEntryInfo +# +# Since: 1.6 +# +## +{ 'type': 'VNVRAMInfo', + 'data': {'drive-id': 'str', 'virtual-disk-size': 'int', + 'vnvram-size': 'int', 'entries' : ['VNVRAMEntryInfo']} } + +## +# @query-vnvram: +# +# Return information about the VNVRAM devices. +# +# Returns: @VNVRAMInfo on success +# +# Since: 1.6 +## +{ 'command': 'query-vnvram', 'returns': ['VNVRAMInfo'] } diff --git a/qmp-commands.hx b/qmp-commands.hx index ffd130e..56a57b7 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -2932,3 +2932,44 @@ Example: - { return: {} } EQMP + +{ +.name = query-vnvram, +.args_type = , +.mhandler.cmd_new = qmp_marshal_input_query_vnvram, +}, + +SQMP +query-vnvram + + +Show VNVRAM info. + +Return a json-array of json-objects representing VNVRAMs. Each VNVRAM +is described by a json-object with the following: + +- drive-id: ID of the VNVRAM (json-string) +- vitual-disk-size: Virtual size of associated disk drive in bytes (json-int) +- vnvram-size: Size of the VNVRAM in bytes (json-int) +- entries: json-array of json-objects representing entries + +Each entry is described by a json-object with the following: + +- name: Name of the entry (json-string) +- cur-size: Current size of the entry's blob in bytes (json-int) +- max-size: Max size of the entry's blob in bytes
Re: [Qemu-devel] [PATCH 7/7] monitor: QMP/HMP support for retrieving VNVRAM details
On 05/23/2013 11:44 AM, Corey Bryant wrote: Signed-off-by: Corey Bryant cor...@linux.vnet.ibm.com --- Might help to list a sample HMP or QMP usage in the commit message. +++ b/qapi-schema.json @@ -3619,3 +3619,50 @@ '*cpuid-input-ecx': 'int', 'cpuid-register': 'X86CPURegister32', 'features': 'int' } } + +# @VNVRAMEntryInfo: +# +# Information about an entry in the VNVRAM. +# +# @name: name of the entry +# +# @cur-size: current size of the entry's blob in bytes +# +# @max-size: max size of the entry's blob in bytes +# +# Since: 1.6 +# +## +{ 'type': 'VNVRAMEntryInfo', + 'data': {'name': 'str', 'cur-size': 'int', 'max-size': 'int', } } No trailing commas in JSON. :( + +## +# @VNVRAMInfo: +# +# Information about the VNVRAM device. +# +# @drive-id: ID of the VNVRAM (and associated drive) +# +# @virtual-disk-size: Virtual size of the associated disk drive in bytes +# +# @vnvram-size: Size of the VNVRAM in bytes +# +# @entries: Array of @VNVRAMEntryInfo +# +# Since: 1.6 +# +## +{ 'type': 'VNVRAMInfo', + 'data': {'drive-id': 'str', 'virtual-disk-size': 'int', + 'vnvram-size': 'int', 'entries' : ['VNVRAMEntryInfo']} } + +## +# @query-vnvram: +# +# Return information about the VNVRAM devices. +# +# Returns: @VNVRAMInfo on success +# +# Since: 1.6 +## +{ 'command': 'query-vnvram', 'returns': ['VNVRAMInfo'] } Other than that, this looks fine from an interface point of view. I haven't closely reviewed code, though. + +Example: + +- { execute: query-vnvram } +- {return: [ + { vnvram-size: 2050, virtual-disk-size: 2000896, +drive-id: drive-ide0-0-0, +entries: [ + { name: this-entry, cur-size: 2048, max-size: 21504 }, + { name: that-entry, cur-size: 1024, max-size: 21504 }, + { name: other-entry, cur-size: 4096, max-size: 41472 } ] + } ] + } Looks reasonable. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature
Re: [Qemu-devel] [PATCH 7/7] monitor: QMP/HMP support for retrieving VNVRAM details
On 05/23/2013 01:59 PM, Eric Blake wrote: On 05/23/2013 11:44 AM, Corey Bryant wrote: Signed-off-by: Corey Bryant cor...@linux.vnet.ibm.com --- Might help to list a sample HMP or QMP usage in the commit message. +++ b/qapi-schema.json @@ -3619,3 +3619,50 @@ '*cpuid-input-ecx': 'int', 'cpuid-register': 'X86CPURegister32', 'features': 'int' } } + +# @VNVRAMEntryInfo: +# +# Information about an entry in the VNVRAM. +# +# @name: name of the entry +# +# @cur-size: current size of the entry's blob in bytes +# +# @max-size: max size of the entry's blob in bytes +# +# Since: 1.6 +# +## +{ 'type': 'VNVRAMEntryInfo', + 'data': {'name': 'str', 'cur-size': 'int', 'max-size': 'int', } } No trailing commas in JSON. :( I'll fix that. + +## +# @VNVRAMInfo: +# +# Information about the VNVRAM device. +# +# @drive-id: ID of the VNVRAM (and associated drive) +# +# @virtual-disk-size: Virtual size of the associated disk drive in bytes +# +# @vnvram-size: Size of the VNVRAM in bytes +# +# @entries: Array of @VNVRAMEntryInfo +# +# Since: 1.6 +# +## +{ 'type': 'VNVRAMInfo', + 'data': {'drive-id': 'str', 'virtual-disk-size': 'int', + 'vnvram-size': 'int', 'entries' : ['VNVRAMEntryInfo']} } + +## +# @query-vnvram: +# +# Return information about the VNVRAM devices. +# +# Returns: @VNVRAMInfo on success +# +# Since: 1.6 +## +{ 'command': 'query-vnvram', 'returns': ['VNVRAMInfo'] } Other than that, this looks fine from an interface point of view. I haven't closely reviewed code, though. + +Example: + +- { execute: query-vnvram } +- {return: [ + { vnvram-size: 2050, virtual-disk-size: 2000896, +drive-id: drive-ide0-0-0, +entries: [ + { name: this-entry, cur-size: 2048, max-size: 21504 }, + { name: that-entry, cur-size: 1024, max-size: 21504 }, + { name: other-entry, cur-size: 4096, max-size: 41472 } ] + } ] + } Looks reasonable. Thanks for the review! -- Regards, Corey Bryant