Description of problem: not support preallocation=falloc/full/off when create raw image on cephfs Version-Release number of selected component (if applicable): kernel-3.10.0-785.el7.x86_64 qemu-kvm-rhev-2.10.0-6.el7 ceph-12.2.1-37.el7cp.x86_64 How reproducible: 100% Steps to Reproduce: 1. create raw image on cephfs # qemu-img create -f raw rbd:kvm-test/test.img:mon_host=10.73.199.64 1G Formatting 'rbd:kvm-test/test.img:mon_host=10.73.199.64', fmt=raw size=1073741824 2. create raw image on cephfs with preallocation=off/full/falloc # qemu-img create -f raw -o preallocation=off rbd:kvm-test/test1.img:mon_host=10.73.199.64 1G qemu-img: Invalid parameter 'preallocation' qemu-img: rbd:kvm-test/test1.img:mon_host=10.73.199.64: Invalid options for file format 'raw' # qemu-img create -f raw -o preallocation=full rbd:kvm-test/test1.img:mon_host=10.73.199.64 1G qemu-img: Invalid parameter 'preallocation' qemu-img: rbd:kvm-test/test1.img:mon_host=10.73.199.64: Invalid options for file format 'raw' # qemu-img create -f raw -o preallocation=falloc rbd:kvm-test/test1.img:mon_host=10.73.199.64 1G qemu-img: Invalid parameter 'preallocation' qemu-img: rbd:kvm-test/test1.img:mon_host=10.73.199.64: Invalid options for file format 'raw' Actual results: As the results above. Expected results: Should successfully create raw image with preallocation on cephfs. If preallocation mode is not supported, should give error message like "preallocation not supported" instead of "qemu-img: Invalid parameter 'preallocation'" Additional info:
Creating raw image with preallocation=falloc/full/off on iSCSI backend also has this problem: # qemu-img create -f raw iscsi://10.0.0.7/iqn.2017-08.com.yilzhang:libiscsi/0 10G -o preallocation=full qemu-img: Invalid parameter 'preallocation' qemu-img: iscsi://10.0.0.7/iqn.2017-08.com.yilzhang:libiscsi/0: Invalid options for file format 'raw'
*** Bug 1200232 has been marked as a duplicate of this bug. ***
I posted a patch upstream to add the support of preallocation (full/off) for RBD images. https://lists.gnu.org/archive/html/qemu-devel/2019-04/msg04663.html
For qcow2 with rbd, preallocation=full does not work now. Tested with: qemu-kvm-4.1.0-4.module+el8.1.0+4020+16089f93 kernel-4.18.0-135.el8 Preallocation=off # qemu-img create -f qcow2 -o preallocation=off rbd:kvmtest-pool/test.qcow2 2G Formatting 'rbd:kvmtest-pool/test.qcow2', fmt=qcow2 size=2147483648 cluster_size=65536 preallocation=off lazy_refcounts=off refcount_bits=16 # qemu-img map --output=json rbd:kvmtest-pool/test_off.img [{ "start": 0, "length": 2147483648, "depth": 0, "zero": true, "data": false}] Preallocation=metadata # qemu-img create -f qcow2 -o preallocation=metadata rbd:kvmtest-pool/test.qcow2 5G Formatting 'rbd:kvmtest-pool/test.qcow2', fmt=qcow2 size=5368709120 cluster_size=65536 preallocation=metadata lazy_refcounts=off refcount_bits=16 # qemu-img map --output=json rbd:kvmtest-pool/test.qcow2 [{ "start": 0, "length": 536870912, "depth": 0, "zero": false, "data": true, "offset": 327680}, { "start": 536870912, "length": 536870912, "depth": 0, "zero": false, "data": true, "offset": 537264128}, { "start": 1073741824, "length": 536870912, "depth": 0, "zero": false, "data": true, "offset": 1074200576}, { "start": 1610612736, "length": 536870912, "depth": 0, "zero": false, "data": true, "offset": 1611137024}, { "start": 2147483648, "length": 536870912, "depth": 0, "zero": false, "data": true, "offset": 2148139008}, { "start": 2684354560, "length": 536870912, "depth": 0, "zero": false, "data": true, "offset": 2685075456}, { "start": 3221225472, "length": 536870912, "depth": 0, "zero": false, "data": true, "offset": 3222011904}, { "start": 3758096384, "length": 536870912, "depth": 0, "zero": false, "data": true, "offset": 3758948352}, { "start": 4294967296, "length": 536870912, "depth": 0, "zero": false, "data": true, "offset": 4295950336}, { "start": 4831838208, "length": 536870912, "depth": 0, "zero": false, "data": true, "offset": 4832886784}] Preallocation=full # qemu-img create -f qcow2 -o preallocation=full rbd:kvmtest-pool/test_full.qcow2 5G Formatting 'rbd:kvmtest-pool/test_full.qcow2', fmt=qcow2 size=5368709120 cluster_size=65536 preallocation=full lazy_refcounts=off refcount_bits=16 qemu-img: rbd:kvmtest-pool/test_full.qcow2: Could not resize image: Failed to resize underlying file: Unsupported preallocation mode 'full'
(In reply to Tingting Mao from comment #9) > For qcow2 with rbd, preallocation=full does not work now. > The patch is not merged yet, I sent a v3 [1] and now I'm working on the v4. I hope I'll send it this week. [1] https://www.mail-archive.com/qemu-devel@nongnu.org/msg632765.html
*** Bug 1782666 has been marked as a duplicate of this bug. ***
QEMU has been recently split into sub-components and as a one-time operation to avoid breakage of tools, we are setting the QEMU sub-component of this BZ to "General". Please review and change the sub-component if necessary the next time you review this BZ. Thanks
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release. Therefore, it is being closed. If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.
For rbd backend, only create qcow2 image with preallocation=off has no error. As it is a RFE bug, QA agrees to close this bug. Checked version qemu-kvm-5.2.0-1.module+el8.4.0+9091+650b220a.x86_64 #qemu-img create -f qcow2 -o preallocation=off rbd:rbd/test.qcow2 1G Formatting 'rbd:rbd/test.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off preallocation=off compression_type=zlib size=1073741824 lazy_refcounts=off refcount_bits=16