Bug 1191402 - The error info is not accurate when create image with specify wrong backing_fmt
Summary: The error info is not accurate when create image with specify wrong backing_fmt
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: qemu-kvm
Version: ---
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: 8.0
Assignee: Virtualization Maintenance
QA Contact: Xueqiang Wei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-11 09:24 UTC by Shanzhi Yu
Modified: 2020-12-16 08:49 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-12-15 06:29:56 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Shanzhi Yu 2015-02-11 09:24:58 UTC
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:

Comment 3 juzhang 2017-06-08 11:42:13 UTC
Hi Cong,

Please update the QE contact.

Comment 4 Longxiang Lyu 2018-07-29 07:45:10 UTC
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

Comment 5 Ping Li 2018-08-06 05:01:38 UTC
(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.

Comment 7 Ademar Reis 2020-02-05 22:42:00 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 12 Xueqiang Wei 2020-12-15 06:29:50 UTC
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

Comment 13 RHEL Program Management 2020-12-15 06:29:56 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.