Description of problem: The error info is not accurate when create image with specify wrong backing_fmt Version-Release number of selected component (if applicable): qemu-img-rhev-2.1.2-21.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. Prepare a raw format images # qemu-img create /var/lib/libvirt/images/base.img 1G Formatting '/var/lib/libvirt/images/base.img', fmt=raw size=1073741824 # qemu-img info /var/lib/libvirt/images/base.img image: /var/lib/libvirt/images/base.img file format: raw virtual size: 1.0G (1073741824 bytes) disk size: 0 2. Create a qcow2 format images and take base.img as backing file and specify wrong backing_fmt # qemu-img create -f qcow2 /var/lib/libvirt/images/base.s1 -b /var/lib/libvirt/images/base.img -o backing_fmt=qcow2 qemu-img: /var/lib/libvirt/images/base.s1: Image is not in qcow2 format # ll /var/lib/libvirt/images/base.s1 ls: cannot access /var/lib/libvirt/images/base.s1: No such file or directory 3. Actual results: Expected results: qemu should post error that base.img is not in qcow2 format but not base.s1 Additional info:
Hi Cong, Please update the QE contact.
same issue with lvm: # qemu-img info /dev/mapper/vg--lolyu-img0 image: /dev/mapper/vg--lolyu-img0 file format: qcow2 virtual size: 20G (21474836480 bytes) disk size: 0 cluster_size: 512 Format specific information: compat: 1.1 lazy refcounts: false refcount bits: 16 corrupt: false # qemu-img create -f qcow2 -o backing_file=/dev/mapper/vg--lolyu-img0,backing_fmt=raw /dev/mapper/vg--lolyu-img1 Formatting '/dev/mapper/vg--lolyu-img1', fmt=qcow2 size=21474836480 backing_file=/dev/mapper/vg--lolyu-img0 backing_fmt=raw cluster_size=65536 lazy_refcounts=off refcount_bits=16
(In reply to Longxiang Lyu from comment #4) > same issue with lvm: > # qemu-img info /dev/mapper/vg--lolyu-img0 > image: /dev/mapper/vg--lolyu-img0 > file format: qcow2 > virtual size: 20G (21474836480 bytes) > disk size: 0 > cluster_size: 512 > Format specific information: > compat: 1.1 > lazy refcounts: false > refcount bits: 16 > corrupt: false > > # qemu-img create -f qcow2 -o > backing_file=/dev/mapper/vg--lolyu-img0,backing_fmt=raw > /dev/mapper/vg--lolyu-img1 > Formatting '/dev/mapper/vg--lolyu-img1', fmt=qcow2 size=21474836480 > backing_file=/dev/mapper/vg--lolyu-img0 backing_fmt=raw cluster_size=65536 > lazy_refcounts=off refcount_bits=16 Any file could be used as a valid raw image. QEMU doesn't check whether it is true. When the user tells QEMU that a qcow2 image is in raw format, what QEMU does is assuming that the user is right. So there is no issue in comment 4.
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
Tested with qemu-kvm-5.2.0-1.module+el8.4.0+9091+650b220a, also hit this issue. Versions: kernel-4.18.0-260.el8.x86_64 qemu-kvm-5.2.0-1.module+el8.4.0+9091+650b220a 1. Prepare a raw format images # qemu-img create -f raw base.img 1G Formatting 'base.img', fmt=raw size=1073741824 2. Create a qcow2 format images and take base.img as backing file and specify wrong backing_fmt # qemu-img create -f qcow2 sn1.qcow2 -b base.img -o backing_fmt=qcow2 qemu-img: sn1.qcow2: Image is not in qcow2 format Could not open backing image. # ll sn1.qcow2 ls: cannot access 'sn1.qcow2': No such file or directory after step 2, qemu should post error that base.img is not in qcow2 format but not sn1.qcow2
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release. Therefore, it is being closed. If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.