Description of problem: 'qemu-img resize' should give error info when specifying '--shrink' and '+${size}' simultaneously. Version-Release number of selected component (if applicable): qemu-kvm-3.1.0-0.module+el8+2266+616cf026.next.candidate kernel-4.18.0-45.el8 How reproducible: 100% Steps to Reproduce: 1. Create a test image file # qemu-img create -f qcow2 test.qcow2 1G 2. Resize it. # qemu-img resize --shrink test.qcow2 +2G Image resized. 3. Check info of the test image. # qemu-img info test.qcow2 image: test.qcow2 file format: qcow2 virtual size: 3.0G (3221225472 bytes) disk size: 768K cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: false refcount bits: 16 corrupt: false Actual results: As above. Expected results: After step2, qemu-img should give error info like 'could not specifying '--shrink' and '+${size}' simultaneously'. Additional info:
Hi, Sorry for the late reply. I don’t think this is worth fixing. First, if we make +$size an error, we should make all cases of growing an image together with --shrink an error. But I don’t think it is useful to do so. There are valid cases where users might want to specify --shrink when growing an image: Say you have a script and you want to bring an image to a fixed size, regardless of whether it needs to be shrunk or grown. Then it would be cumbersome to have to query the current image size to know whether to pass --shrink or not. On the other hand, I don’t think an error message would help the user. Either they know what they’re doing (i.e. --shink has no effect), or they accidentally grow the image when they meant to shrink it. In the latter case, nothing bad happens, they can easily shrink the image again. Max