diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2010-04-01 19:57:12 +0200 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2010-04-09 18:55:56 +0200 |
commit | 28c289737309f0a6ea6e108b2bb5e2e93c6d7233 (patch) | |
tree | b08de77b0948a1985d12a27943b83011424c4670 /monitor.c | |
parent | 00a1555e0cff5d710ea63145b18e2915b84b58de (diff) | |
download | qemu-28c289737309f0a6ea6e108b2bb5e2e93c6d7233.zip qemu-28c289737309f0a6ea6e108b2bb5e2e93c6d7233.tar.gz qemu-28c289737309f0a6ea6e108b2bb5e2e93c6d7233.tar.bz2 |
move balloon handling to balloon.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 85 |
1 files changed, 0 insertions, 85 deletions
@@ -2266,91 +2266,6 @@ static void do_info_status(Monitor *mon, QObject **ret_data) vm_running, singlestep); } -static void print_balloon_stat(const char *key, QObject *obj, void *opaque) -{ - Monitor *mon = opaque; - - if (strcmp(key, "actual")) - monitor_printf(mon, ",%s=%" PRId64, key, - qint_get_int(qobject_to_qint(obj))); -} - -static void monitor_print_balloon(Monitor *mon, const QObject *data) -{ - QDict *qdict; - - qdict = qobject_to_qdict(data); - if (!qdict_haskey(qdict, "actual")) - return; - - monitor_printf(mon, "balloon: actual=%" PRId64, - qdict_get_int(qdict, "actual") >> 20); - qdict_iter(qdict, print_balloon_stat, mon); - monitor_printf(mon, "\n"); -} - -/** - * do_info_balloon(): Balloon information - * - * Make an asynchronous request for balloon info. When the request completes - * a QDict will be returned according to the following specification: - * - * - "actual": current balloon value in bytes - * The following fields may or may not be present: - * - "mem_swapped_in": Amount of memory swapped in (bytes) - * - "mem_swapped_out": Amount of memory swapped out (bytes) - * - "major_page_faults": Number of major faults - * - "minor_page_faults": Number of minor faults - * - "free_mem": Total amount of free and unused memory (bytes) - * - "total_mem": Total amount of available memory (bytes) - * - * Example: - * - * { "actual": 1073741824, "mem_swapped_in": 0, "mem_swapped_out": 0, - * "major_page_faults": 142, "minor_page_faults": 239245, - * "free_mem": 1014185984, "total_mem": 1044668416 } - */ -static int do_info_balloon(Monitor *mon, MonitorCompletion cb, void *opaque) -{ - int ret; - - if (kvm_enabled() && !kvm_has_sync_mmu()) { - qerror_report(QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon"); - return -1; - } - - ret = qemu_balloon_status(cb, opaque); - if (!ret) { - qerror_report(QERR_DEVICE_NOT_ACTIVE, "balloon"); - return -1; - } - - return 0; -} - -/** - * do_balloon(): Request VM to change its memory allocation - */ -static int do_balloon(Monitor *mon, const QDict *params, - MonitorCompletion cb, void *opaque) -{ - int ret; - - if (kvm_enabled() && !kvm_has_sync_mmu()) { - qerror_report(QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon"); - return -1; - } - - ret = qemu_balloon(qdict_get_int(params, "value"), cb, opaque); - if (ret == 0) { - qerror_report(QERR_DEVICE_NOT_ACTIVE, "balloon"); - return -1; - } - - cb(opaque, NULL); - return 0; -} - static qemu_acl *find_acl(Monitor *mon, const char *name) { qemu_acl *acl = qemu_acl_find(name); |