mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-16 05:44:33 +00:00
monitor: Convert do_info_kvm() to QObject
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
c0e8520ed5
commit
2af5ba712b
41
monitor.c
41
monitor.c
@ -1806,16 +1806,40 @@ static void tlb_info(Monitor *mon)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void do_info_kvm(Monitor *mon)
|
static void do_info_kvm_print(Monitor *mon, const QObject *data)
|
||||||
|
{
|
||||||
|
QDict *qdict;
|
||||||
|
|
||||||
|
qdict = qobject_to_qdict(data);
|
||||||
|
|
||||||
|
monitor_printf(mon, "kvm support: ");
|
||||||
|
if (qdict_get_bool(qdict, "present")) {
|
||||||
|
monitor_printf(mon, "%s\n", qdict_get_bool(qdict, "enabled") ?
|
||||||
|
"enabled" : "disabled");
|
||||||
|
} else {
|
||||||
|
monitor_printf(mon, "not compiled\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* do_info_kvm(): Show KVM information
|
||||||
|
*
|
||||||
|
* Return a QDict with the following information:
|
||||||
|
*
|
||||||
|
* - "enabled": true if KVM support is enabled, false otherwise
|
||||||
|
* - "present": true if QEMU has KVM support, false otherwise
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* { "enabled": true, "present": true }
|
||||||
|
*/
|
||||||
|
static void do_info_kvm(Monitor *mon, QObject **ret_data)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_KVM
|
#ifdef CONFIG_KVM
|
||||||
monitor_printf(mon, "kvm support: ");
|
*ret_data = qobject_from_jsonf("{ 'enabled': %i, 'present': true }",
|
||||||
if (kvm_enabled())
|
kvm_enabled());
|
||||||
monitor_printf(mon, "enabled\n");
|
|
||||||
else
|
|
||||||
monitor_printf(mon, "disabled\n");
|
|
||||||
#else
|
#else
|
||||||
monitor_printf(mon, "kvm support: not compiled\n");
|
*ret_data = qobject_from_jsonf("{ 'enabled': false, 'present': false }");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2369,7 +2393,8 @@ static const mon_cmd_t info_cmds[] = {
|
|||||||
.args_type = "",
|
.args_type = "",
|
||||||
.params = "",
|
.params = "",
|
||||||
.help = "show KVM information",
|
.help = "show KVM information",
|
||||||
.mhandler.info = do_info_kvm,
|
.user_print = do_info_kvm_print,
|
||||||
|
.mhandler.info_new = do_info_kvm,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "numa",
|
.name = "numa",
|
||||||
|
Loading…
Reference in New Issue
Block a user