Skip to content
  • Stefano Garzarella's avatar
    66dc5f96
    block/rbd: report a better error when namespace does not exist · 66dc5f96
    Stefano Garzarella authored
    
    
    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: default avatarTingting Mao <timao@redhat.com>
    Reviewed-by: default avatarIlya Dryomov <idryomov@gmail.com>
    Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
    Message-Id: <20220517071012.6120-1-sgarzare@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    66dc5f96
    block/rbd: report a better error when namespace does not exist
    Stefano Garzarella authored
    
    
    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: default avatarTingting Mao <timao@redhat.com>
    Reviewed-by: default avatarIlya Dryomov <idryomov@gmail.com>
    Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
    Message-Id: <20220517071012.6120-1-sgarzare@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading