From nobody Mon Apr 29 05:28:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522313348938906.0328126767205; Thu, 29 Mar 2018 01:49:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2FBAD7FD40; Thu, 29 Mar 2018 08:49:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EDE945D720; Thu, 29 Mar 2018 08:49:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AB0244CA9E; Thu, 29 Mar 2018 08:49:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2T8n04A009691 for ; Thu, 29 Mar 2018 04:49:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id BDDE46A947; Thu, 29 Mar 2018 08:49:00 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B45946A944 for ; Thu, 29 Mar 2018 08:48:58 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3B787C0587F6 for ; Thu, 29 Mar 2018 08:48:56 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2T8UA0f036590 for ; Thu, 29 Mar 2018 08:48:55 GMT Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2h0vpfg4ps-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 Mar 2018 08:48:55 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2T8msBt029719 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 Mar 2018 08:48:54 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w2T8msHD006983 for ; Thu, 29 Mar 2018 08:48:54 GMT Received: from nina.dynamic.ziggo.nl (/10.175.37.226) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 29 Mar 2018 01:48:54 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=UBo0vlV5J44QE2zWWr7/vUx2pAzswJvgQUnKzGw2rrY=; b=m70XUzkN+GUA8u4HWvckn+oSSU6S21TZKVwoLknFCmmtyac5fpydlp9wAUHcy7pE+0B2 avc4iFZQeO1gfe6UEFfcCeug0PuPcCQdZcyRyHAkFxoRjLgwy5KXUIwAx37Pkgc9R66a fs7CiqNvggULORb6ySbpqs7gqo9Fvw1aJsTtRMiLfcuu8AXQRpaugStO1o/ccQGPr2iw Trd26UkpgErJtM+1HjT3QqCd9EV4cKiIZtGY1+GnVE/4mkQK9ftgznWX+H5Pe9KDvK1Y untP8aT0rrow2Ex/Ho56UlWuKH2Wboj632fXo8/dPk8tZH8rRSaFlZ+L3t/IqzNU0b+t Mw== From: Wim Ten Have To: Libvirt Development List Date: Thu, 29 Mar 2018 10:48:40 +0200 Message-Id: <20180329084841.11771-2-wim.ten.have@oracle.com> In-Reply-To: <20180329084841.11771-1-wim.ten.have@oracle.com> References: <20180329084841.11771-1-wim.ten.have@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8846 signatures=668695 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803290092 X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 29 Mar 2018 08:48:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 29 Mar 2018 08:48:56 +0000 (UTC) for IP:'156.151.31.86' DOMAIN:'userp2130.oracle.com' HELO:'userp2130.oracle.com' FROM:'wim.ten.have@oracle.com' RCPT:'' X-RedHat-Spam-Score: -100.11 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_PASS, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY, USER_IN_WHITELIST) 156.151.31.86 userp2130.oracle.com 156.151.31.86 userp2130.oracle.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Wim ten Have Subject: [libvirt] [PATCH libvirt sparse files under format=qcow2 v1 1/2] libvirt can't create fully allocated qcow2 formatted storage objects. X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 29 Mar 2018 08:49:07 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Wim ten Have This patch adds support to qcow2 formatted storage objects by instructing qemu-img to build them with preallocation=3Dfalloc whenever the XML described storage matches its . For all other cases the objects are built with preallocation=3Dmetadata. Signed-off-by: Wim ten Have --- include/libvirt/libvirt-storage.h | 5 ++++- src/storage/storage_util.c | 21 +++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/include/libvirt/libvirt-storage.h b/include/libvirt/libvirt-st= orage.h index 413d9f6c4..2f22b388c 100644 --- a/include/libvirt/libvirt-storage.h +++ b/include/libvirt/libvirt-storage.h @@ -337,8 +337,11 @@ const char* virStorageVolGetName = (virStorageVolPtr vol); const char* virStorageVolGetKey (virStorageVolPtr = vol); =20 typedef enum { + VIR_STORAGE_VOL_CREATE_PREALLOC_NONE =3D 0 << 0, VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA =3D 1 << 0, - VIR_STORAGE_VOL_CREATE_REFLINK =3D 1 << 1, /* perform a btrfs lightwei= ght copy */ + VIR_STORAGE_VOL_CREATE_PREALLOC_FALLOC =3D 1 << 1, + VIR_STORAGE_VOL_CREATE_PREALLOC_FULL =3D 1 << 2, + VIR_STORAGE_VOL_CREATE_REFLINK =3D 1 << 3, /* perform a btrf= s lightweight copy */ } virStorageVolCreateFlags; =20 virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr= pool, diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index b4aed0f70..7728fb63e 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -852,7 +852,7 @@ struct _virStorageBackendQemuImgInfo { const char *path; unsigned long long size_arg; bool encryption; - bool preallocate; + unsigned int preallocate; const char *compat; virBitmapPtr features; bool nocow; @@ -884,8 +884,15 @@ storageBackendCreateQemuImgOpts(virStorageEncryptionIn= foDefPtr enc, virStorageFileFormatTypeToString(info.backin= gFormat)); if (info.encryption) virBufferAddLit(&buf, "encryption=3Don,"); - if (info.preallocate) + + /* Handle various types of file-system storage pre-allocate sets. + */ + if (info.preallocate & VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA) virBufferAddLit(&buf, "preallocation=3Dmetadata,"); + else if (info.preallocate & VIR_STORAGE_VOL_CREATE_PREALLOC_FALLOC) + virBufferAddLit(&buf, "preallocation=3Dfalloc,"); + else if (info.preallocate & VIR_STORAGE_VOL_CREATE_PREALLOC_FULL) + virBufferAddLit(&buf, "preallocation=3Dfull,"); } =20 if (info.nocow) @@ -1183,7 +1190,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePo= olObjPtr pool, .format =3D vol->target.format, .path =3D vol->target.path, .encryption =3D vol->target.encryption !=3D NULL, - .preallocate =3D !!(flags & VIR_STORAGE_VOL_CREATE_PREALLOC_METADA= TA), + .preallocate =3D VIR_STORAGE_VOL_CREATE_PREALLOC_NONE, .compat =3D vol->target.compat, .features =3D vol->target.features, .nocow =3D vol->target.nocow, @@ -1192,7 +1199,13 @@ virStorageBackendCreateQemuImgCmdFromVol(virStorageP= oolObjPtr pool, }; virStorageEncryptionInfoDefPtr enc =3D NULL; =20 - virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, NULL); + if (flags) { + info.preallocate =3D (vol->target.capacity =3D=3D vol->target.allo= cation) ? + VIR_STORAGE_VOL_CREATE_PREALLOC_FALLOC : VIR_STORAGE_VOL_CREAT= E_PREALLOC_METADATA; + virCheckFlags((VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA| + VIR_STORAGE_VOL_CREATE_PREALLOC_FALLOC| + VIR_STORAGE_VOL_CREATE_PREALLOC_FULL), NULL); + } =20 /* Treat output block devices as 'raw' format */ if (vol->type =3D=3D VIR_STORAGE_VOL_BLOCK) --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 05:28:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522313342898219.38049984781003; Thu, 29 Mar 2018 01:49:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8EB8CC047B86; Thu, 29 Mar 2018 08:49:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 441846A05F; Thu, 29 Mar 2018 08:49:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 411124CA99; Thu, 29 Mar 2018 08:49:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2T8mx9o009682 for ; Thu, 29 Mar 2018 04:48:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 874B06012A; Thu, 29 Mar 2018 08:48:59 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 39B1360476 for ; Thu, 29 Mar 2018 08:48:57 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 03289C047B7C for ; Thu, 29 Mar 2018 08:48:57 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2T8exkP015872 for ; Thu, 29 Mar 2018 08:48:56 GMT Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2h0vumg2p2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 Mar 2018 08:48:56 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2T8mtZB025273 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 Mar 2018 08:48:55 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w2T8mtQ1006783 for ; Thu, 29 Mar 2018 08:48:55 GMT Received: from nina.dynamic.ziggo.nl (/10.175.37.226) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 29 Mar 2018 01:48:55 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=j0GRlFBCI91ss/TFGxoJb16hVekyy6vn1NowDxLH0V0=; b=WrWTtvNSwiHjcA0pHMSrc1ty21SYZHHu+K62gTB10UC9VgLjYxtWvs9KGg2iJPytArRF L0d3B5o3I/GfObf0z4+5o1qvugWhjWXAzBH9Z46wy6yYacgFqXGD+/xZsk5gQybp7A+g POP0kE4TvsajdrTmSFcUIHW5NOeX6zoIggj8/AryxbV0Xigkj6FUcEm+uKzTLUV41cgu xs9FYUFdy9jCWaC5yfSp2ssyDSNstCEuFNG0ixfuFWvuf+LeCchNMjRn+U2aBWMFGvnR eatXckhS4qDGMWdgw59KZ9l7yBd/FKXlfRMlwoZqSjujp9wLqpWb82Gf537orL0uIArt 5w== From: Wim Ten Have To: Libvirt Development List Date: Thu, 29 Mar 2018 10:48:41 +0200 Message-Id: <20180329084841.11771-3-wim.ten.have@oracle.com> In-Reply-To: <20180329084841.11771-1-wim.ten.have@oracle.com> References: <20180329084841.11771-1-wim.ten.have@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8846 signatures=668695 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=764 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803290092 X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 29 Mar 2018 08:48:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 29 Mar 2018 08:48:57 +0000 (UTC) for IP:'156.151.31.85' DOMAIN:'userp2120.oracle.com' HELO:'userp2120.oracle.com' FROM:'wim.ten.have@oracle.com' RCPT:'' X-RedHat-Spam-Score: -100.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_MSPIKE_H2, SPF_PASS, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY, USER_IN_WHITELIST) 156.151.31.85 userp2120.oracle.com 156.151.31.85 userp2120.oracle.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Wim ten Have Subject: [libvirt] [PATCH libvirt sparse files under format=qcow2 v1 2/2] Adjust qemu-img test required to target with preallocation=falloc. X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 29 Mar 2018 08:49:02 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Wim ten Have Signed-off-by: Wim ten Have --- tests/storagevolxml2argvdata/qcow2-nocapacity-convert-prealloc.argv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/storagevolxml2argvdata/qcow2-nocapacity-convert-prealloc= .argv b/tests/storagevolxml2argvdata/qcow2-nocapacity-convert-prealloc.argv index 9073b1b16..b151b9401 100644 --- a/tests/storagevolxml2argvdata/qcow2-nocapacity-convert-prealloc.argv +++ b/tests/storagevolxml2argvdata/qcow2-nocapacity-convert-prealloc.argv @@ -1,4 +1,4 @@ qemu-img convert -f raw -O qcow2 \ --o encryption=3Don,preallocation=3Dmetadata \ +-o encryption=3Don,preallocation=3Dfalloc \ /var/lib/libvirt/images/sparse.img \ /var/lib/libvirt/images/OtherDemo.img --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list