summaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorStefano Garzarella2022-05-17 09:10:12 +0200
committerKevin Wolf2022-06-24 17:07:06 +0200
commit66dc5f9606bec7ce029e98a90f209153dfade82e (patch)
treea212505366d9c0318598499686b1fa67801fb77b /meson.build
parentqsd: document vduse-blk exports (diff)
downloadqemu-66dc5f9606bec7ce029e98a90f209153dfade82e.tar.gz
qemu-66dc5f9606bec7ce029e98a90f209153dfade82e.tar.xz
qemu-66dc5f9606bec7ce029e98a90f209153dfade82e.zip
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@redhat.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20220517071012.6120-1-sgarzare@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build6
1 files changed, 6 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 397ca1d60a..a113078f1a 100644
--- a/meson.build
+++ b/meson.build
@@ -1903,6 +1903,12 @@ config_host_data.set('HAVE_GETIFADDRS', cc.has_function('getifaddrs'))
config_host_data.set('HAVE_OPENPTY', cc.has_function('openpty', dependencies: util))
config_host_data.set('HAVE_STRCHRNUL', cc.has_function('strchrnul'))
config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix: '#include <stdlib.h>'))
+if rbd.found()
+ config_host_data.set('HAVE_RBD_NAMESPACE_EXISTS',
+ cc.has_function('rbd_namespace_exists',
+ dependencies: rbd,
+ prefix: '#include <rbd/librbd.h>'))
+endif
if rdma.found()
config_host_data.set('HAVE_IBV_ADVISE_MR',
cc.has_function('ibv_advise_mr',