From: Fabiano Rosas <farosas@suse.de>
To: Peter Xu <peterx@redhat.com>, qemu-devel@nongnu.org
Cc: Prasad Pandit <ppandit@redhat.com>,
Lukas Straub <lukasstraub2@web.de>,
Juraj Marcin <jmarcin@redhat.com>,
peterx@redhat.com
Subject: Re: [PATCH 01/10] migration: Introduce qemu_savevm_send_* helpers
Date: Fri, 23 Jan 2026 10:23:00 -0300 [thread overview]
Message-ID: <87o6mkihu3.fsf@suse.de> (raw)
In-Reply-To: <20260121223336.3381912-2-peterx@redhat.com>
Peter Xu <peterx@redhat.com> writes:
> Split qemu_savevm_state_header() into two parts. This paves way for a
> reuse elsewhere.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> migration/savevm.h | 1 +
> migration/savevm.c | 58 +++++++++++++++++++++++++++-------------------
> 2 files changed, 35 insertions(+), 24 deletions(-)
>
> diff --git a/migration/savevm.h b/migration/savevm.h
> index 125a2507b7..5d815af742 100644
> --- a/migration/savevm.h
> +++ b/migration/savevm.h
> @@ -37,6 +37,7 @@ int qemu_savevm_state_prepare(Error **errp);
> int qemu_savevm_state_setup(QEMUFile *f, Error **errp);
> bool qemu_savevm_state_guest_unplug_pending(void);
> int qemu_savevm_state_resume_prepare(MigrationState *s);
> +void qemu_savevm_send_header(QEMUFile *f);
> void qemu_savevm_state_header(QEMUFile *f);
> int qemu_savevm_state_iterate(QEMUFile *f, bool postcopy);
> void qemu_savevm_state_cleanup(void);
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 3dc812a7bb..e26656cca3 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1282,38 +1282,48 @@ void qemu_savevm_non_migratable_list(strList **reasons)
> }
> }
>
> -void qemu_savevm_state_header(QEMUFile *f)
> +void qemu_savevm_send_header(QEMUFile *f)
> {
> - MigrationState *s = migrate_get_current();
> - JSONWriter *vmdesc = s->vmdesc;
> - Error *local_err = NULL;
> -
> trace_savevm_state_header();
> qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
> qemu_put_be32(f, QEMU_VM_FILE_VERSION);
> +}
>
> - if (s->send_configuration) {
> - qemu_put_byte(f, QEMU_VM_CONFIGURATION);
> +static void qemu_savevm_send_configuration(MigrationState *s, QEMUFile *f)
> +{
> + JSONWriter *vmdesc = s->vmdesc;
> + Error *local_err = NULL;
>
> - if (vmdesc) {
> - /*
> - * This starts the main json object and is paired with the
> - * json_writer_end_object in
> - * qemu_savevm_state_complete_precopy_non_iterable
> - */
> - json_writer_start_object(vmdesc, NULL);
> - json_writer_start_object(vmdesc, "configuration");
> - }
> + qemu_put_byte(f, QEMU_VM_CONFIGURATION);
>
> - vmstate_save_state(f, &vmstate_configuration, &savevm_state,
> - vmdesc, &local_err);
> - if (local_err) {
> - error_report_err(local_err);
> - }
> + if (vmdesc) {
> + /*
> + * This starts the main json object and is paired with the
> + * json_writer_end_object in
> + * qemu_savevm_state_complete_precopy_non_iterable
> + */
> + json_writer_start_object(vmdesc, NULL);
> + json_writer_start_object(vmdesc, "configuration");
> + }
>
> - if (vmdesc) {
> - json_writer_end_object(vmdesc);
> - }
> + vmstate_save_state(f, &vmstate_configuration, &savevm_state,
> + vmdesc, &local_err);
> + if (local_err) {
> + error_report_err(local_err);
> + }
> +
> + if (vmdesc) {
> + json_writer_end_object(vmdesc);
> + }
> +}
> +
> +void qemu_savevm_state_header(QEMUFile *f)
> +{
> + MigrationState *s = migrate_get_current();
> +
> + qemu_savevm_send_header(f);
> + if (s->send_configuration) {
> + qemu_savevm_send_configuration(s, f);
> }
> }
Reviewed-by: Fabiano Rosas <farosas@suse.de>
next prev parent reply other threads:[~2026-01-23 13:23 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-21 22:33 [PATCH 00/10] migration/colo: small cleanup series Peter Xu
2026-01-21 22:33 ` [PATCH 01/10] migration: Introduce qemu_savevm_send_* helpers Peter Xu
2026-01-23 13:23 ` Fabiano Rosas [this message]
2026-01-21 22:33 ` [PATCH 02/10] migration: Use qemu_savevm_send_header() in qemu_save_device_state() Peter Xu
2026-01-23 13:23 ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 03/10] migration: Remove one migration_in_colo_state() occurance Peter Xu
2026-01-23 13:32 ` Fabiano Rosas
2026-01-26 19:23 ` Peter Xu
2026-01-21 22:33 ` [PATCH 04/10] migration/savevm: Remove SaveStateEntry.is_ram Peter Xu
2026-01-23 13:47 ` Fabiano Rosas
2026-01-26 19:44 ` Peter Xu
2026-01-26 22:00 ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 05/10] migration/colo: Unwrap qemu_savevm_live_state() Peter Xu
2026-01-23 13:48 ` Fabiano Rosas
2026-01-26 20:44 ` Peter Xu
2026-01-21 22:33 ` [PATCH 06/10] migration/colo: Remove call to send switchover start event Peter Xu
2026-01-23 13:49 ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 07/10] colo: Forbid VM resume during checkpointing Peter Xu
2026-01-23 13:49 ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 08/10] migration/colo: Use the RAM iterable helper directly Peter Xu
2026-01-23 14:00 ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 09/10] migration/colo: Move qemu_fflush() closer to its user for fb Peter Xu
2026-01-23 14:10 ` Fabiano Rosas
2026-01-26 21:06 ` Peter Xu
2026-01-21 22:33 ` [PATCH 10/10] migration: Drop iterable_only in qemu_savevm_state_complete_precopy Peter Xu
2026-01-23 14:11 ` Fabiano Rosas
2026-01-25 19:29 ` [PATCH 00/10] migration/colo: small cleanup series Lukas Straub
2026-01-26 17:23 ` Peter Xu
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=87o6mkihu3.fsf@suse.de \
--to=farosas@suse.de \
--cc=jmarcin@redhat.com \
--cc=lukasstraub2@web.de \
--cc=peterx@redhat.com \
--cc=ppandit@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.