mirror of https://github.com/xqemu/xqemu.git
monitor: Convert do_info_balloon() to QObject
On success return a QInt with the balloon's value. This also introduces monitor_print_balloon() to print the balloon information in the user protocol. Please, note that errors are not being converted yet. Patchworks-ID: 35351 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
ab2d318762
commit
cc1d9c7015
16
monitor.c
16
monitor.c
|
@ -1633,7 +1633,16 @@ static void do_balloon(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||||
qemu_balloon(target << 20);
|
qemu_balloon(target << 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_info_balloon(Monitor *mon)
|
static void monitor_print_balloon(Monitor *mon, const QObject *data)
|
||||||
|
{
|
||||||
|
monitor_printf(mon, "balloon: actual=%d\n",
|
||||||
|
(int)qint_get_int(qobject_to_qint(data)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* do_info_balloon(): Balloon information
|
||||||
|
*/
|
||||||
|
static void do_info_balloon(Monitor *mon, QObject **ret_data)
|
||||||
{
|
{
|
||||||
ram_addr_t actual;
|
ram_addr_t actual;
|
||||||
|
|
||||||
|
@ -1644,7 +1653,7 @@ static void do_info_balloon(Monitor *mon)
|
||||||
else if (actual == 0)
|
else if (actual == 0)
|
||||||
monitor_printf(mon, "Ballooning not activated in VM\n");
|
monitor_printf(mon, "Ballooning not activated in VM\n");
|
||||||
else
|
else
|
||||||
monitor_printf(mon, "balloon: actual=%d\n", (int)(actual >> 20));
|
*ret_data = QOBJECT(qint_from_int((int)(actual >> 20)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static qemu_acl *find_acl(Monitor *mon, const char *name)
|
static qemu_acl *find_acl(Monitor *mon, const char *name)
|
||||||
|
@ -2107,7 +2116,8 @@ static const mon_cmd_t info_cmds[] = {
|
||||||
.args_type = "",
|
.args_type = "",
|
||||||
.params = "",
|
.params = "",
|
||||||
.help = "show balloon information",
|
.help = "show balloon information",
|
||||||
.mhandler.info = do_info_balloon,
|
.user_print = monitor_print_balloon,
|
||||||
|
.mhandler.info_new = do_info_balloon,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "qtree",
|
.name = "qtree",
|
||||||
|
|
Loading…
Reference in New Issue