[OpenAFS] building swig based interfaces

Gémes Géza geza@kzsdabas.hu
Sun, 01 Sep 2013 13:23:50 +0200


Hi,

IMHO a non-command based interface is more flexible and more portable 
(no need to hardcode all the paths) at the same time.
> Hi,
>
> What is the use case you are trying to address?
>
> Part of our service mgmt infrastructure is python-based, including a fairly complex backup system. However, it builds on an API layer which internally uses CLI via a subprocess (vos, fs, …) and we found this is completely sufficient.  Moreover, you do not expose to the python layer any runtime problems occurring in extension libraries such as crashes, memory leaks etc... (this is effectively encapsulated in a subprocess) so I would even argue that from this point of view it is a technically more desirable approach (and easier, too). However our internal API implements only what we need and is quite limited.
>
> Simple example of usage (sum the size occupied by volumes (which follow a certain name pattern) on all partitions of a file server)::
>
> from cernafs import vos
>
>    >>> for p in vos.listpart('afs108'):
>    ...    print p, sum([v.sizeKB for v in vos.listvol('afs108',p) if v.name and v.name[0] in ['q','s']])/1024./1024.
>     b 154.509589195
>     c 260.041460991
>     d 215.590883255
>     e 292.481509209
>     f 221.171380043
>     g 262.226537704
>     h 214.474150658
>     i 159.367405891
>     j 336.694796562
>     k 227.23085022
>     l 338.797628403
>     m 283.453014374
>     n 235.3145895
>     o 148.527907372
>     s 0.000127792358398
>     
> kuba
>
> --
Cheers

Geza Gemes
>
> On Sep 1, 2013, at 12:27 PM, Gémes Géza <geza@kzsdabas.hu>
>   wrote:
>
>> Hi,
>>
>> I've decided to start a project for building a swig based python interface for afs commands/functions. The advantage is that a swig interface can be further used for creating interfaces for other languages. Currently I know about only one limited python-afs interface which calls the afs binary commands instead of implementing an interface to the C code (https://github.com/openafs-contrib/afspy). On the other hand the (to my knowledge) only interface: AFSPerl (http://cpansearch.perl.org/src/NOG/AFS-2.6.3/) uses suboptimal interfaces making it incompatible with 1.6.x and 64 bit (https://lists.openafs.org/pipermail/openafs-info/2012-September/038684.html).
>>
>> So if you can give me some pointers about where should I look in the openafs source for the declaration of different functions? My first guess would be the files in libadmin, but I'm probably wrong :-(
>>
>> Thank you in advance!
>>
>> Cheers
>>
>> Geza Gemes
>> _______________________________________________
>> OpenAFS-info mailing list
>> OpenAFS-info@openafs.org
>> https://lists.openafs.org/mailman/listinfo/openafs-info