Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1782666

Summary: 'qemu-img create' images over RBD with preallocation=full/falloc does not work
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Tingting Mao <timao>
Component: qemu-kvmAssignee: Stefano Garzarella <sgarzare>
qemu-kvm sub component: Storage QA Contact: Tingting Mao <timao>
Status: CLOSED DUPLICATE Docs Contact:
Severity: unspecified    
Priority: medium CC: coli, jinzhao, juzhang, qzhang, virt-maint, xuwei
Version: 8.2   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-17 09:42:12 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 Tingting Mao 2019-12-12 05:10:16 UTC
Description of problem:
As subject.


Version-Release number of selected component (if applicable):
qemu-kvm-4.2.0-2.module+el8.2.0+5135+ed3b2489
kernel-4.18.0-153.el8.x86_64


How reproducible:
100%


Steps to Reproduce:
1.Check the supported option for images over RBD.
# qemu-img create -f qcow2 -o ? rbd:xx
Supported options:
  backing_file=<str>     - File name of a base image
  backing_fmt=<str>      - Image format of the base image
  cluster_size=<size>    - qcow2 cluster size
  compat=<str>           - Compatibility level (v2 [0.10] or v3 [1.1])
  data_file=<str>        - File name of an external data file
  data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
  encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
  encrypt.cipher-mode=<str> - Name of encryption cipher mode
  encrypt.format=<str>   - Encrypt the image, format choices: 'aes', 'luks'
  encrypt.hash-alg=<str> - Name of encryption hash algorithm
  encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds
  encrypt.ivgen-alg=<str> - Name of IV generator algorithm
  encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm
  encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase
  encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes)
  lazy_refcounts=<bool (on/off)> - Postpone refcount updates
  password-secret=<str>  - ID of secret providing the password
  preallocation=<str>    - Preallocation mode (allowed values: off, metadata, falloc, full) -------------- Here are all the supported preallocation modes.
  refcount_bits=<num>    - Width of a reference count entry in bits
  size=<size>            - Virtual disk size

2. Create with preallocation=full
# qemu-img create -f qcow2 -o preallocation=full rbd:rbd/test_full.qcow2 2G
Formatting 'rbd:rbd/test_full.qcow2', fmt=qcow2 size=2147483648 cluster_size=65536 preallocation=full lazy_refcounts=off refcount_bits=16
qemu-img: rbd:rbd/test_full.qcow2: Could not resize image: Failed to resize underlying file: Unsupported preallocation mode 'full'

3. Create with preallocation=falloc.
# qemu-img create -f qcow2 -o preallocation=falloc rbd:rbd/test_falloc.qcow2 2G
Formatting 'rbd:rbd/test_falloc.qcow2', fmt=qcow2 size=2147483648 cluster_size=65536 preallocation=falloc lazy_refcounts=off refcount_bits=16
qemu-img: rbd:rbd/test_falloc.qcow2: Could not resize image: Failed to resize underlying file: Unsupported preallocation mode 'falloc'


Actual results:
As above. Create fails.


Expected results:
Create successfully or ***not*** list the unsupported options in step1. 


Additional info:
Preallocation=off/metadata works well.
1. Create with off.
# qemu-img create -f qcow2 -o preallocation=off rbd:rbd/test_off.qcow2 2G
Formatting 'rbd:rbd/test_off.qcow2', fmt=qcow2 size=2147483648 cluster_size=65536 preallocation=off lazy_refcounts=off refcount_bits=16
# qemu-img map --output=json rbd:rbd/test_off.qcow2
[{ "start": 0, "length": 2147483648, "depth": 0, "zero": true, "data": false}]

2. Create with metadata.
# qemu-img create -f qcow2 -o preallocation=metadata rbd:rbd/test_meta.qcow2 2G
Formatting 'rbd:rbd/test_meta.qcow2', fmt=qcow2 size=2147483648 cluster_size=65536 preallocation=metadata lazy_refcounts=off refcount_bits=16
# qemu-img map --output=json rbd:rbd/test_meta.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}]

Comment 1 Stefano Garzarella 2019-12-17 09:42:12 UTC
(In reply to Tingting Mao from comment #0)

>   preallocation=<str>    - Preallocation mode (allowed values: off,
> metadata, falloc, full) -------------- Here are all the supported
> preallocation modes.

This output is referred to the qcow2 format. Unfortunately, it's not intersected with the protocol level (RBD), but only new options provided by the protocol are added.

For example if I ask the rbd options, I have the following:
$ qemu-img create -f rbd -o ? rbd://xx
Supported options:
  cluster_size=<size>    - RBD object size
  password-secret=<str>  - ID of secret providing the password
  size=<size>            - Virtual disk size

Anyway, the BZ#1514373 is already tracking the request to support preallocation in the QEMU's rbd driver, so I mark this BZ as a duplicate if you agree.

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