aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-12-20 12:28:51 +0200
committerAvi Kivity <avi@redhat.com>2009-12-20 12:28:51 +0200
commit210cd710b3bd36ca3c10e68b976f22319438f5ce (patch)
tree1031d5445f5513a414a7fa570d7a2b7f964428ea /monitor.c
parentMerge commit '686a3c3dc235df2492e754423799d1abe4f6d9e2' into stable-0.12-merge (diff)
parentMake sure to enable dirty tracking of VBE vram mapping (diff)
downloadqemu-kvm-210cd710b3bd36ca3c10e68b976f22319438f5ce.tar.gz
qemu-kvm-210cd710b3bd36ca3c10e68b976f22319438f5ce.tar.bz2
qemu-kvm-210cd710b3bd36ca3c10e68b976f22319438f5ce.zip
Merge commit '3c547d7bb7889182d5bcecbb3edea4c71774c6a3' into stable-0.12-merge
* commit '3c547d7bb7889182d5bcecbb3edea4c71774c6a3': (23 commits) Make sure to enable dirty tracking of VBE vram mapping vmware: setup PCI BAR 2 for FIFO as per vmware spec qdev: improve property error reporting. fix vga names in default_list usb-host: check mon before using it. usb-net: use qdev for -usbdevice Check rom_load_all() return value. defaults: update device_list[] defaults: split default_drive monitor: Catch printing to non-existent monitor monitor: Avoid readline functions in QMP monitor: do_balloon(): Check for errors monitor: Use 'device' in eject QDict: Fix size update qdev: Improve uni-north device names Avoid permanently disabled QEMU monitor when UNIX migration fails Fix loading of ELF multiboot kernels Revert "Rename DriveInfo.onerror to on_write_error" (fix mismerge) qemu-io: Fix memory leak Fix thinko in linuxboot.S ... Conflicts: hw/vga.c Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/monitor.c b/monitor.c
index ebdf941ef..573c76007 100644
--- a/monitor.c
+++ b/monitor.c
@@ -143,6 +143,9 @@ static inline int monitor_ctrl_mode(const Monitor *mon)
static void monitor_read_command(Monitor *mon, int show_prompt)
{
+ if (!mon->rs)
+ return;
+
readline_start(mon->rs, "(qemu) ", 0, monitor_command_cb, NULL);
if (show_prompt)
readline_show_prompt(mon->rs);
@@ -177,9 +180,6 @@ static void monitor_puts(Monitor *mon, const char *str)
{
char c;
- if (!mon)
- return;
-
for(;;) {
c = *str++;
if (c == '\0')
@@ -195,6 +195,9 @@ static void monitor_puts(Monitor *mon, const char *str)
void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
{
+ if (!mon)
+ return;
+
if (mon->mc && !mon->mc->print_enabled) {
qemu_error_new(QERR_UNDEFINED_ERROR);
} else {
@@ -894,7 +897,7 @@ static void do_eject(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
BlockDriverState *bs;
int force = qdict_get_int(qdict, "force");
- const char *filename = qdict_get_str(qdict, "filename");
+ const char *filename = qdict_get_str(qdict, "device");
bs = bdrv_find(filename);
if (!bs) {
@@ -2086,14 +2089,34 @@ static void do_info_status(Monitor *mon, QObject **ret_data)
vm_running, singlestep);
}
+static ram_addr_t balloon_get_value(void)
+{
+ ram_addr_t actual;
+
+ if (kvm_enabled() && !kvm_has_sync_mmu()) {
+ qemu_error_new(QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon");
+ return 0;
+ }
+
+ actual = qemu_balloon_status();
+ if (actual == 0) {
+ qemu_error_new(QERR_DEVICE_NOT_ACTIVE, "balloon");
+ return 0;
+ }
+
+ return actual;
+}
+
/**
* do_balloon(): Request VM to change its memory allocation
*/
static void do_balloon(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
- int value = qdict_get_int(qdict, "value");
- ram_addr_t target = value;
- qemu_balloon(target << 20);
+ if (balloon_get_value()) {
+ /* ballooning is active */
+ ram_addr_t value = qdict_get_int(qdict, "value");
+ qemu_balloon(value << 20);
+ }
}
static void monitor_print_balloon(Monitor *mon, const QObject *data)
@@ -2121,14 +2144,11 @@ static void do_info_balloon(Monitor *mon, QObject **ret_data)
{
ram_addr_t actual;
- actual = qemu_balloon_status();
- if (kvm_enabled() && !kvm_has_sync_mmu())
- qemu_error_new(QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon");
- else if (actual == 0)
- qemu_error_new(QERR_DEVICE_NOT_ACTIVE, "balloon");
- else
+ actual = balloon_get_value();
+ if (actual != 0) {
*ret_data = qobject_from_jsonf("{ 'balloon': %" PRId64 "}",
(int64_t) actual);
+ }
}
static qemu_acl *find_acl(Monitor *mon, const char *name)