Description of problem: 'qemu-img measure' now supports raw, qcow2 and luks-inside-qcow2, but not luks. After a discussion with Stefan, we could support luks in rhel 8.x. Thanks. Version-Release number of selected component (if applicable): qemu-kvm-3.1.0-22.module+el8.0.1+3032+a09688b9 kernel-4.18.0-80.el8 How reproducible: 100% Steps to Reproduce: Scenario 1(Measure for a new created luks image) # qemu-img measure -O luks --size 4G qemu-img: Block driver 'luks' does not support size measurement Scenario 2(Measure for a new converted luks image) # qemu-img info base.qcow2 image: base.qcow2 file format: qcow2 virtual size: 5.0G (5368709120 bytes) disk size: 1.0G cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: false refcount bits: 16 corrupt: false # qemu-img measure -f qcow2 -O luks base.qcow2 qemu-img: Block driver 'luks' does not support size measurement Actual results: As above. Expected results: Given the required sizes for luks images. Additional info:
Patches posted upstream: https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg01337.html
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
Hi Stefan, I tested this bug on qemu-kvm-5.0.0-0.module+el8.3.0+6620+5d5e1420. It works well, it should has been fixed already. Please help check it. If I was wrong, please correct me. Many thanks. Versions: kernel-4.18.0-202.el8.x86_64 qemu-kvm-5.0.0-0.module+el8.3.0+6620+5d5e1420 Scenario 1(Measure for a new created luks image) # qemu-img measure --object secret,id=sec0,data=base -O luks -o key-secret=sec0 --size 4G required size: 4297035776 fully allocated size: 4297035776 # qemu-img create --object secret,id=sec0,data=base -o key-secret=sec0 -f luks test1.luks 4G Formatting 'test1.luks', fmt=luks size=4294967296 key-secret=sec0 # ls -als test1.luks 256 -rw-r--r--. 1 root root 4297035776 May 27 04:22 test1.luks # qemu-img create --object secret,id=sec0,data=base -o key-secret=sec0,preallocation=full -f luks test1.luks 4G Formatting 'test1.luks', fmt=luks size=4294967296 key-secret=sec0 preallocation=full # ls -als test1.luks 4196324 -rw-r--r--. 1 root root 4297035776 May 27 04:25 test1.luks Scenario 2(Measure for a new converted luks image) # qemu-img create --object secret,id=sec0,data=base -o key-secret=sec0 -f luks original.img 4G Formatting 'original.img', fmt=luks size=4294967296 key-secret=sec0 # qemu-io -c 'write 0 1G' --object secret,id=sec0,data=base --image-opts driver=luks,file.filename=original.img,key-secret=sec0 wrote 1073741824/1073741824 bytes at offset 0 1 GiB, 1 ops; 0:00:09.27 (110.510 MiB/sec and 0.1079 ops/sec) # qemu-img info original.img image: original.img file format: luks virtual size: 4 GiB (4294967296 bytes) disk size: 1 GiB encrypted: yes Format specific information: ivgen alg: plain64 hash alg: sha256 cipher alg: aes-256 uuid: 0925e6b8-dcac-4258-b90e-56234db4814c cipher mode: xts slots: [0]: active: true iters: 1108900 key offset: 4096 stripes: 4000 [1]: active: false key offset: 262144 [2]: active: false key offset: 520192 [3]: active: false key offset: 778240 [4]: active: false key offset: 1036288 [5]: active: false key offset: 1294336 [6]: active: false key offset: 1552384 [7]: active: false key offset: 1810432 payload offset: 2068480 master key iters: 277033 Calculate the file size for convert luks to luks # qemu-img measure --object secret,id=sec1,data=base -O luks -o key-secret=sec1 --object secret,id=sec0,data=base --image-opts driver=luks,file.filename=original.img,key-secret=sec0 required size: 4297035776 fully allocated size: 4297035776 # qemu-img convert -p --object secret,id=sec0,data=base --object secret,id=sec1,data=base --image-opts driver=luks,file.filename=original.img,key-secret=sec0 -O luks -o key-secret=sec1 convert.luks (100.00/100%) # ls -als convert.luks 4194560 -rw-r--r--. 1 root root 4297035776 May 27 05:01 convert.luks Calculate the file size for convert luks to qcow2 # qemu-img measure -O qcow2 --object secret,id=sec0,data=base --image-opts driver=luks,file.filename=original.img,key-secret=sec0 required size: 4295884800 fully allocated size: 4295884800 # qemu-img convert -p --object secret,id=sec0,data=base --image-opts driver=luks,file.filename=original.img,key-secret=sec0 -O qcow2 convert.qcow2 (100.00/100%) # ls -als convert.qcow2 4195140 -rw-r--r--. 1 root root 4295884800 May 27 05:10 convert.qcow2 Calculate the file size for convert luks to raw # qemu-img measure -O raw --object secret,id=sec0,data=base --image-opts driver=luks,file.filename=original.img,key-secret=sec0 required size: 4294967296 fully allocated size: 4294967296 # qemu-img convert -p --object secret,id=sec0,data=base --image-opts driver=luks,file.filename=original.img,key-secret=sec0 -O raw convert.raw (100.00/100%) # ls -als convert.raw 4194304 -rw-r--r--. 1 root root 4294967296 May 27 05:13 convert.raw
(In reply to Xueqiang Wei from comment #3) > I tested this bug on qemu-kvm-5.0.0-0.module+el8.3.0+6620+5d5e1420. It works > well, it should has been fixed already. > > Please help check it. If I was wrong, please correct me. Many thanks. Excellent! The output looks as expected. QEMU 5.0 contains the patches so qemu-kvm-5.0.0-0.module+el8.3.0+6620+5d5e1420 should indeed have the patches. There is also an automated test for this feature: cd tests/qemu-iotests && ./check -luks 288
Based on Stefan's comment, moving this BZ to MODIFIED.
According to Comment 3, retested with qemu-kvm-5.0.0-2.module+el8.3.0+7379+0505d6ca, all work as expected. So set status to VERIFIED. Versions: kernel-4.18.0-222.el8.x86_64 qemu-kvm-5.0.0-2.module+el8.3.0+7379+0505d6ca Scenario 1(Measure for a new created luks image) # qemu-img measure --object secret,id=sec0,data=base -O luks -o key-secret=sec0 --size 4G required size: 4297035776 fully allocated size: 4297035776 # qemu-img create --object secret,id=sec0,data=base -o key-secret=sec0 -f luks test1.luks 4G Formatting 'test1.luks', fmt=luks size=4294967296 key-secret=sec0 # ls -als test1.luks 256 -rw-r--r--. 1 root root 4297035776 Jul 17 03:00 test1.luks # qemu-img create --object secret,id=sec0,data=base -o key-secret=sec0,preallocation=full -f luks test1.luks 4G Formatting 'test1.luks', fmt=luks size=4294967296 key-secret=sec0 preallocation=full # ls -als test1.luks 4196324 -rw-r--r--. 1 root root 4297035776 Jul 17 03:01 test1.luks Scenario 2(Measure for a new converted luks image) # qemu-img create --object secret,id=sec0,data=base -o key-secret=sec0 -f luks original.img 4G Formatting 'original.img', fmt=luks size=4294967296 key-secret=sec0 # qemu-io -c 'write 0 1G' --object secret,id=sec0,data=base --image-opts driver=luks,file.filename=original.img,key-secret=sec0 wrote 1073741824/1073741824 bytes at offset 0 1 GiB, 1 ops; 0:00:01.23 (834.046 MiB/sec and 0.8145 ops/sec) # qemu-img info original.img image: original.img file format: luks virtual size: 4 GiB (4294967296 bytes) disk size: 1 GiB encrypted: yes Format specific information: ivgen alg: plain64 hash alg: sha256 cipher alg: aes-256 uuid: 2faec40c-d530-46f0-85b9-a19a0678a1a4 cipher mode: xts slots: [0]: active: true iters: 1779088 key offset: 4096 stripes: 4000 [1]: active: false key offset: 262144 [2]: active: false key offset: 520192 [3]: active: false key offset: 778240 [4]: active: false key offset: 1036288 [5]: active: false key offset: 1294336 [6]: active: false key offset: 1552384 [7]: active: false key offset: 1810432 payload offset: 2068480 master key iters: 444589 Calculate the file size for convert luks to luks # qemu-img measure --object secret,id=sec1,data=base -O luks -o key-secret=sec1 --object secret,id=sec0,data=base --image-opts driver=luks,file.filename=original.img,key-secret=sec0 required size: 4297035776 fully allocated size: 4297035776 # qemu-img convert -p --object secret,id=sec0,data=base --object secret,id=sec1,data=base --image-opts driver=luks,file.filename=original.img,key-secret=sec0 -O luks -o key-secret=sec1 convert.luks (100.00/100%) # ls -als convert.luks 4194560 -rw-r--r--. 1 root root 4297035776 Jul 17 03:05 convert.luks Calculate the file size for convert luks to qcow2 # qemu-img measure -O qcow2 --object secret,id=sec0,data=base --image-opts driver=luks,file.filename=original.img,key-secret=sec0 required size: 4295884800 fully allocated size: 4295884800 # qemu-img convert -p --object secret,id=sec0,data=base --image-opts driver=luks,file.filename=original.img,key-secret=sec0 -O qcow2 convert.qcow2 (100.00/100%) # ls -als convert.qcow2 4195140 -rw-r--r--. 1 root root 4295884800 Jul 17 03:06 convert.qcow2 Calculate the file size for convert luks to raw # qemu-img measure -O raw --object secret,id=sec0,data=base --image-opts driver=luks,file.filename=original.img,key-secret=sec0 required size: 4294967296 fully allocated size: 4294967296 # qemu-img convert -p --object secret,id=sec0,data=base --image-opts driver=luks,file.filename=original.img,key-secret=sec0 -O raw convert.raw (100.00/100%) # ls -als convert.raw 4194304 -rw-r--r--. 1 root root 4294967296 Jul 17 03:07 convert.raw
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (virt:8.3 bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:5137