Bug 1745885

Summary: 'qemu-img create' an overlay over RBD should look up the directory containing the overlay to find it's backing file
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Tingting Mao <timao>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
qemu-kvm sub component: Ceph QA Contact: zixchen
Status: CLOSED WONTFIX Docs Contact:
Severity: low    
Priority: medium CC: coli, hreitz, jinzhao, juzhang, ngu, qzhang, sgarzare, virt-maint, zhenyzha
Version: 8.1Keywords: Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
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: 2021-03-04 09:42:35 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-08-27 07:05:27 UTC
Description of problem:
From https://qemu.weilnetz.de/doc/qemu-doc.html#qemu_005fimg_005finvocation, we get info "If a relative path name is given, the backing file is looked up relative to the directory containing output_filename.". However, while practising this over RBD, it does not work now. 

Version-Release number of selected component (if applicable):
qemu-kvm-4.1.0-4.module+el8.1.0+4020+16089f93
kernel-4.18.0-135.el8


How reproducible:
100%


Steps to Reproduce:
1. Create a base image locally
# qemu-img create -f qcow2 base.qcow2 2G

2. Create overlay over RBD based on base.qcow2
# qemu-img create -f qcow2 -b base.qcow2 rbd:kvmtest-pool/sn.qcow2

# qemu-img info rbd:kvmtest-pool/sn.qcow2
image: json:{"driver": "qcow2", "file": {"pool": "kvmtest-pool", "image": "sn.qcow2", "driver": "rbd"}}
file format: qcow2
virtual size: 20 GiB (21474836480 bytes)
disk size: unavailable
cluster_size: 65536
backing file: base.qcow2 (cannot determine actual path)
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false


Actual results:
As above, created with no error.


Expected results:
Create image fails, and give info like below:

qemu-img: rbd:kvmtest-pool/sn.qcow2: Could not open 'rbd:kvmtest-pool/base.qcow2': No such file or directory


Additional info:
Doing more tests(Check/rebase) will failed.
# qemu-img check rbd:kvmtest-pool/sn.qcow2
qemu-img: Could not open 'rbd:kvmtest-pool/sn.qcow2': Cannot generate a base directory for rbd nodes

# qemu-img rebase -b /home/test/ceph_qcow2/new_base.qcow2 rbd:kvmtest-pool/sn.qcow2 -p
qemu-img: Could not open 'rbd:kvmtest-pool/sn.qcow2': Cannot generate a base directory for rbd nodes

Comment 1 Tingting Mao 2019-08-27 07:42:54 UTC
For 'qemu-img rebase', will hit below error.

Steps:
1. Create a qcow2 image over rbd
# qemu-img create -f qcow2 rbd:kvmtest-pool/tttt.qcow2 2G

2. Create a base.qcow2 locally
# qemu-img create -f qcow2 new_base.qcow2 2G

3. Rebase 
# qemu-img rebase -b new_base.qcow2 -f qcow2 rbd:kvmtest-pool/tttt.qcow2 -p
qemu-img: Could not resolve backing filename: Cannot use relative backing file names for 'json:{"driver": "qcow2", "file": {"pool": "kvmtest-pool", "image": "tttt.qcow2", "driver": "rbd"}}'

Comment 3 Ademar Reis 2020-02-05 23:04:02 UTC
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

Comment 7 Stefano Garzarella 2021-03-04 09:42:35 UTC
As discussed upstream [1], QCOW2 on RBD is not really well supported and it is expected to be removed.
This is also because there doesn't seem to be much advantage to using QCOW2 on RBD.

If there is a specific use case where it is useful to use QCOW2 on RBD, please open a new BZ where the requirements are explained.

AFAIK layered products, such as OpenStack, do not use QCOW2 with in-QEMU RBD.

[1] https://lists.gnu.org/archive/html/qemu-devel/2021-03/msg01045.html

Comment 8 zixchen 2021-03-08 01:16:35 UTC
As qcow2 on rbd is not really well supported and it is expected to be removed. QA agrees to close this bug.