Bug 1651872

Summary: [fast train] preallocation mode doesn't work for luks format
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Yihuang Yu <yihyu>
Component: qemu-kvmAssignee: Daniel Berrangé <berrange>
Status: CLOSED DUPLICATE QA Contact: Tingting Mao <timao>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: chayang, coli, hpopal, jen, juzhang, kanderso, knoel, mtessun, ngu, qzhang, rbalakri, timao, virt-maint
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-16 07:47:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yihuang Yu 2018-11-21 05:47:04 UTC
Description of problem:
QEMU support preallocation mode for luks format now, actually I can use it when creating the a luks image, but the image is not preallocated.
RHEL7 has the same bugs: https://bugzilla.redhat.com/show_bug.cgi?id=1534951#c4 https://bugzilla.redhat.com/show_bug.cgi?id=1594864

Version-Release number of selected component (if applicable):
QEMU version (fast train)
# /usr/libexec/qemu-kvm --version
QEMU emulator version 3.0.0 (qemu-kvm-3.0.0-2.module+el8+2208+e41b12e0)

How reproducible:
100%

Steps to Reproduce:
1. Check the support options
# qemu-img create -f luks --object secret,id=sec0,data=test -o key-secret=sec0 test.luks 1G -o ?
Supported options:
size             Virtual disk size
key-secret       ID of the secret that provides the keyslot passphrase
cipher-alg       Name of encryption cipher algorithm
cipher-mode      Name of encryption cipher mode
ivgen-alg        Name of IV generator algorithm
ivgen-hash-alg   Name of IV generator hash algorithm
hash-alg         Name of encryption hash algorithm
iter-time        Time to spend in PBKDF in milliseconds
nocow            Turn off copy-on-write (valid only on btrfs)
preallocation    Preallocation mode (allowed values: off, falloc, full)

2. Create a luks image with full mode
# qemu-img create -f luks --object secret,id=sec0,data=testfull -o key-secret=sec0 testfull.luks 1G -o preallocation=full
Formatting 'testfull.luks', fmt=luks size=1073741824 key-secret=sec0 preallocation=full
# qemu-img info --object secret,data=testfull,id=sec0 --image-opts driver=file,filename=testfull.luks
image: testfull.luks
file format: file
virtual size: 1.0G (1075810304 bytes)
disk size: 256K
# du -ah
256K	./testfull.luks
256K	.

3.Create a luks image with falloc mode
# qemu-img create -f luks --object secret,id=sec0,data=testfalloc -o key-secret=sec0 testfalloc.luks 1G -o preallocation=falloc
Formatting 'testfalloc.luks', fmt=luks size=1073741824 key-secret=sec0 preallocation=falloc
# qemu-img info --object secret,data=testfalloc,id=sec0 --image-opts driver=file,filename=testfalloc.luks
image: testfalloc.luks
file format: file
virtual size: 1.0G (1075810304 bytes)
disk size: 256K
# du -ah
256K	./testfull.luks
256K	./testfalloc.luks
512K	.

4. Create a luks image with off mode
# qemu-img create -f luks --object secret,id=sec0,data=testoff -o key-secret=sec0 testoff.luks 1G -o preallocation=off
Formatting 'testoff.luks', fmt=luks size=1073741824 key-secret=sec0 preallocation=off
# qemu-img info --object secret,data=testoff,id=sec0 --image-opts driver=file,filename=testoff.luks
image: testoff.luks
file format: file
virtual size: 1.0G (1075810304 bytes)
disk size: 256K
# du -ah
256K	./testfull.luks
256K	./testfalloc.luks
256K	./testoff.luks
768K	.

Additional info:

Comment 2 Tingting Mao 2019-07-16 07:47:47 UTC

*** This bug has been marked as a duplicate of bug 1534951 ***