aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2021-02-04 12:48:25 +0000
committerDr. David Alan Gilbert <dgilbert@redhat.com>2021-02-08 11:19:51 +0000
commitf61fe11aa6f7f8f0ffe4ddaa56a8108f3ab57854 (patch)
tree9b9a2837f33ce6c5618b7ca01dd1455fd420583f /migration
parent7ea14df230b98ffb33342f40cfffbdbb8ddd2b06 (diff)
migration: stop returning errno from load_snapshot()
None of the callers care about the errno value since there is a full Error object populated. This gives consistency with save_snapshot() which already just returns a boolean value. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> [PMD: Return false/true instead of -1/0, document function] Acked-by: Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210204124834.774401-4-berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/savevm.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/migration/savevm.c b/migration/savevm.c
index 63f1e63e51..b85eefd682 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2965,7 +2965,7 @@ void qmp_xen_load_devices_state(const char *filename, Error **errp)
migration_incoming_state_destroy();
}
-int load_snapshot(const char *name, Error **errp)
+bool load_snapshot(const char *name, Error **errp)
{
BlockDriverState *bs_vm_state;
QEMUSnapshotInfo sn;
@@ -2975,16 +2975,16 @@ int load_snapshot(const char *name, Error **errp)
MigrationIncomingState *mis = migration_incoming_get_current();
if (!bdrv_all_can_snapshot(errp)) {
- return -ENOTSUP;
+ return false;
}
ret = bdrv_all_find_snapshot(name, errp);
if (ret < 0) {
- return ret;
+ return false;
}
bs_vm_state = bdrv_all_find_vmstate_bs(errp);
if (!bs_vm_state) {
- return -ENOTSUP;
+ return false;
}
aio_context = bdrv_get_aio_context(bs_vm_state);
@@ -2993,11 +2993,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 false;
} 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 false;
}
/*
@@ -3018,7 +3018,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;
}
@@ -3038,14 +3037,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 false;
}
- return 0;
+ return true;
err_drain:
bdrv_drain_all_end();
- return ret;
+ return false;
}
void vmstate_register_ram(MemoryRegion *mr, DeviceState *dev)