From nobody Thu Nov 21 16:14:06 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=1732119121; cv=none; d=zohomail.com; s=zohoarc; b=graqzgQHLWC/p00NPcZ9l3ZPv9gdSV2RZaMkNO2fgs4TH0K6aQgRTPGlsH/Cu8hjbMFrO3GesdjBrXGGfnulglZiGuI05xeQMscyWRNgbVSt3wUx5hKSboEZGb/NGN9LTxBLO+UVLlltDJbHBnttNli4wLmR9nZuvgYv9ToUNyI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732119121; 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=JBMhEbApwpQ288uycpX6XW+fe6YSeD+VKbjcuNMUujw=; b=a0HUiJx/qkWsVfHvqcFRtBI8OFpsoqxZobGiNxJvYyoWtK4mjbZo1/heF1nkJgovxbopXrQ9fC4Lxhd0ce153L+9X3bQXp83I12ok/4mGperZALWA0nIFdrDwh0Fo4xr3SJ0gewWvpu5wTEi0liv5SQE+kEdhgyVmkXyFJcrJfg= 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 1732119121506673.5251198648284; Wed, 20 Nov 2024 08:12:01 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7AAF215A9; Wed, 20 Nov 2024 11:12:00 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2993E1541; Wed, 20 Nov 2024 11:09:52 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 2473A1499; Wed, 20 Nov 2024 11:09:47 -0500 (EST) Received: from relay.virtuozzo.com (relay.virtuozzo.com [130.117.225.111]) (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 A93601499 for ; Wed, 20 Nov 2024 11:09:38 -0500 (EST) Received: from [130.117.225.1] (helo=vz9-barybin-2.ch-qa.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1tDn0y-0005yc-1k; Wed, 20 Nov 2024 16:53:12 +0100 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=GUnelx5pY87qPOoCdgQBWXnyCoOC1UqqgEy9ECSE3/M=; b=NWI6UFUgW+mB qfAgVXdsRMtCVAwC9FRN6bFCGmeYMOOYsnJpRE4rm1tNr6Rpb4UwcjWhpg2Xyse2XX4vGsXyRMXdz azRHcOIvNQLKxXyjhMlWfKmOiqINLUsWN53Srvxd5dDSoQwk0d+UHgKGezEq7h3OEE+8ukuhubUUy YyhAKw/EVBkVbZCkxmDGuJJUEh7LHzcFAmjkvveLwH3Rn3gEUFyh1l+ju9CXB068MRiQRqO7qOEQ5 X8Cczy44/miLmz/QbNgCZV3XMYTBNXc3iFt/tkZhiBsRRM0OuhbGAa3P1GPzngZTn7iVjgjqL/MLn pa2oMVO3CcDyxgA33p2pOQ==; To: devel@lists.libvirt.org Subject: [PATCH 13/15] qemu: enable basic qcow2 data-file feature support Date: Wed, 20 Nov 2024 18:48:48 +0300 Message-ID: <20241120155229.1259-14-nikolai.barybin@virtuozzo.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241120155229.1259-1-nikolai.barybin@virtuozzo.com> References: <20241120155229.1259-1-nikolai.barybin@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 6CJHE7WJRWATC2GDAIDBS6N6VKEV3GBO X-Message-ID-Hash: 6CJHE7WJRWATC2GDAIDBS6N6VKEV3GBO X-MailFrom: nikolai.barybin@virtuozzo.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: den@openvz.org, Nikolai Barybin 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: Nikolai Barybin via Devel Reply-To: Nikolai Barybin X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1732119122338116600 Content-Type: text/plain; charset="utf-8" - propogate data-file to cmdline - determine data-file within disk chain - enable live disk insertion Signed-off-by: Nikolai Barybin --- src/qemu/qemu_block.c | 14 ++++++++++++++ src/qemu/qemu_command.c | 5 +++++ src/qemu/qemu_domain.c | 14 +++++++++++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 3c1305ec84..1915d5f5fd 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1302,6 +1302,13 @@ qemuBlockStorageSourceGetFormatQcow2Props(virStorage= Source *src, NULL) < 0) return -1; =20 + if (src->dataFileStore) { + if (virJSONValueObjectAdd(&props, + "s:data-file", qemuBlockStorageSourceGet= EffectiveNodename(src->dataFileStore), + NULL) < 0) + return -1; + } + return 0; } =20 @@ -1859,6 +1866,13 @@ qemuBlockStorageSourceChainDetachPrepareBlockdev(vir= StorageSource *src) return NULL; =20 VIR_APPEND_ELEMENT(data->srcdata, data->nsrcdata, backend); + + if (n->dataFileStore) { + if (!(backend =3D qemuBlockStorageSourceDetachPrepare(n->dataF= ileStore))) + return NULL; + + VIR_APPEND_ELEMENT(data->srcdata, data->nsrcdata, backend); + } } =20 return g_steal_pointer(&data); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f4430275dc..cdc80cee73 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -11018,6 +11018,11 @@ qemuBuildStorageSourceChainAttachPrepareBlockdev(v= irStorageSource *top) if (qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, n, n->backing= Store) < 0) return NULL; + + if (n->dataFileStore && + qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, n->d= ataFileStore, + n->dataFil= eStore->backingStore) < 0) + return NULL; } =20 return g_steal_pointer(&data); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 393c7dcac1..d0700db3be 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6242,9 +6242,17 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver, true) < 0) return -1; =20 + if (src->dataFileStore && + qemuDomainPrepareStorageSource(src->dataFileStore, vm, disk, cfg) = < 0) + return -1; + for (n =3D src->backingStore; virStorageSourceIsBacking(n); n =3D n->b= ackingStore) { if (qemuDomainPrepareStorageSource(n, vm, disk, cfg) < 0) return -1; + + if (n->dataFileStore && + qemuDomainPrepareStorageSource(n->dataFileStore, vm, disk, cfg= ) < 0) + return -1; } =20 if (qemuDomainStorageSourceValidateDepth(disksrc, 0, disk->dst) < 0) @@ -9438,7 +9446,7 @@ qemuDomainPrepareDiskSourceData(virDomainDiskDef *dis= k, return; =20 /* transfer properties valid only for the top level image */ - if (src =3D=3D disk->src) + if (src =3D=3D disk->src || src =3D=3D disk->src->dataFileStore) src->detect_zeroes =3D disk->detect_zeroes; =20 /* transfer properties valid for the full chain */ @@ -9667,6 +9675,10 @@ qemuDomainPrepareDiskSourceBlockdev(virDomainDiskDef= *disk, for (n =3D disk->src; virStorageSourceIsBacking(n); n =3D n->backingSt= ore) { if (qemuDomainPrepareStorageSourceBlockdev(disk, n, priv, cfg) < 0) return -1; + + if (n->dataFileStore && + qemuDomainPrepareStorageSourceBlockdev(disk, n->dataFileStore,= priv, cfg) < 0) + return -1; } =20 return 0; --=20 2.43.5