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

Bug 1654639

Summary: [rhel.8.0][fast train]qemu-img shouldn't truncate image while creating qcow2 file with invalid option values
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Tingting Mao <timao>
Component: qemu-kvmAssignee: Hanna Czenczek <hreitz>
Status: CLOSED DUPLICATE QA Contact: Tingting Mao <timao>
Severity: low Docs Contact:
Priority: low    
Version: 8.0CC: areis, chaoyang, chayang, coli, hreitz, jen, juzhang, kanderso, knoel, kwolf, michen, mtessun, pingl, rbalakri, ribarry, timao, virt-maint
Target Milestone: rcKeywords: Regression
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1613215 Environment:
Last Closed: 2019-02-01 17:05:25 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:
Bug Depends On: 1613215    
Bug Blocks: 1649160    

Description Tingting Mao 2018-11-29 10:16:57 UTC
+++ This bug was initially created as a clone of Bug #1613215 +++

Description of problem:
Qemu-img should create no file when the value of supported option is not correct.

Version-Release number of selected component (if applicable):
qemu-kvm-3.1.0-0.el8.rc2
kernel-4.18.0-45.el8

How reproducible:
100%

Steps to Reproduce:
1.Create qcow2 image with unsupported value of option
# qemu-img create -f qcow2 -o preallocation=xxxxtt test02.qcow2 1G
Formatting 'test02.qcow2', fmt=qcow2 size=1073741824 cluster_size=65536 preallocation=xxxxtt lazy_refcounts=off refcount_bits=16
qemu-img: test02.qcow2: Invalid parameter 'xxxxtt'
# qemu-img create -f qcow2 -o cluster_size=0 test03.qcow2 1G
Formatting 'test03.qcow2', fmt=qcow2 size=1073741824 cluster_size=0 lazy_refcounts=off refcount_bits=16
qemu-img: test03.qcow2: Cluster size must be a power of two between 512 and 2048k
2.Check the info of the images created in step1
# qemu-img info test02.qcow2 
image: test02.qcow2
file format: raw
virtual size: 0 (0 bytes)
disk size: 0
# qemu-img info test03.qcow2 
image: test03.qcow2
file format: raw
virtual size: 0 (0 bytes)
disk size: 0


Actual results:

Expected results:
There should be no images when specifying the wrong value of the option.


Additional info:
The result is as expected for raw image[1].
And there is no file in qemu-kvm-rhev-2.10.0[2]. So I mark this issue as regression.

[1]# qemu-img create -f raw -o preallocation=tttxxx test03.img 1G
Formatting 'test03.img', fmt=raw size=1073741824 preallocation=tttxxx
qemu-img: test03.img: invalid parameter value: tttxxx
# qemu-img info test03.img
qemu-img: Could not open 'test03.img': Could not open 'test03.img': No such file or directory

[2]# qemu-img --version
qemu-img version 2.10.0(qemu-kvm-rhev-2.10.0-21.el7_5.1)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
# qemu-img create -f qcow2 -o preallocation=xxxxtt test02.qcow2 1G
Formatting 'test02.qcow2', fmt=qcow2 size=1073741824 cluster_size=65536 preallocation=xxxxtt lazy_refcounts=off refcount_bits=16
qemu-img: test02.qcow2: invalid parameter value: xxxxtt
# qemu-img info test02.qcow2
qemu-img: Could not open 'test02.qcow2': Could not open 'test02.qcow2': No such file or directory

Comment 3 Ademar Reis 2019-02-01 17:02:51 UTC
*** Bug 1613215 has been marked as a duplicate of this bug. ***

Comment 4 Ademar Reis 2019-02-01 17:05:25 UTC

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