From nobody Mon Apr 29 07:55:50 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 1522765170447868.1501583258153; Tue, 3 Apr 2018 07:19:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C7A528202; Tue, 3 Apr 2018 14:19:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D1E235D77C; Tue, 3 Apr 2018 14:19:28 +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 94D6F1800BB5; Tue, 3 Apr 2018 14:19:28 +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 w33EJQ4T020898 for ; Tue, 3 Apr 2018 10:19:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 90DCE611AA; Tue, 3 Apr 2018 14:19:26 +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 87C436B8C6 for ; Tue, 3 Apr 2018 14:19:21 +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 B7B7CC0587F5 for ; Tue, 3 Apr 2018 14:19:19 +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 w33EHSLw146893 for ; Tue, 3 Apr 2018 14:19:19 GMT Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2h4b8c81mf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 03 Apr 2018 14:19:19 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w33EEIWV005139 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 3 Apr 2018 14:14:18 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 w33EEIHk027535 for ; Tue, 3 Apr 2018 14:14:18 GMT Received: from nina.dynamic.ziggo.nl (/10.175.39.71) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 03 Apr 2018 07:14:18 -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=Ms+ncMWuqRjxNYnkIxllRACw/6WHGznXSFrKOcrCdk8=; b=rZRpiH7bQomG+JYliv3MAwZZlJjL31XQXsBDnBokfvXr+n2HDi/v8O2MF72TLptL/Tth zj+nCRgTJStZc0qysJwuOaPmspqpFFDkAqc2e5MyBVsZWUwAghneKj0A2m3knW2OtAgd BxrJ5WXrszWp3fb+i05rSvkN9Y9idJmYoToCQDGh0WhWuglIa/QOyn4964WEoD6Tos1M 2IrzU+CPPDs/LAfoaLXk8AjxBfFt42JZN6yQuv2+O0RrZDNuubarziGKzuhLF4wcVeE/ thWaL/c2qNOkrbwp+tTjnkm5oJgjRfbwrWy8MfGcCNfRcOjAvW/iKVGa8BfmzY6Zco9H Pw== From: Wim Ten Have To: Libvirt Development List Date: Tue, 3 Apr 2018 16:14:06 +0200 Message-Id: <20180403141407.13164-2-wim.ten.have@oracle.com> In-Reply-To: <20180403141407.13164-1-wim.ten.have@oracle.com> References: <20180403141407.13164-1-wim.ten.have@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8851 signatures=668697 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-1804030148 X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 03 Apr 2018 14:19:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 03 Apr 2018 14:19:20 +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 v1 1/2] storage: extend preallocation flags support for qemu-img 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 03 Apr 2018 14:19:29 +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 filesystem object storage by instructing qemu-img to build them with preallocation=3Dfalloc whenever the XML described storage matches its . For all other cases the filesystem stored 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 07:55:50 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 1522765062676595.8089957756898; Tue, 3 Apr 2018 07:17:42 -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 9934152779; Tue, 3 Apr 2018 14:17:40 +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 121337B5E8; Tue, 3 Apr 2018 14:17:40 +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 1DB1E4CA97; Tue, 3 Apr 2018 14:17:39 +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 w33EHbSn020378 for ; Tue, 3 Apr 2018 10:17:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9830A74E1A; Tue, 3 Apr 2018 14:17:37 +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 8E7A074E30 for ; Tue, 3 Apr 2018 14:17:32 +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 27225C0587DF for ; Tue, 3 Apr 2018 14:17:31 +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 w33EHNF2146747 for ; Tue, 3 Apr 2018 14:17:30 GMT Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2h4b8c8081-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 03 Apr 2018 14:17:29 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w33EEJFj005187 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 3 Apr 2018 14:14:19 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w33EEJob015041 for ; Tue, 3 Apr 2018 14:14:19 GMT Received: from nina.dynamic.ziggo.nl (/10.175.39.71) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 03 Apr 2018 07:14:18 -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=EKLcHuFwKrE30Qdi2cFa6KSyziWOgwt1cG+K1WALeIDJpmnLCL6FWyJNqHEqV2KxyFOZ H+Xb6r+nRoWmEpDfM1nLV8HMfe8Sfebo7S1vGnWM6dhs/Q2r3YsynuhJrvzlDCTbBTwg hfLQ8csMIQglJ4NrEcvjYvwJ0ORQO802Ax+o+FOwkT7oJSlaNjddFEqF8GBNRdJlFmak zc9trAdkrUdafgO6Q5VlR+jQkFBjqe0QQStQfOqShn9jhXF6UzEtdDaaUimtSlGuSrKB WsUAVRX0ZW7MUffcpnaw2rUdZl4WVKpHiCQiJSx6DeNecaWlvZalLJIuqHh6IdtmJUJy 0g== From: Wim Ten Have To: Libvirt Development List Date: Tue, 3 Apr 2018 16:14:07 +0200 Message-Id: <20180403141407.13164-3-wim.ten.have@oracle.com> In-Reply-To: <20180403141407.13164-1-wim.ten.have@oracle.com> References: <20180403141407.13164-1-wim.ten.have@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8851 signatures=668697 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=639 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804030148 X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 03 Apr 2018 14:17:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 03 Apr 2018 14:17:31 +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 v1 2/2] tests: add qemu-img test for 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 03 Apr 2018 14:17:41 +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