Bug 2086980

Summary: Please Update The Error Info More Clearly When Creating Images Over RBD with The Namespace Not Existing
Product: Red Hat Enterprise Linux 9 Reporter: Tingting Mao <timao>
Component: qemu-kvmAssignee: Stefano Garzarella <sgarzare>
qemu-kvm sub component: Ceph QA Contact: Tingting Mao <timao>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: low CC: chayang, coli, jinzhao, juzhang, mrezanin, sgarzare, virt-maint, yfu
Version: 9.1Keywords: Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-7.1.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:19:33 UTC Type: Enhancement
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2111769    
Bug Blocks:    

Description Tingting Mao 2022-05-17 02:45:12 UTC
Description of problem:
As the subject, and the bug is from the discussion of https://bugzilla.redhat.com/show_bug.cgi?id=1873925#c10 .


Version-Release number of selected component (if applicable):
qemu-kvm-7.0.0-3.el9
librbd1-16.2.4-5.el9.x86_64


How reproducible:
100%

Steps to Reproduce:
# qemu-img create 'rbd:rbd/aa/new3:conf=/etc/ceph/ceph.conf:id=admin:key=AQBwUmlfB9VwKhAA0HwqNhKCfarcItKtCR9ulg==' 1M
Formatting 'rbd:rbd/aa/new3:conf=/etc/ceph/ceph.conf:id=admin:key=AQBwUmlfB9VwKhAA0HwqNhKCfarcItKtCR9ulg==', fmt=raw size=1048576
qemu-img: rbd:rbd/aa/new3:conf=/etc/ceph/ceph.conf:id=admin:key=AQBwUmlfB9VwKhAA0HwqNhKCfarcItKtCR9ulg==: error rbd create: No such file or directory

# qemu-img create rbd:rbd/aa/testtt.img 1G
Formatting 'rbd:rbd/aa/testtt.img', fmt=raw size=1073741824
qemu-img: rbd:rbd/aa/testtt.img: error rbd create: No such file or directory


Actual results:
As above, created failed with ' No such file or directory'.


Expected results:
A more clear error hint info like "No a namespace named 'aa'"N=.


Additional info:

Comment 3 Stefano Garzarella 2022-05-17 07:06:32 UTC
v1 posted: https://lore.kernel.org/qemu-devel/20220516100324.61122-1-sgarzare@redhat.com/T/#u

The new output will be:
  $ qemu-img create rbd:rbd/namespace/image 1M
  Formatting 'rbd:rbd/namespace/image', fmt=raw size=1048576
  qemu-img: rbd:rbd/namespace/image: namespace 'namespace' does not exist

Comment 4 Stefano Garzarella 2022-05-17 07:14:45 UTC
v2 posted upstream with a minor fix: https://lore.kernel.org/qemu-devel/20220517071012.6120-1-sgarzare@redhat.com/T/#u

Comment 6 Stefano Garzarella 2022-06-27 08:58:07 UTC
Commit merged upstream: https://gitlab.com/qemu-project/qemu/-/commit/66dc5f9606bec7ce029e98a90f209153dfade82e

commit 66dc5f9606bec7ce029e98a90f209153dfade82e
Author: Stefano Garzarella <sgarzare>
Date:   Tue May 17 09:10:12 2022 +0200

    block/rbd: report a better error when namespace does not exist
    
    If the namespace does not exist, rbd_create() fails with -ENOENT and
    QEMU reports a generic "error rbd create: No such file or directory":
    
        $ qemu-img create rbd:rbd/namespace/image 1M
        Formatting 'rbd:rbd/namespace/image', fmt=raw size=1048576
        qemu-img: rbd:rbd/namespace/image: error rbd create: No such file or directory
    
    Unfortunately rados_ioctx_set_namespace() does not fail if the namespace
    does not exist, so let's use rbd_namespace_exists() in qemu_rbd_connect()
    to check if the namespace exists, reporting a more understandable error:
    
        $ qemu-img create rbd:rbd/namespace/image 1M
        Formatting 'rbd:rbd/namespace/image', fmt=raw size=1048576
        qemu-img: rbd:rbd/namespace/image: namespace 'namespace' does not exist
    
    Reported-by: Tingting Mao <timao>
    Reviewed-by: Ilya Dryomov <idryomov>
    Signed-off-by: Stefano Garzarella <sgarzare>
    Message-Id: <20220517071012.6120-1-sgarzare>
    Signed-off-by: Kevin Wolf <kwolf>

Comment 9 Yanan Fu 2022-09-07 08:31:22 UTC
QE bot(pre verify): Set 'Verified:Tested,SanityOnly' as gating/tier1 test pass.

Comment 10 Tingting Mao 2022-09-08 03:24:55 UTC
Tried with the latest qemu, the hint info is as expected. Thanks.


Tested with:
qemu-kvm-7.1.0-1.el9
kernel-5.14.0-160.el9.x86_64


Steps:
# qemu-img create 'rbd:rbd/aa/new3:conf=/etc/ceph/ceph.conf:id=admin:key=AQBwUmlfB9VwKhAA0HwqNhKCfarcItKtCR9ulg==' 1M
Formatting 'rbd:rbd/aa/new3:conf=/etc/ceph/ceph.conf:id=admin:key=AQBwUmlfB9VwKhAA0HwqNhKCfarcItKtCR9ulg==', fmt=raw size=1048576
qemu-img: rbd:rbd/aa/new3:conf=/etc/ceph/ceph.conf:id=admin:key=AQBwUmlfB9VwKhAA0HwqNhKCfarcItKtCR9ulg==: namespace 'aa' does not exist

# qemu-img info rbd:rbd/aa/testtt.img
qemu-img: Could not open 'rbd:rbd/aa/testtt.img': namespace 'aa' does not exist

Comment 13 Tingting Mao 2022-09-14 07:40:40 UTC
Set this bug as verified according to Comment10.

Comment 15 errata-xmlrpc 2023-05-09 07:19:33 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 (Moderate: qemu-kvm security, bug fix, and enhancement update), 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-2023:2162