Skip to contentSkip to conversation

perl binding for rados ?

DISCUSSION Lalit Kumar Bhasin 3 participants 4 messages Nov 15, 2011 – Nov 16, 2011 4 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Hi,

Is there any perl bindings available for rados, or be available in near furture? I can't find it on cpan. As of now, only way I can see is to use librados through perl-XS interface.

/Lalit

#3 lore raw
In reply to a message not in the archive

Forwarding to list.
---------- Forwarded message ----------
From: Marcus Sorensen <[email protected]>
Date: Tue, Nov 15, 2011 at 1:05 PM
Subject: Re: perl binding for rados ?
To: Gregory Farnum <[email protected]>

Admittedly they kind of dropped off my radar after it didn't seem to Garner much interest. I do however have some code that seems to work for connecting, listing pools and devices, basic adding and removing. I dont have all of the functions wrapped but at this point I feel like it's mainly just a matter of copying what's already there to fill in the rest. It uses inline::c . I would be happy to tar up what I have and make it available if someone wants to build on ot

Quoted 15 lines · Gregory Farnum
Quoted 7 lines · Lalit Kumar Bhasin

Hi,

Is there any perl bindings available for rados, or be available in near furture? I can't find it on cpan. As of now, only way I can see is to use librados through perl-XS interface.

/Lalit

All I can give you is a past discussion thread:
http://comments.gmane.org/gmane.comp.file-systems.ceph.devel/3792

Marcus, did you get anywhere with these?
-Greg

#7 lore raw
In reply to a message not in the archive

Here is the package, just tested against 0.38. There are perl subroutines at the top of RADOS.pm, which call the native C functions below. Inline::C handles the conversion of datatypes, you should be able to look at what's already done for the most part to fill out the rest of the routines.

As far as known issues, the cluster_stat throws a failed assertion with a brand new cluster, if I comment out the stat lines in my test script, run the script once, and then uncomment everything is fine from then on. Have not troubleshot it at all, it might be on the C side with rados_cluster_stat or perhaps it's returning something unexpected.

./common/Mutex.h: In function 'void Mutex::Lock(bool)', in thread '7fc0e2c2a720' ./common/Mutex.h: 110: FAILED assert(r == 0)
ceph version 0.38 (commit:b600ec2ac7c0f2e508720f8e8bb87c3db15509b9) 1: (()+0x8c0a3) [0x7fc0e08000a3]
2: (librados::RadosClient::get_fs_stats(ceph_statfs&)+0x7f) [0x7fc0e080eb1f] 3: (rados_cluster_stat()+0x10) [0x7fc0e080ecb0]
4: (cluster_stat_c()+0x10) [0x7fc0e0bb6e80]
5: (XS_Ceph__RADOS_cluster_stat_c()+0x135) [0x7fc0e0bb72b5]
6: (Perl_pp_entersub()+0x585) [0x7fc0e2774265]
7: (Perl_runops_standard()+0x20) [0x7fc0e276bcd0]
8: (perl_run()+0x35e) [0x7fc0e27175fe]
9: (main()+0xec) [0x400ccc]
10: (__libc_start_main()+0xff) [0x7fc0e1cabeff]
11: perl() [0x400af9]

Also in general some extra validation,etc is a good idea, I was just
writing things and seeing if they worked. testrados2.pl does the following:

connects to monitor
stats cluster
creates a pool
lists pools
opens a pool
gets the pool id
gets the pool auid
sets the pool auid
closes the pool
deletes the pool
disconnects

I hope this is useful to someone so they don't have to start from scratch. What follows is the test procedure I performed this morning.

mlsorensen@mlsorensen-pc:~/Downloads$ tar xzf Ceph-RADOS-0.01.tar.gz
mlsorensen@mlsorensen-pc:~/Downloads$ cd Ceph-RADOS-0.01/
mlsorensen@mlsorensen-pc:~/Downloads/Ceph-RADOS-0.01$ perl Makefile.PL
Writing Makefile for Ceph::RADOS
mlsorensen@mlsorensen-pc:~/Downloads/Ceph-RADOS-0.01$ make
Skip blib/lib/Ceph/types (unchanged)
Skip blib/lib/Ceph/RADOS.pm (unchanged)
Skip blib/lib/Ceph/RADOS.pm (unchanged)
Manifying blib/man3/Ceph::RADOS.3pm
mlsorensen@mlsorensen-pc:~/Downloads/Ceph-RADOS-0.01$ sudo make install
Files found in blib/arch: installing files in blib/lib into
architecture dependent library tree
Installing /usr/local/lib/perl/5.10.1/auto/Ceph/RADOS/RADOS.so
Installing /usr/local/lib/perl/5.10.1/Ceph/RADOS.pm
Installing /usr/local/lib/perl/5.10.1/Ceph/types
Installing /usr/local/man/man3/Ceph::RADOS.3pm
Appending installation info to /usr/local/lib/perl/5.10.1/perllocal.pod

### build/install ceph 0.38 on my local box, start up mon,mds,osd ###

mlsorensen@mlsorensen-pc:~/Downloads/Ceph-RADOS-0.01$ perl testrados2.pl
connected
Kbytes: 175779840
Kbytes used: 151856
Kbytes avail: 171382160
Objects: 39
create pool this_test_pool success
pool:(0)  data
pool:(1)  metadata
pool:(2)  rbd
pool:(4)  this_test_pool
open pool success
pool id: 4
pool auid: -1
new pool auid: 232323
delete pool this_test_pool success
Quoted 66 lines · Lalit Kumar Bhasin
Quoted 3 lines · Marcus Sorensen

Yeah, let me tar up the module I have along with the test scripts I was using, I hope it will be useful to you.

Thanks Marcus

Quoted 58 lines · Lalit Kumar Bhasin
Quoted 56 lines

Marcus, It would be nice if you can share your code with me. It would ease
my task as I was planning to write a xs interface for librados. Unless you have other ideas, I would publish it to cpan once done.

/Lalit

Quoted 43 lines · Gregory Farnum

Forwarding to list.
---------- Forwarded message ----------
From: Marcus Sorensen<[email protected]>
Date: Tue, Nov 15, 2011 at 1:05 PM
Subject: Re: perl binding for rados ?
To: Gregory Farnum<[email protected]>

Admittedly they kind of dropped off my radar after it didn't seem to Garner much interest. I do however have some code that seems to work for connecting, listing pools and devices, basic adding and removing. I dont have all of the functions wrapped but at this point I feel like it's mainly just a matter of copying what's already there to fill in the rest. It uses inline::c . I would be happy to tar up what I have and make it available if someone wants to build on ot

Quoted 12 lines · Gregory Farnum
Quoted 9 lines · Lalit Kumar Bhasin

Hi,

Is there any perl bindings available for rados, or be available in near
furture? I can't find it on cpan. As of now, only way I can see is to use
librados through perl-XS interface.

Quoted 7 lines
Quoted 1 line

/Lalit

All I can give you is a past discussion thread:
http://comments.gmane.org/gmane.comp.file-systems.ceph.devel/3792

Marcus, did you get anywhere with these?
-Greg

--
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