aboutsummaryrefslogtreecommitdiff
path: root/savevm.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-08-20 19:42:22 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-08-27 20:30:20 -0500
commit05f2401eb25fd35b073ca925a9c3929eddb12ec8 (patch)
tree83f720efd2b189a3a16faa24c8d7bf15efbc4f29 /savevm.c
parentc8d41b2c2906f31181e9e5d479b76066a700a983 (diff)
make load_vmstate() return errors
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'savevm.c')
-rw-r--r--savevm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/savevm.c b/savevm.c
index f14487cad2..f273cb98bd 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1174,7 +1174,7 @@ void do_savevm(Monitor *mon, const char *name)
vm_start();
}
-void load_vmstate(Monitor *mon, const char *name)
+int load_vmstate(Monitor *mon, const char *name)
{
DriveInfo *dinfo;
BlockDriverState *bs, *bs1;
@@ -1185,7 +1185,7 @@ void load_vmstate(Monitor *mon, const char *name)
bs = get_bs_snapshots();
if (!bs) {
monitor_printf(mon, "No block device supports snapshots\n");
- return;
+ return -EINVAL;
}
/* Flush all IO requests so they don't interfere with the new state. */
@@ -1216,7 +1216,7 @@ void load_vmstate(Monitor *mon, const char *name)
}
/* fatal on snapshot block device */
if (bs == bs1)
- return;
+ return 0;
}
}
}
@@ -1224,19 +1224,21 @@ void load_vmstate(Monitor *mon, const char *name)
/* Don't even try to load empty VM states */
ret = bdrv_snapshot_find(bs, &sn, name);
if ((ret >= 0) && (sn.vm_state_size == 0))
- return;
+ return -EINVAL;
/* restore the VM state */
f = qemu_fopen_bdrv(bs, 0);
if (!f) {
monitor_printf(mon, "Could not open VM state file\n");
- return;
+ return -EINVAL;
}
ret = qemu_loadvm_state(f);
qemu_fclose(f);
if (ret < 0) {
monitor_printf(mon, "Error %d while loading VM state\n", ret);
+ return ret;
}
+ return 0;
}
void do_delvm(Monitor *mon, const char *name)