Bug 2020993

Summary: 'qemu-img convert' to Qcow2 Images over RBD Failed
Product: Red Hat Enterprise Linux 9 Reporter: Tingting Mao <timao>
Component: qemu-kvmAssignee: Stefano Garzarella <sgarzare>
qemu-kvm sub component: Storage QA Contact: Tingting Mao <timao>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: chayang, coli, hreitz, jinzhao, juzhang, kkiwi, mrezanin, sgarzare, virt-maint, yfu
Version: 9.0Keywords: Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-7.0.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 09:53:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2044155    
Bug Blocks:    

Description Tingting Mao 2021-11-08 03:06:45 UTC
Description of problem:
As the subject, and 'qemu-img convert' to Raw images over RBD works well.


Version-Release number of selected component (if applicable):
qemu-kvm-6.1.0-6.el9
kernel-5.14.0-11.el9.x86_64


How reproducible:
100%


Steps to Reproduce:
1. Configure the RBD server info in the client end.
# cat > /etc/ceph/ceph.conf<<EOF
[global]
	cluster = testcluster
	fsid = d5ce4d4d-6a72-40e8-b59e-57a5b075a50a
 
	mon initial members = ibm-x3650m4-06
	mon host = ${rbd_server_ip}
 
	public network = 10.73.114.0/24
	cluster network = 10.73.114.0/24
 
	auth cluster required = cephx
	auth service required = cephx
	auth client required = cephx
	osd journal size = 1024
	osd pool default size = 1
	osd pool default min size = 1
	osd pool default pg num = 33
	osd pool default pgp num = 33
	osd crush chooseleaf type = 1
EOF

# cat > /etc/ceph/ceph.client.admin.keyring<<EOF
[client.admin]
    key = ${key}
    caps mds = "allow *"
    caps mgr = "allow *"
    caps mon = "allow *"
    caps osd = "allow *"
EOF

2. Prepare a source image to convert.
# qemu-img create -f raw test.img 5g
# qemu-io -f raw -c 'write -P 1 0 1.9G' test.img
# qemu-img info test.img 
image: test.img
file format: raw
virtual size: 5 GiB (5368709120 bytes)
disk size: 1.9 GiB

3. Convert the source image to a qcow2 image over RBD
# qemu-img convert -f raw -O qcow2 test.img rbd:rbd/image_convert_remote.qcow2 -p
qemu-img: rbd request failed: cmd 4 offset 2038956032 bytes 1703936 flags 256 task.ret -22 (Invalid argument)
qemu-img: error while writing at byte 2038431744: Invalid argument


Actual results:
As above, converting failed.


Expected results:
Converting successes with no error.


Additional info:
Converting the source raw image to a raw image over RBD works fine.
# qemu-img convert -f raw -O raw test.img rbd:rbd/image_convert_remote.img -p
    (100.00/100%)

Comment 2 Tingting Mao 2021-12-21 07:31:03 UTC
Still hit the issue in qemu-kvm-6.2.0-1.el9. And change the priority to Medium.

Comment 3 Stefano Garzarella 2022-03-15 14:23:25 UTC
This issue seems similar to what we fixed here: https://gitlab.com/qemu-project/qemu/-/commit/d24f80234b39d2d5c0d91e63b5e4569d37b2399e

Since QEMU 6.1 supports write_zeroes, I think we have the same problem: rbd doesn't support write beyond the current file size.

So we should do the same workaround and resize the file before requesting a write_zeroes that exceeds its current size.

Comment 8 Stefano Garzarella 2022-03-17 16:43:07 UTC
Fix posted upstream: https://lore.kernel.org/qemu-devel/20220317162638.41192-1-sgarzare@redhat.com/T/#u

Comment 9 Stefano Garzarella 2022-03-25 10:36:38 UTC
Fix merged upstream and released with QEMU v7.0.0-rc1

https://gitlab.com/qemu-project/qemu/-/commit/cc5387a544325c26dcf124ac7d3999389c24e5c6

Comment 11 Yanan Fu 2022-04-25 12:37:41 UTC
QE bot(pre verify): Set 'Verified:Tested,SanityOnly' as gating/tier1 test pass.

Comment 14 Tingting Mao 2022-04-27 03:14:53 UTC
Verified this bug as below.


Tested with:
qemu-kvm-7.0.0-1.el9
kernel-5.14.0-80.el9.x86_64


Steps:
1. Create a source local image.
# qemu-img create -f raw test.img 5g
# qemu-io -f raw -c 'write -P 1 0 1.9G' test.img

2. Convert the local image to a qcow2 image over RBD.
# qemu-img convert -f raw -O qcow2 test.img rbd:rbd/image_convert_remote.qcow2 -p
    (100.00/100%)


Results:
As above, converting successfully.

Comment 16 errata-xmlrpc 2022-11-15 09:53:29 UTC
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 (Moderate: qemu-kvm security, 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/RHSA-2022:7967