From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Peter Krempa <pkrempa@redhat.com>,
"Denis V. Lunev" <den@virtuozzo.com>,
qemu-block@nongnu.org, Juan Quintela <quintela@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
John Snow <jsnow@redhat.com>,
Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v2 3/6] migration: stop returning errno from load_snapshot()
Date: Wed, 12 Aug 2020 11:21:39 +0100 [thread overview]
Message-ID: <20200812102139.GD2810@work-vm> (raw)
In-Reply-To: <20200727150843.3419256-4-berrange@redhat.com>
* Daniel P. Berrangé (berrange@redhat.com) wrote:
> 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 -1.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
(Note this is true of snapshots only; in postcopy there are places we
care about the errno for recovery)
> ---
> migration/savevm.c | 17 ++++++++---------
> 1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 19259ef7c0..6c4d80fc5a 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -2843,20 +2843,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);
>
> @@ -2865,11 +2865,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. */
> @@ -2884,7 +2884,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;
> }
>
> @@ -2900,14 +2899,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)
> --
> 2.26.2
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2020-08-12 10:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 15:08 [PATCH v2 (BROKEN) 0/6] migration: bring improved savevm/loadvm/delvm to QMP Daniel P. Berrangé
2020-07-27 15:08 ` [PATCH v2 1/6] migration: improve error reporting of block driver state name Daniel P. Berrangé
2020-08-12 10:19 ` Dr. David Alan Gilbert
2020-07-27 15:08 ` [PATCH v2 2/6] block: push error reporting into bdrv_all_*_snapshot functions Daniel P. Berrangé
2020-07-27 15:08 ` [PATCH v2 3/6] migration: stop returning errno from load_snapshot() Daniel P. Berrangé
2020-08-12 10:21 ` Dr. David Alan Gilbert [this message]
2020-07-27 15:08 ` [PATCH v2 4/6] block: add ability to specify list of blockdevs during snapshot Daniel P. Berrangé
2020-07-27 15:08 ` [PATCH v2 5/6] block: allow specifying name of block device for vmstate storage Daniel P. Berrangé
2020-07-27 15:08 ` [PATCH v2 6/6] migration: introduce snapshot-{save, load, delete} QMP commands Daniel P. Berrangé
2020-08-21 16:27 ` [PATCH v2 (BROKEN) 0/6] migration: bring improved savevm/loadvm/delvm to QMP Daniel P. Berrangé
2020-08-26 15:52 ` Markus Armbruster
2020-08-26 18:28 ` Daniel P. Berrangé
2020-08-26 18:34 ` Daniel P. Berrangé
2020-08-27 11:06 ` Markus Armbruster
2020-08-27 13:13 ` Kevin Wolf
2020-08-28 6:20 ` Markus Armbruster
2020-08-28 8:46 ` Kevin Wolf
2020-08-31 7:19 ` Markus Armbruster
2020-08-27 11:04 ` Markus Armbruster
2020-08-27 11:34 ` Daniel P. Berrangé
2020-09-01 13:22 ` Markus Armbruster
2020-09-01 13:41 ` Daniel P. Berrangé
2020-09-01 13:58 ` Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200812102139.GD2810@work-vm \
--to=dgilbert@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=den@virtuozzo.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=pkrempa@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).