From nobody Wed Feb 11 02:07:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1696877102; cv=none; d=zohomail.com; s=zohoarc; b=BvQJhlmSPoDpyWQ589NKLiK0g8VNHH7GSp04iK4O1iISaTAsMVXh3y8PG/XV0xuiHF0zWmiBl0PrYkqPYYkI/pal+oQ6JrW99UOdJkevMVFOEroeW7Y259exrMkbrbhdNQBu6q33IVLQL8Gj6w7AET49tFc3YW9BVwXvm/nBZG0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696877102; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Wr358kdeh3X8Vk57IvELFdc/+EGO0eqkPtOdSkDbE+g=; b=NPH+O6++UY1535i3+sU1Uk5WsQLaywI5MwR4mJri+GKLiEWHDboS0kVUOXqpOkKmHQIk8ELnBLcWls9dWP253/035CJSCYzWiHxw7f9XvJNTcJnL4CkuDx5x83VzUuecy6ouQG5WSN09W2E6UMACAADJn9ftBjS4lLKqmNdKimA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1696877102726631.1769371254006; Mon, 9 Oct 2023 11:45:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qpvEC-0007dx-6m; Mon, 09 Oct 2023 14:43:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qpvE9-0007dA-W5 for qemu-devel@nongnu.org; Mon, 09 Oct 2023 14:43:38 -0400 Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qpvE8-0000ld-EQ for qemu-devel@nongnu.org; Mon, 09 Oct 2023 14:43:37 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 52FF821862; Mon, 9 Oct 2023 18:43:33 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6501513586; Mon, 9 Oct 2023 18:43:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mKwoC9NJJGWFEgAAMHmgww (envelope-from ); Mon, 09 Oct 2023 18:43:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1696877013; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wr358kdeh3X8Vk57IvELFdc/+EGO0eqkPtOdSkDbE+g=; b=RBWMSLM/cGMvnSnSIoQ/w9liRcHQgmjVBUev4s5p5w1ugMAEsingbQ6PybVv+8e3oVgd3P i78rTEQX9B4iuxl7xo/xW8FIaQMg3UGSsW1nJ4fIqts0ex3wClVPkr9E/H86JTYdYZU6kp RwNWU/vqmORj/dMXlt1QJ3+DIYp1yZc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1696877013; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wr358kdeh3X8Vk57IvELFdc/+EGO0eqkPtOdSkDbE+g=; b=zvgLpYFVkWthH2naR4aKyVRfzliEPEVNteVaEDvdhayVncacHsrKRwOfX/A61hprb2FtDM MS5TQGxH9wjluxCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Thomas Huth , Nikolay Borisov Subject: [PATCH v2 1/6] migration: Add the configuration vmstate to the json writer Date: Mon, 9 Oct 2023 15:43:21 -0300 Message-Id: <20231009184326.15777-2-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231009184326.15777-1-farosas@suse.de> References: <20231009184326.15777-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:67c:2178:6::1c; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1696877104328100003 Content-Type: text/plain; charset="utf-8" From: Nikolay Borisov Make the migration json writer part of MigrationState struct, allowing the 'configuration' object be serialized to json. This will facilitate the parsing of the 'configuration' object in the next patch that fixes analyze-migration.py for arm. Signed-off-by: Nikolay Borisov Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela --- farosas: rewrote the commit message. The previous one was tied to fixed-ram. --- migration/migration.c | 1 + migration/savevm.c | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 585d3c8f55..dde8471f83 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1430,6 +1430,7 @@ int migrate_init(MigrationState *s, Error **errp) error_free(s->error); s->error =3D NULL; s->hostname =3D NULL; + s->vmdesc =3D NULL; =20 migrate_set_state(&s->state, MIGRATION_STATUS_NONE, MIGRATION_STATUS_S= ETUP); =20 diff --git a/migration/savevm.c b/migration/savevm.c index 60eec7c31f..5343cbc234 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1217,13 +1217,27 @@ void qemu_savevm_non_migratable_list(strList **reas= ons) =20 void qemu_savevm_state_header(QEMUFile *f) { + MigrationState *s =3D migrate_get_current(); + + s->vmdesc =3D json_writer_new(false); + trace_savevm_state_header(); qemu_put_be32(f, QEMU_VM_FILE_MAGIC); qemu_put_be32(f, QEMU_VM_FILE_VERSION); =20 - if (migrate_get_current()->send_configuration) { + if (s->send_configuration) { qemu_put_byte(f, QEMU_VM_CONFIGURATION); - vmstate_save_state(f, &vmstate_configuration, &savevm_state, 0); + + /* + * 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(s->vmdesc, NULL); + + json_writer_start_object(s->vmdesc, "configuration"); + vmstate_save_state(f, &vmstate_configuration, &savevm_state, s->vm= desc); + json_writer_end_object(s->vmdesc); } } =20 @@ -1272,8 +1286,6 @@ void qemu_savevm_state_setup(QEMUFile *f) Error *local_err =3D NULL; int ret; =20 - ms->vmdesc =3D json_writer_new(false); - json_writer_start_object(ms->vmdesc, NULL); json_writer_int64(ms->vmdesc, "page_size", qemu_target_page_size()); json_writer_start_array(ms->vmdesc, "devices"); =20 --=20 2.35.3