X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=balloon.c;h=f2ef50cf77cb0d59e6902b3f77869eb5f5cfd3df;hb=8046bf53ba447a6b8932c046cc84845e9cecc804;hp=dea19a470aced08b9f8f64f181960701e4af08ed;hpb=651621b780515f35711c5d7305310ab1d241c7e2;p=mirror_qemu.git diff --git a/balloon.c b/balloon.c index dea19a470a..f2ef50cf77 100644 --- a/balloon.c +++ b/balloon.c @@ -24,19 +24,32 @@ * THE SOFTWARE. */ -#include "monitor/monitor.h" +#include "qemu/osdep.h" +#include "qemu-common.h" #include "exec/cpu-common.h" #include "sysemu/kvm.h" #include "sysemu/balloon.h" #include "trace.h" #include "qmp-commands.h" +#include "qapi/qmp/qerror.h" #include "qapi/qmp/qjson.h" static QEMUBalloonEvent *balloon_event_fn; static QEMUBalloonStatus *balloon_stat_fn; static void *balloon_opaque; +static bool balloon_inhibited; -static bool have_ballon(Error **errp) +bool qemu_balloon_is_inhibited(void) +{ + return balloon_inhibited; +} + +void qemu_balloon_inhibit(bool state) +{ + balloon_inhibited = state; +} + +static bool have_balloon(Error **errp) { if (kvm_enabled() && !kvm_has_sync_mmu()) { error_set(errp, ERROR_CLASS_KVM_MISSING_CAP, @@ -58,7 +71,6 @@ int qemu_add_balloon_handler(QEMUBalloonEvent *event_func, /* We're already registered one balloon handler. How many can * a guest really have? */ - error_report("Another balloon device already registered"); return -1; } balloon_event_fn = event_func; @@ -81,7 +93,7 @@ BalloonInfo *qmp_query_balloon(Error **errp) { BalloonInfo *info; - if (!have_ballon(errp)) { + if (!have_balloon(errp)) { return NULL; } @@ -92,12 +104,12 @@ BalloonInfo *qmp_query_balloon(Error **errp) void qmp_balloon(int64_t target, Error **errp) { - if (!have_ballon(errp)) { + if (!have_balloon(errp)) { return; } if (target <= 0) { - error_set(errp, QERR_INVALID_PARAMETER_VALUE, "target", "a size"); + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "target", "a size"); return; }