Skip to contentSkip to conversation

Passing config options to librados

Qemu Wido den Hollander 2 participants 2 messages Mar 15, 2011 Block layer

lore
Share & tools
lore
#0 lore raw

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

---
 block/rbd.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
block/rbd.c +0 -0
index f722cb4..7cd12f4 100644
@@ -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);
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 2 lines · Wido den Hollander

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

rados_conf_read_file(cluster, NULL) will use the default locations now (/etc/ceph/ceph.conf, ~/.ceph/config, and ceph.conf). I applied a patch like yours that uses the default locations instead.

Quoted 5 lines

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?

We plan to allow a config file to be specified for each rbd drive -- something like rbd:pool/image:path/to/conf like you suggested in IRC. This will let you use disks from multiple clusters in one VM as well.

Thanks,
Josh