From d72f326431e280a619a0fd55e27d3737747f8178 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Fri, 25 Nov 2011 14:38:09 -0200 Subject: qapi: Convert balloon Note that the command being dropped uses the deprecated MONITOR_CMD_ASYNC API, but the new command is a regular synchronous command. There shouldn't be visible differences though, as MONITOR_CMD_ASYNC is internal only. Signed-off-by: Anthony Liguori Signed-off-by: Luiz Capitulino --- balloon.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'balloon.c') diff --git a/balloon.c b/balloon.c index e1cd5fac4c..0166744aa8 100644 --- a/balloon.c +++ b/balloon.c @@ -100,31 +100,19 @@ BalloonInfo *qmp_query_balloon(Error **errp) return info; } -/** - * do_balloon(): Request VM to change its memory allocation - */ -int do_balloon(Monitor *mon, const QDict *params, - MonitorCompletion cb, void *opaque) +void qmp_balloon(int64_t value, Error **errp) { - int64_t target; - int ret; - if (kvm_enabled() && !kvm_has_sync_mmu()) { - qerror_report(QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon"); - return -1; + error_set(errp, QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon"); + return; } - target = qdict_get_int(params, "value"); - if (target <= 0) { + if (value <= 0) { qerror_report(QERR_INVALID_PARAMETER_VALUE, "target", "a size"); - return -1; + return; } - ret = qemu_balloon(target); - if (ret == 0) { - qerror_report(QERR_DEVICE_NOT_ACTIVE, "balloon"); - return -1; + + if (qemu_balloon(value) == 0) { + error_set(errp, QERR_DEVICE_NOT_ACTIVE, "balloon"); } - - cb(opaque, NULL); - return 0; } -- cgit v1.2.1