Bug 1383012 - qemu-img command should return non-zero error value on fail
Summary: qemu-img command should return non-zero error value on fail
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev   
(Show other bugs)
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Max Reitz
QA Contact: Ping Li
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-09 06:32 UTC by Ping Li
Modified: 2018-03-22 05:13 UTC (History)
15 users (show)

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 23:37:14 UTC
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 09:27 UTC, 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 20:04:36 UTC

Description Ping Li 2016-10-09 06:32:25 UTC
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 09:27 UTC
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 08:45:28 UTC
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 12:27:14 UTC
According to the comment 4, set the bug as verified.

Comment 8 errata-xmlrpc 2017-08-01 23:37:14 UTC
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-02 01:14:54 UTC
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-02 02:06:52 UTC
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-02 02:47:39 UTC
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-02 03:12:20 UTC
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-02 03:32:30 UTC
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.