+++ 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