diff options
author | Markus Armbruster <armbru@redhat.com> | 2010-02-17 16:24:10 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2010-03-16 16:55:05 +0100 |
commit | 03cd4655cbbc304f355deffd3413f7e3cbbcbe5e (patch) | |
tree | eaf8460c1e6c16ad44341768c392328ba7d9486b /savevm.c | |
parent | 4491e0f3984c81ebe12027de2f3d185953f09bde (diff) | |
download | qemu-03cd4655cbbc304f355deffd3413f7e3cbbcbe5e.zip qemu-03cd4655cbbc304f355deffd3413f7e3cbbcbe5e.tar.gz qemu-03cd4655cbbc304f355deffd3413f7e3cbbcbe5e.tar.bz2 |
savevm: Fix -loadvm to report errors to stderr, not the monitor
A monitor may not even exist.
Change load_vmstate() to use qemu_error() instead of monitor_printf().
Parameter mon is now unused, remove it.
Diffstat (limited to 'savevm.c')
-rw-r--r-- | savevm.c | 24 |
1 files changed, 11 insertions, 13 deletions
@@ -1737,7 +1737,7 @@ void do_savevm(Monitor *mon, const QDict *qdict) vm_start(); } -int load_vmstate(Monitor *mon, const char *name) +int load_vmstate(const char *name) { DriveInfo *dinfo; BlockDriverState *bs, *bs1; @@ -1747,7 +1747,7 @@ int load_vmstate(Monitor *mon, const char *name) bs = get_bs_snapshots(); if (!bs) { - monitor_printf(mon, "No block device supports snapshots\n"); + qemu_error("No block device supports snapshots\n"); return -EINVAL; } @@ -1760,21 +1760,19 @@ int load_vmstate(Monitor *mon, const char *name) ret = bdrv_snapshot_goto(bs1, name); if (ret < 0) { if (bs != bs1) - monitor_printf(mon, "Warning: "); + qemu_error("Warning: "); switch(ret) { case -ENOTSUP: - monitor_printf(mon, - "Snapshots not supported on device '%s'\n", - bdrv_get_device_name(bs1)); + qemu_error("Snapshots not supported on device '%s'\n", + bdrv_get_device_name(bs1)); break; case -ENOENT: - monitor_printf(mon, "Could not find snapshot '%s' on " - "device '%s'\n", - name, bdrv_get_device_name(bs1)); + qemu_error("Could not find snapshot '%s' on device '%s'\n", + name, bdrv_get_device_name(bs1)); break; default: - monitor_printf(mon, "Error %d while activating snapshot on" - " '%s'\n", ret, bdrv_get_device_name(bs1)); + qemu_error("Error %d while activating snapshot on '%s'\n", + ret, bdrv_get_device_name(bs1)); break; } /* fatal on snapshot block device */ @@ -1792,13 +1790,13 @@ int load_vmstate(Monitor *mon, const char *name) /* restore the VM state */ f = qemu_fopen_bdrv(bs, 0); if (!f) { - monitor_printf(mon, "Could not open VM state file\n"); + qemu_error("Could not open VM state file\n"); return -EINVAL; } ret = qemu_loadvm_state(f); qemu_fclose(f); if (ret < 0) { - monitor_printf(mon, "Error %d while loading VM state\n", ret); + qemu_error("Error %d while loading VM state\n", ret); return ret; } return 0; |