On Fri, Oct 28, 2011 at 9:16 PM, Josh Durgin <josh.durgin@xxxxxxxxxxxxx> wrote: > On Fri, 28 Oct 2011 16:22:07 +0530, Atish Kathpal > <atish.kathpal@xxxxxxxxx> wrote: >> Hello developers, >> >> This is a users query. Please help out. >> I am trying to use the librados-dev library to use RADOS components of Ceph. >> I have got Ceph installed on my machine, and the rados command line >> shows me a pool named "data" when I say "rados lspools". I have also >> tried out creating objects in this pool and it works perfectly. >> However, when I try to access the same pool "data" through my C code, >> by using librados.h, my code compiles and links fine but at run time I >> get this error:- >> >> $./a.out: cannot open rados pool data: No such file or directory >> >> My code is as follows:- >> #include <stdio.h> >> #include "rados/librados.h" >> main(int argc, char *argv[]) >> { >> int err; >> rados_t cluster; >> err = rados_create(&cluster, NULL); >> if (err < 0) { >> printf("%s: cannot open a rados connection: %s\n", >> argv[0], strerror(-err)); >> } > > You need a couple more steps here - rados_create doesn't connect to the > cluster yet. Looks like the docs need updating for this. You need to do > > the following before opening the pool (error checking omitted for > brevity): > > // get configuration info - use NULL as the path to search the > default ceph.conf locations > rados_conf_read_file(cluster, path); > rados_connect(cluster); > Thanks Josh. >> rados_ioctx_t io; >> char *poolname = "data"; >> err = rados_ioctx_create(cluster, poolname, &io); >> //<--------------------This line is causing the problem. Why am I not >> able to access the pool? >> if (err < 0) { >> printf("%s: cannot open rados pool %s: %s\n", argv[0], >> poolname, strerror(-err)); >> rados_shutdown(cluster); >> } >> err = rados_write_full(io, "BITARRAY", "hello", 5); >> if (err < 0) { >> printf("%s: cannot write pool %s: %s\n", argv[0], >> poolname, strerror(-err)); >> rados_ioctx_destroy(io); >> rados_shutdown(cluster); >> } >> } >> >> To show that the pool "data" exists, here's the output of the command >> line rados tool:- >> $ rados lspools >> data >> metadata >> rbd >> >> >> Please help me out. >> >> Thank you. >> >> Regards >> Atish > > -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html