From nobody Sat Nov 23 17:38:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1723160518; cv=none; d=zohomail.com; s=zohoarc; b=IYynLLDfETDiVGOgLRdL+pb2XqogMDdTIHC4nU58a/KiaMcxOu6zxmBx7/SOu4Wk8E6Et866B3RUS7fYzuSG/lYAOc1uwAAKFawoddciaW8FY0zcdUVlDVRoq5FL/aLpMff6O40pgE6fWVwgbOX41jUoqWYzUy9RRscdhdBGAAo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723160518; 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:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=A3VCUM7VcFI0qv7WXYob0JOntboAhKK1LP2RmL2LV7w=; b=NJxdC0TGMDa964qNKNsnNRxbFIbAj1SoF+NXFTxd39+8FzWZ0hfYix1jjbpAdnfZUXduEyeY1C5vxiILbnXIHpInulmHCglT8wdSAVpb4Mn8BBZjdzLOO2ZO/ESYeWIjiOiQLCysQ840Xy0LuaGwEhTtiSjsJ7noBCJ8rUI9pCY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1723160518708467.6805697187866; Thu, 8 Aug 2024 16:41:58 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9494414F4; Thu, 8 Aug 2024 19:41:57 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2E76512CA; Thu, 8 Aug 2024 19:38:59 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C183F1434; Thu, 8 Aug 2024 19:38:50 -0400 (EDT) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 20D6A13D3 for ; Thu, 8 Aug 2024 19:38:32 -0400 (EDT) Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2eeb1ba0481so19147201fa.2 for ; Thu, 08 Aug 2024 16:38:32 -0700 (PDT) Received: from localhost ([69.51.98.127]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39b20af1672sm58621085ab.76.2024.08.08.16.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 16:38:30 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1723160311; x=1723765111; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=piPeXLtBsnMuLcuZKLa7/RkfvxC0tK/DgsCYKTUm6bY=; b=CbA75Q8EQsNzYG0U5B4SPha8tGkoBZrJ02Q3vXnF8NB5e2IYv36SudATVDWaaIcHa4 x+LJ0ctwbxkpqJHk6seZUcVNlmJCqMNfKLzNcx7BDZFUmnsgJWdGZgOb7uf9M7FLcltH mVa4lgXnAhxntq80VZCTL4+5xRLGaSdBUzz1vrtbH6ANLv2KJwsYSWIr1dSduOvuUi1/ j96UAPJqfLhOkrVgJQN21ctiDNi0o91cqhsjUSB2nwJCUIO5M954mW4A222RjNajSFTT cBeZIax9/b/e+4cyM/tyk+NrIY7kj+fGG2y7LU6fnVi778NN/+S8Pt3jPXzbNTZFsCJ+ yWiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723160311; x=1723765111; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=piPeXLtBsnMuLcuZKLa7/RkfvxC0tK/DgsCYKTUm6bY=; b=oerLylK9f4YezpXXshQEiidvSpTmkrxSdaPk+InuCQL5Drggv4gVPDMFMo0SHg3GsA geEKu7RBCPyVrG80Gbg+guBIMFxNtYMhv30+22Vie/hM/0BB1U+u2M1oncSzrPzHWXsM lPO1/wlrfk+wY6l9Scq0J+1q37YF9B6IsG38182tydNRPxfv39/aZ3pEGFbCsQk4z9t4 GjJmmgfUndPd5aNIskTxf8+d8riDTpmB0G8kCVhLlba6AphN7ZMToaTqvNcQtqabp3lV GCGkCML/H4sKsDjCu5NrHmYZufFNDpoBIcxBqA+BdkLsZqTtgPc+p/XBU1MtliU1/Ye4 ZbTA== X-Gm-Message-State: AOJu0YzZpgyJJtrr2XpI854GxaaJHcp0Qm8EpYlyPpFSLsGB6WOt4DLb xEmb+ySabWeGXAr3E3WLrQtj4qNJjwPgfhgKb0Fxy6+dFHI3WfhYyQ3fT0VXsfbng2iOWJy4Mjy K X-Google-Smtp-Source: AGHT+IFSH0BcjSF9rUVU8pLdYVVIqrt9FcueFLiRzvgBEwuzd/7qclexn8x9phpwiauPYRAIBXS0fA== X-Received: by 2002:a2e:be20:0:b0:2f0:25dc:1894 with SMTP id 38308e7fff4ca-2f19de21fd8mr27038021fa.2.1723160310661; Thu, 08 Aug 2024 16:38:30 -0700 (PDT) To: devel@lists.libvirt.org Subject: [PATCH 07/20] qemu: QEMU_SAVE_VERSION: Bump to version 3 Date: Thu, 8 Aug 2024 17:38:00 -0600 Message-Id: <20240808233813.22905-8-jfehlig@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240808233813.22905-1-jfehlig@suse.com> References: <20240808233813.22905-1-jfehlig@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: XVG3GSAADA6MSPXMSXN4SK2K3SLXCQXU X-Message-ID-Hash: XVG3GSAADA6MSPXMSXN4SK2K3SLXCQXU X-MailFrom: jfehlig@suse.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: farosas@suse.de X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Jim Fehlig via Devel Reply-To: Jim Fehlig X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1723160519008116600 Content-Type: text/plain; charset="utf-8" QEMU's new mapped-ram stream format [1] is incompatible with the existing sequential stream format. An older libvirt+QEMU that does not support mapped-ram must not attempt to restore a mapped-ram saved image. Currently the only way to achieve this is to bump QEMU_SAVE_VERSION. To avoid future version bumps, add a new 'features' element to the saved image header. The element is used now to indicate the use of mapped-ram feature, and provides a mechanism to support future save image features. [1] https://gitlab.com/qemu-project/qemu/-/blob/master/docs/devel/migration= /mapped-ram.rst?ref_type=3Dheads Signed-off-by: Jim Fehlig --- src/qemu/qemu_saveimage.c | 7 +++++++ src/qemu/qemu_saveimage.h | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c index 018ab5a222..50fec33f54 100644 --- a/src/qemu/qemu_saveimage.c +++ b/src/qemu/qemu_saveimage.c @@ -74,6 +74,7 @@ qemuSaveImageBswapHeader(virQEMUSaveHeader *hdr) hdr->was_running =3D GUINT32_SWAP_LE_BE(hdr->was_running); hdr->compressed =3D GUINT32_SWAP_LE_BE(hdr->compressed); hdr->cookieOffset =3D GUINT32_SWAP_LE_BE(hdr->cookieOffset); + hdr->features =3D GUINT32_SWAP_LE_BE(hdr->features); } =20 =20 @@ -637,6 +638,12 @@ qemuSaveImageOpen(virQEMUDriver *driver, return -1; } =20 + if (header->features && header->features !=3D QEMU_SAVE_FEATURE_MAPPED= _RAM) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("image contains unsupported features)")); + return -1; + } + if (header->cookieOffset) xml_len =3D header->cookieOffset; else diff --git a/src/qemu/qemu_saveimage.h b/src/qemu/qemu_saveimage.h index e541792153..9dd7de292d 100644 --- a/src/qemu/qemu_saveimage.h +++ b/src/qemu/qemu_saveimage.h @@ -28,10 +28,14 @@ */ #define QEMU_SAVE_MAGIC "LibvirtQemudSave" #define QEMU_SAVE_PARTIAL "LibvirtQemudPart" -#define QEMU_SAVE_VERSION 2 +#define QEMU_SAVE_VERSION 3 =20 G_STATIC_ASSERT(sizeof(QEMU_SAVE_MAGIC) =3D=3D sizeof(QEMU_SAVE_PARTIAL)); =20 +typedef enum { + QEMU_SAVE_FEATURE_MAPPED_RAM =3D 1 << 0, +} qemuSaveFeatures; + typedef struct _virQEMUSaveHeader virQEMUSaveHeader; struct _virQEMUSaveHeader { char magic[sizeof(QEMU_SAVE_MAGIC)-1]; @@ -40,7 +44,8 @@ struct _virQEMUSaveHeader { uint32_t was_running; uint32_t compressed; uint32_t cookieOffset; - uint32_t unused[14]; + uint32_t features; + uint32_t unused[13]; }; =20 =20 --=20 2.35.3