[ceph-users] Fwd: What's the fastest way to try out object classes?

Zheyuan Chen zchen137 at ucsc.edu
Fri Nov 10 14:44:27 PST 2017


I finally found an alternative way to try out objclass.
I cloned the repo of Ceph from Github, copied the src/cls/sdk/cls_sdk.cc to
src/cls/test/cls_test.cc, revised src/cls/CMakeLists.txt and used cmake to
compile cls_test.cc in the repo.
I got build/lib/libcls_test.so generated and copied this .so file into all
OSDs.
Finally, it worked.

So I think I didn't compile the source code in a correct way before. (I am
not familiar with cmake and I think I didn't correctly translate the cmake
config into g++ options before.)
Please let me know if any of you know how to compile the objclass without
using the cmake config in the Ceph repo.

Thank you very much,
Zheyuan Chen

On Thu, Nov 9, 2017 at 10:31 AM, Zheyuan Chen <zchen137 at ucsc.edu> wrote:

> I changed this line into CLS_LOG(0, "loading cls_test");
> https://github.com/ceph/ceph/blob/master/src/cls/sdk/cls_sdk.cc#L120
>
> I don't think the test object class is loaded correctly since I don't have
> the loading information in the log.
>
> However I can see "loading cls_sdk" in the osd log.
>
> On Thu, Nov 9, 2017 at 10:19 AM, Yehuda Sadeh-Weinraub <yehuda at redhat.com>
> wrote:
>
>> On Thu, Nov 9, 2017 at 10:05 AM, Zheyuan Chen <zchen137 at ucsc.edu> wrote:
>> > I installed rados-objclass-dev and objclass.h was installed
>> successfully.
>> > However, I failed to run the objclass following the steps as below:
>> >
>> > 1. copy https://github.com/ceph/ceph/blob/master/src/cls/sdk/cls_sdk.cc
>> into
>> > my machine. (cls_test.cpp)
>> > 2. make some changes on cls_test.cpp: 1) rename all "sdk" into "test".
>> 2)
>> > add "namespace ceph {..}" wrapping the whole code.
>> > 3. compile it using the g++: g++ -std=c++11 -fPIC cls_test.cpp --shared
>> -o
>> > libcls_test.so
>> > 4. copy libcls_test.so to all osds:/usr/lib/rados-classes
>> > 5. add two lines in ceph.conf: "osd class load list = *" and "osd class
>> > default list = *" and copy to all nodes.
>> > 6. restart all nodes in the cluster
>> > 7. call the objclass from python code
>> > ~~~
>> > ioctx.execute('oid', 'test', 'test_coverage_write', "test")
>> > ~~~
>> > I got this error:
>> > ~~~
>> > ...
>> > File "rados.pyx", line 498, in rados.requires.wrapper.validate_func
>> > (/build/ceph-12.2.1/obj-x86_64-linux-gnu/src/pybind/rados/py
>> rex/rados.c:4922)
>> > File "rados.pyx", line 2751, in rados.Ioctx.execute
>> > (/build/ceph-12.2.1/obj-x86_64-linux-gnu/src/pybind/rados/py
>> rex/rados.c:35467)
>> > rados.OSError: [errno 95] Ioctx.read(test): failed to read oid
>>
>>
>> errno 95: Not supported. Either the test object class failed to load,
>> or it couldn't find the test_coverage_write method. Try looking at
>> your osd logs (set 'debug objclass = 20' in your ceph.conf).
>>
>> Yehuda
>>
>> > ~~~
>> > 8. calling sdk gave me no error
>> > ~~~
>> > ioctx.execute('oid', 'sdk', 'test_coverage_write', "test")
>> > ~~~
>> >
>> > Did I do anything wrong here? I hope anyone can help me with this.
>> >
>> > Thank you very much,
>> > Zheyuan
>> >
>> > On Mon, Oct 30, 2017 at 4:20 PM, Neha Ojha <nojha at redhat.com> wrote:
>> >>
>> >> Should be rados-objclass-dev or rados-objclass-devel. Try and let me
>> >> know how it goes. Honestly, I've always done it from source :)
>> >>
>> >> On Mon, Oct 30, 2017 at 4:12 PM, Zheyuan Chen <zchen137 at ucsc.edu>
>> wrote:
>> >> > Do you know which package should I install?
>> >> >
>> >> > On Mon, Oct 30, 2017 at 3:54 PM, Neha Ojha <nojha at redhat.com> wrote:
>> >> >>
>> >> >> I am not sure about a docker image, but you should be able to
>> install
>> >> >> it through packages.
>> >> >>
>> >> >> On Mon, Oct 30, 2017 at 3:20 PM, Zheyuan Chen <zchen137 at ucsc.edu>
>> >> >> wrote:
>> >> >> > Hi Neha,
>> >> >> >
>> >> >> > Thanks for answering.
>> >> >> > Building from source just takes too much time. So I was wondering
>> if
>> >> >> > there's
>> >> >> > any docker image or prebuilt package already containing objclass.h
>> >> >> > If that's the only way, I have to go ahead with it.
>> >>
>> >> >> >
>> >> >> > On Mon, Oct 30, 2017 at 3:05 PM, Neha Ojha <nojha at redhat.com>
>> wrote:
>> >> >> >>
>> >> >> >> Hi Zheyuan,
>> >> >> >>
>> >> >> >> You can build Ceph from source and run make install. This should
>> >> >> >> place
>> >> >> >> objclass.h in <prefix>/include/rados/ .
>> >> >> >>
>> >> >> >> Thanks,
>> >> >> >> Neha
>> >> >> >>
>> >> >> >> On Mon, Oct 30, 2017 at 2:18 PM, Zheyuan Chen <zchen137 at ucsc.edu
>> >
>> >> >> >> wrote:
>> >> >> >> >
>> >> >> >> > ---------- Forwarded message ----------
>> >> >> >> > From: Zheyuan Chen <zchen137 at ucsc.edu>
>> >> >> >> > Date: Mon, Oct 30, 2017 at 2:16 PM
>> >> >> >> > Subject: What's the fastest way to try out object classes?
>> >> >> >> > To: ceph-users at lists.ceph.com
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > Hi All,
>> >> >> >> >
>> >> >> >> > I'd like to try out object classes.
>> >> >> >> > http://docs.ceph.com/docs/master/rados/api/objclass-sdk/
>> >> >> >> > I used this docker image: https://hub.docker.com/r/ceph/demo/,
>> but
>> >> >> >> > found
>> >> >> >> > the
>> >> >> >> > object class sdk is not included (couldn't find
>> >> >> >> > /usr/local/include/rados/objectclass.h) even after I installed
>> >> >> >> > librados-devel manually.
>> >> >> >> >
>> >> >> >> > Do I have to build from the source code if I want to have
>> >> >> >> > objectclass.h?
>> >> >> >> > What is the fastest way to set up the environment if I want to
>> try
>> >> >> >> > out
>> >> >> >> > object classes?
>> >> >> >> >
>> >> >> >> > Thank you very much!
>> >> >> >> > Zheyuan
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > _______________________________________________
>> >> >> >> > ceph-users mailing list
>> >> >> >> > ceph-users at lists.ceph.com
>> >> >> >> > http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com
>> >> >> >> >
>> >> >> >
>> >> >> >
>> >> >
>> >> >
>> >
>> >
>> >
>> > _______________________________________________
>> > ceph-users mailing list
>> > ceph-users at lists.ceph.com
>> > http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com
>> >
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ceph.com/pipermail/ceph-users-ceph.com/attachments/20171110/b1cb900a/attachment.html>


More information about the ceph-users mailing list