Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1383012 - qemu-img command should return non-zero error value on fail
qemu-img command should return non-zero error value on fail
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
7.3
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Max Reitz
Ping Li
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-10-09 02:32 EDT by Ping Li
Modified: 2018-03-22 01:13 EDT (History)
15 users (show)

See Also:
Fixed In Version: 2.8.0
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-01 19:37:14 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch to fix unsuccessful qemu-img rebase command return zero exit code (1.17 KB, patch)
2016-10-09 05:27 EDT, xu
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:2392 normal SHIPPED_LIVE Important: qemu-kvm-rhev security, bug fix, and enhancement update 2017-08-01 16:04:36 EDT

  None (edit)
Description Ping Li 2016-10-09 02:32:25 EDT
Description of problem:
When rebase an image without backing file to the other image, the operation failed with zero error value returned.

Version-Release number of selected component (if applicable):
# rpm -qa | grep qemu-kvm-rhev
qemu-kvm-rhev-2.6.0-27.el7.x86_64
# uname -r
3.10.0-512.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Create image1 and image2
    # qemu-img create -f qcow2 image1.qcow2 1G
Formatting 'image1.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
    # qemu-img create -f qcow2 image2.qcow2 1G
Formatting 'image2.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
2. Change the backing file of image2 to image1 and check return code.
    # qemu-img rebase -f qcow2 -b image1.qcow2 -F qcow2 image2.qcow2 
qemu-img: Could not open old backing file '': Could not open image: No such file or directory
    # echo $?
0
3. Change the backing file of non-existent image3 to image1 and check return code.
    # qemu-img rebase -f qcow2 -b image1.qcow2 -F qcow2 image3.qcow2 
qemu-img: Could not open 'image3.qcow2': Could not open 'image3.qcow2': No such file or directory
    # echo $?
1

Actual results:
zero error value is returned

Expected results:
non-zero error value is returned

Additional info:
Comment 2 xu 2016-10-09 05:27 EDT
Created attachment 1208509 [details]
patch to fix unsuccessful qemu-img rebase command return zero exit code

root cause is that var 'ret' not be assign non-zero value before go out. attache a patch to fix this defeat.

thanks,
Xu
Comment 4 Ping Li 2017-01-13 03:45:28 EST
kernel and qemu version:
# uname -r
3.10.0-541.el7.x86_64
# /usr/libexec/qemu-kvm -version
qemu-kvm-rhev-2.8.0-1.el7

verify the issue with below steps:
# qemu-img create -f qcow2 image1.qcow2 1G
Formatting 'image1.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
# qemu-img create -f qcow2 image2.qcow2 1G
Formatting 'image2.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
# qemu-img rebase -f qcow2 -b image1.qcow2 -F qcow2 image2.qcow2
qemu-img: Could not open old backing file '': Could not open '': No such file or directory
# echo $?
1
[root@amd-6168-8-1 verify_bug]# qemu-img rebase -f qcow2 -b image1.qcow2 -F qcow2 image3.qcow2
qemu-img: Could not open 'image3.qcow2': Could not open 'image3.qcow2': No such file or directory
[root@amd-6168-8-1 verify_bug]# echo $?
1
Comment 6 Ping Li 2017-01-17 07:27:14 EST
According to the comment 4, set the bug as verified.
Comment 8 errata-xmlrpc 2017-08-01 19:37:14 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392
Comment 9 errata-xmlrpc 2017-08-01 21:14:54 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392
Comment 10 errata-xmlrpc 2017-08-01 22:06:52 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392
Comment 11 errata-xmlrpc 2017-08-01 22:47:39 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392
Comment 12 errata-xmlrpc 2017-08-01 23:12:20 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392
Comment 13 errata-xmlrpc 2017-08-01 23:32:30 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392

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