RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
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
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Hanna Czenczek
QA Contact: Ping Li
URL:
Whiteboard:
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:
Clone Of:
Environment:
Last Closed: 2017-08-01 23:37:14 UTC
Target Upstream Version:
Embargoed:


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 Tian
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:2392 0 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 Tian 2016-10-09 09:27:47 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.