aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2009-12-10 17:15:55 -0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-12 08:17:31 -0600
commitb0a84d0525ac84acabe69ebee552eac1a416724c (patch)
tree623a23b64dabf0b3bd462a6d986f941e57ffb070
parentf1f84ba22399b3a47d09d20ce498aef3df1da05f (diff)
monitor: Fix do_info_balloon() output
Monitor commands should always return values in bytes and info commands should always return a QDict. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 7f1796713ed2f338bd9abc094aacf10f67aed1e5)
-rw-r--r--monitor.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/monitor.c b/monitor.c
index 8a1be393aa..d942d33edf 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1919,12 +1919,24 @@ static void do_balloon(Monitor *mon, const QDict *qdict, QObject **ret_data)
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)));
+ QDict *qdict;
+
+ qdict = qobject_to_qdict(data);
+
+ monitor_printf(mon, "balloon: actual=%" PRId64 "\n",
+ qdict_get_int(qdict, "balloon") >> 20);
}
/**
* do_info_balloon(): Balloon information
+ *
+ * Return a QDict with the following information:
+ *
+ * - "balloon": current balloon value in bytes
+ *
+ * Example:
+ *
+ * { "balloon": 1073741824 }
*/
static void do_info_balloon(Monitor *mon, QObject **ret_data)
{
@@ -1936,7 +1948,8 @@ static void do_info_balloon(Monitor *mon, QObject **ret_data)
else if (actual == 0)
qemu_error_new(QERR_DEVICE_NOT_ACTIVE, "balloon");
else
- *ret_data = QOBJECT(qint_from_int((int)(actual >> 20)));
+ *ret_data = qobject_from_jsonf("{ 'balloon': %" PRId64 "}",
+ (int64_t) actual);
}
static qemu_acl *find_acl(Monitor *mon, const char *name)