@@ -2871,20 +2871,20 @@ int load_snapshot(const char *name, Error **errp)
if (!replay_can_snapshot()) {
error_setg(errp, "Record/replay does not allow loading snapshot "
"right now. Try once more later.");
- return -EINVAL;
+ return -1;
}
if (!bdrv_all_can_snapshot(errp)) {
- return -ENOTSUP;
+ return -1;
}
ret = bdrv_all_find_snapshot(name, errp);
if (ret < 0) {
- return ret;
+ return -1;
}
bs_vm_state = bdrv_all_find_vmstate_bs(errp);
if (!bs_vm_state) {
- return -ENOTSUP;
+ return -1;
}
aio_context = bdrv_get_aio_context(bs_vm_state);
@@ -2893,11 +2893,11 @@ int load_snapshot(const char *name, Error **errp)
ret = bdrv_snapshot_find(bs_vm_state, &sn, name);
aio_context_release(aio_context);
if (ret < 0) {
- return ret;
+ return -1;
} else if (sn.vm_state_size == 0) {
error_setg(errp, "This is a disk-only snapshot. Revert to it "
" offline using qemu-img");
- return -EINVAL;
+ return -1;
}
/* Flush all IO requests so they don't interfere with the new state. */
@@ -2912,7 +2912,6 @@ int load_snapshot(const char *name, Error **errp)
f = qemu_fopen_bdrv(bs_vm_state, 0);
if (!f) {
error_setg(errp, "Could not open VM state file");
- ret = -EINVAL;
goto err_drain;
}
@@ -2928,14 +2927,14 @@ int load_snapshot(const char *name, Error **errp)
if (ret < 0) {
error_setg(errp, "Error %d while loading VM state", ret);
- return ret;
+ return -1;
}
return 0;
err_drain:
bdrv_drain_all_end();
- return ret;
+ return -1;
}
void vmstate_register_ram(MemoryRegion *mr, DeviceState *dev)