Hi all,

While testing with Qemu-KVM and RBD I got:

Unable to find any monitors in the configuration file, because there is
no configuration file. Please specify monitors via -m monaddr or -c
ceph.conf
qemu-system-x86_64: -drive file=rbd:rbd/beta,format=rbd: error
connecting
qemu: could not open disk image rbd:rbd/beta: No such file or directory

Some searching through the source-code showed me that ceph.conf isn't
read by librados anymore, but you have to force this with
rados_conf_read_file

The current RBD code doesn't do this, thus leaving librados
unconfigured.

I'm using the patch below to force reading the ceph.conf, but imho that
is not flexible enough.

The current RBD code has no way of reading config options from Qemu and
converting them into librados options by rados_conf_set() nor specifying
a conf file to be read by rados_conf_read_file().

Something that still has to be implemented or am I missing something?

Wido


>From 03cfbebf1363b89bca6c97beb90e30e04add5db9 Mon Sep 17 00:00:00 2001
From: Wido den Hollander <[email protected]>
Date: Tue, 15 Mar 2011 13:11:24 +0100
Subject: [PATCH] librados: Force reading ceph.conf


Signed-off-by: Wido den Hollander <[email protected]>
---
 block/rbd.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/block/rbd.c b/block/rbd.c
index f722cb4..7cd12f4 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -222,6 +222,11 @@ static int qemu_rbd_create(const char *filename,
QEMUOptionParameter *options)
         return -EIO;
     }
 
+    if (rados_conf_read_file(cluster, "/etc/ceph/ceph.conf") < 0) {
+        error_report("error reading configuration file");
+        return -EIO;
+    }
+
     if (rados_connect(cluster) < 0) {
         error_report("error connecting");
         rados_shutdown(cluster);
@@ -351,6 +356,11 @@ static int qemu_rbd_open(BlockDriverState *bs,
const char *filename, int flags)
         return r;
     }
 
+    if ((r = rados_conf_read_file(s->cluster, "/etc/ceph/ceph.conf")) <
0) {
+        error_report("error reading configuration file");
+        return r;
+    }
+
     if ((r = rados_connect(s->cluster)) < 0) {
         error_report("error connecting");
         rados_shutdown(s->cluster);
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to