qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
To: Arun Menon <armenon@redhat.com>, qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"David Hildenbrand" <david@redhat.com>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Fam Zheng" <fam@euphon.net>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
	"Hailiang Zhang" <zhanghailiang@xfusion.com>,
	"Steve Sistare" <steven.sistare@oracle.com>,
	qemu-s390x@nongnu.org, qemu-ppc@nongnu.org,
	"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Dmitry Osipenko" <dmitry.osipenko@collabora.com>,
	"Matthew Rosato" <mjrosato@linux.ibm.com>
Subject: Re: [PATCH v8 03/27] migration: push Error **errp into qemu_loadvm_state_header()
Date: Fri, 1 Aug 2025 15:46:25 +0900	[thread overview]
Message-ID: <f35f70b9-5f15-42db-bb73-db09ef0d6ad1@rsg.ci.i.u-tokyo.ac.jp> (raw)
In-Reply-To: <20250731-propagate_tpm_error-v8-3-28fd82fdfdb2@redhat.com>

On 2025/07/31 22:20, Arun Menon wrote:
> This is an incremental step in converting vmstate loading
> code to report error via Error objects instead of directly
> printing it to console/monitor.
> It is ensured that qemu_loadvm_state_header() must report an error
> in errp, in case of failure.
> 
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Arun Menon <armenon@redhat.com>
> ---
>   migration/savevm.c | 27 ++++++++++++++++++---------
>   1 file changed, 18 insertions(+), 9 deletions(-)
> 
> diff --git a/migration/savevm.c b/migration/savevm.c
> index ab947620f724874f325fb9fb59bef50b7c16fb51..842ff3dc6d5ccb05f7d33cef9f7319b141419501 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -2814,35 +2814,44 @@ qemu_loadvm_section_part_end(QEMUFile *f, uint8_t type)
>       return 0;
>   }
>   
> -static int qemu_loadvm_state_header(QEMUFile *f)
> +static int qemu_loadvm_state_header(QEMUFile *f, Error **errp)
>   {
>       unsigned int v;
>       int ret;
>   
>       v = qemu_get_be32(f);
>       if (v != QEMU_VM_FILE_MAGIC) {
> -        error_report("Not a migration stream");
> +        error_setg(errp, "Not a migration stream, magic: %x != %x",
> +                   v, QEMU_VM_FILE_MAGIC);
>           return -EINVAL;
>       }
>   
>       v = qemu_get_be32(f);
>       if (v == QEMU_VM_FILE_VERSION_COMPAT) {
> -        error_report("SaveVM v2 format is obsolete and don't work anymore");
> +        error_setg(errp,
> +                   "SaveVM v2 format is obsolete and no longer supported, "
> +                   "file version %x != %x",
> +                   v, QEMU_VM_FILE_VERSION_COMPAT);
> +
>           return -ENOTSUP;
>       }
>       if (v != QEMU_VM_FILE_VERSION) {
> -        error_report("Unsupported migration stream version");
> +        error_setg(errp, "Unsupported migration stream version, "
> +                   "file version %x != %x",
> +                   v, QEMU_VM_FILE_VERSION);
>           return -ENOTSUP;
>       }
>   
>       if (migrate_get_current()->send_configuration) {
> -        if (qemu_get_byte(f) != QEMU_VM_CONFIGURATION) {
> -            error_report("Configuration section missing");
> +        v = qemu_get_byte(f);
> +        if (v != QEMU_VM_CONFIGURATION) {
> +            error_setg(errp, "Configuration section missing, %x != %x",
> +                       v, QEMU_VM_CONFIGURATION);
>               return -EINVAL;
>           }
> -        ret = vmstate_load_state(f, &vmstate_configuration, &savevm_state, 0,
> -                                 NULL);
>   
> +        ret = vmstate_load_state(f, &vmstate_configuration, &savevm_state, 0,
> +                                 errp);
>           if (ret) {
>               return ret;
>           }
> @@ -3119,7 +3128,7 @@ int qemu_loadvm_state(QEMUFile *f)
>   
>       qemu_loadvm_thread_pool_create(mis);
>   
> -    ret = qemu_loadvm_state_header(f);
> +    ret = qemu_loadvm_state_header(f, NULL);
>       if (ret) {

I have another comment: the error should be reported with 
error_report_err() or the messages converted from error_report() to 
error_setg() will be temporarily gone.

I'm sorry that I missed this in the last email (this and the problem I 
mentioned in the last email was there since v4 [the first version I got 
CCed] and I failed to notice them until now...)

>           return ret;
>       }
> 



  parent reply	other threads:[~2025-08-01  7:07 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 13:20 [PATCH v8 00/27] migration: propagate vTPM errors using Error objects Arun Menon
2025-07-31 13:20 ` [PATCH v8 01/27] migration: push Error **errp into vmstate_subsection_load() Arun Menon
2025-07-31 13:20 ` [PATCH v8 02/27] migration: push Error **errp into vmstate_load_state() Arun Menon
2025-07-31 13:20 ` [PATCH v8 03/27] migration: push Error **errp into qemu_loadvm_state_header() Arun Menon
2025-08-01  6:28   ` Akihiko Odaki
2025-08-01  6:46   ` Akihiko Odaki [this message]
2025-07-31 13:20 ` [PATCH v8 04/27] migration: push Error **errp into vmstate_load() Arun Menon
2025-08-01  7:35   ` Akihiko Odaki
2025-07-31 13:20 ` [PATCH v8 05/27] migration: push Error **errp into qemu_loadvm_section_start_full() Arun Menon
2025-08-01  7:12   ` Akihiko Odaki
2025-08-01 13:27     ` Arun Menon
2025-08-01 13:33       ` Akihiko Odaki
2025-07-31 13:20 ` [PATCH v8 06/27] migration: push Error **errp into qemu_loadvm_section_part_end() Arun Menon
2025-07-31 13:20 ` [PATCH v8 07/27] migration: Update qemu_file_get_return_path() docs and remove dead checks Arun Menon
2025-07-31 13:20 ` [PATCH v8 08/27] migration: make loadvm_postcopy_handle_resume() void Arun Menon
2025-07-31 13:20 ` [PATCH v8 09/27] migration: push Error **errp into loadvm_process_command() Arun Menon
2025-07-31 13:20 ` [PATCH v8 10/27] migration: push Error **errp into loadvm_handle_cmd_packaged() Arun Menon
2025-07-31 13:20 ` [PATCH v8 11/27] migration: push Error **errp into ram_postcopy_incoming_init() Arun Menon
2025-07-31 13:20 ` [PATCH v8 12/27] migration: push Error **errp into loadvm_postcopy_handle_advise() Arun Menon
2025-07-31 13:20 ` [PATCH v8 13/27] migration: push Error **errp into loadvm_postcopy_handle_listen() Arun Menon
2025-07-31 13:20 ` [PATCH v8 14/27] migration: push Error **errp into loadvm_postcopy_handle_run() Arun Menon
2025-07-31 13:20 ` [PATCH v8 15/27] migration: push Error **errp into loadvm_postcopy_ram_handle_discard() Arun Menon
2025-07-31 13:20 ` [PATCH v8 16/27] migration: push Error **errp into loadvm_handle_recv_bitmap() Arun Menon
2025-07-31 13:20 ` [PATCH v8 17/27] migration: push Error **errp into loadvm_process_enable_colo() Arun Menon
2025-07-31 13:20 ` [PATCH v8 18/27] migration: push Error **errp into loadvm_postcopy_handle_switchover_start() Arun Menon
2025-07-31 13:20 ` [PATCH v8 19/27] migration: push Error **errp into qemu_loadvm_state_main() Arun Menon
2025-08-01  7:17   ` Akihiko Odaki
2025-08-01 13:38     ` Arun Menon
2025-07-31 13:21 ` [PATCH v8 20/27] migration: push Error **errp into qemu_loadvm_state() Arun Menon
2025-07-31 13:21 ` [PATCH v8 21/27] migration: push Error **errp into qemu_load_device_state() Arun Menon
2025-07-31 13:21 ` [PATCH v8 22/27] migration: Capture error in postcopy_ram_listen_thread() Arun Menon
2025-07-31 13:21 ` [PATCH v8 23/27] migration: Propagate last encountered error in vmstate_save_state_v() function Arun Menon
2025-08-01  7:35   ` Akihiko Odaki
2025-08-01 17:27     ` Arun Menon
2025-08-03  7:15       ` Akihiko Odaki
2025-08-04  7:48         ` Arun Menon
2025-08-04 18:08           ` Akihiko Odaki
2025-07-31 13:21 ` [PATCH v8 24/27] migration: Refactor " Arun Menon
2025-08-01  7:41   ` Akihiko Odaki
2025-07-31 13:21 ` [PATCH v8 25/27] migration: Remove error variant of vmstate_save_state() function Arun Menon
2025-07-31 13:21 ` [PATCH v8 26/27] migration: Add error-parameterized function variants in VMSD struct Arun Menon
2025-07-31 13:21 ` [PATCH v8 27/27] backends/tpm: Propagate vTPM error on migration failure Arun Menon

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=f35f70b9-5f15-42db-bb73-db09ef0d6ad1@rsg.ci.i.u-tokyo.ac.jp \
    --to=odaki@rsg.ci.i.u-tokyo.ac.jp \
    --cc=alex.bennee@linaro.org \
    --cc=alex.williamson@redhat.com \
    --cc=armenon@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=clg@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=danielhb413@gmail.com \
    --cc=david@redhat.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=fam@euphon.net \
    --cc=farman@linux.ibm.com \
    --cc=farosas@suse.de \
    --cc=harshpb@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=mst@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=steven.sistare@oracle.com \
    --cc=thuth@redhat.com \
    --cc=zhanghailiang@xfusion.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).