summaryrefslogtreecommitdiffstats
path: root/gluster/api.py
Commit message (Collapse)AuthorAgeFilesLines
* Move source files into gfapi/ dirPrashanth Pai2016-08-101-512/+0
| | | | | | | | | | | | | | | | | Currently, many source files are directly placed under gluster/ dir: gluster/exceptions.py gluster/gfapi.py gluster/utils.py When multiple packages (RPMs) are sharing the same gluster namespace, these source files will conflict if there are source files with same names provided by other projects. Fix: Move all source files in gluster/* to gluster/gfapi/* Note that this patch does not break how existing users import gfapi. Change-Id: Idf9d07eefafe8333215d6c61201c97c982565ba9 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Expose glfs_readdirplus_rPrashanth Pai2016-06-301-0/+6
| | | | | | | | | | | | | | | | This patch does the following: * Implements Volume.listdir_with_stat() API which internally invokes glfs_readdirplus_r to return directory entries along with stat for each entry. * Implements Volume.scandir() which is similar to os.scandir() present in Python 3.5 * Makes Dir class iterable. * Enables Dir class to raise OSError when glfs_readdir* calls fail. Previously, these failures were silently being ignored and treated as a case of EOF. Change-Id: Id918c39a7ef3882553e9bcd3fbf9455ee1c25a83 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Fix license discrepanciesPrashanth Pai2016-06-171-9/+8
| | | | | | | | | | The repo had mixed references to both Apache BSD license and GPL licenses. This change removes references to Apache license. The license of this project is now same as that of GlusterFS. Change-Id: I39b72f59d14af304729560dd1d59fe307cd1ac1d Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Implement shutil.copy* methods and os.link()Prashanth Pai2016-06-151-0/+5
| | | | | Change-Id: I2de796e7d53732c5a967c6194a43378171fcb3d6 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Implement os.utime() like API and zerofillPrashanth Pai2016-06-011-7/+24
| | | | | | | | | | | | This patch: * Implements Volume.utime() which is very similar to os.utime() present in Python. https://docs.python.org/2/library/os.html#os.utime * Implements File.zerofill() which exposes glfs_zerofill. * Fixes function prototype of fallocate and discard. Adds functional tests for the same. Change-Id: Icb8d3a571998c31d6bf9b139ca253af59f6fc3f4 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Fix and simplify tox.iniPrashanth Pai2016-03-101-6/+4
| | | | | | | | | | | | | | | * Remove deprecated tox options * Simplify tox.ini * Update .gitignore * Update test-requirements.txt * Fix pep8 issues All tests now run on centos7 without any modifications. Code coverage output is now displayed properly for both unit test and functional test runs. Change-Id: I877cc0ad2c560579c12d528af3ac9bf5eea28378 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Disable glfs_dup testsPrashanth Pai2016-02-231-2/+2
| | | | | | | This change also fixes a mismatch in glfs_seek() function signature. Change-Id: I3d336a2fbfec9ba921b253f6d97616485cadec98 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Provide use_errno to all gfapi foreign function prototypesAlpha2015-09-161-149/+155
| | | | | | | | | | Updated tests to include OSError messages Added error reasons to LibgfapiException exceptions BUG 1196161: https://bugzilla.redhat.com/show_bug.cgi?id=1196161 Change-Id: Iddf40751696874ffcaa50cd9d5ecc06c4993baf2 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Merge "Fix open/fopen in thread other than main"Thiago da Silva2015-09-021-8/+12
|\
| * Fix open/fopen in thread other than mainOleksiy Syvokon2015-08-311-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | Before this patch, calling Volume.{f}open in a thread other than main thread was causing segmentation fault (test included). The reason is missing ctypes declarations. Also, this patch fixes errno handling for these two functions, making couple of FIXME/TODO notes go away. Change-Id: Iae9638b7d16cc0e0c587fd21a94be677f2d4af59 Signed-off-by: Oleksiy Syvokon <oleksiy.syvokon@gmail.com>
* | Backport ctypes.c_ssize_t support to py26Prashanth Pai2015-07-131-0/+13
|/ | | | | | | | | ctypes.c_ssize_t was introduced in Python 2.7 This made libgfapi-python bindings unusable in RHEL 6 which only contains Python 2.6 Change-Id: I401697004d7eecb110b8c92a3ddd27397e3d8785 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Add missing Path based operation APIsPrashanth Pai2015-06-181-4/+23
| | | | | | | | | | | | | * Added commonly used path based operations that were missing from the Volume class. * Fixed function prototypes at places where it should be ssize_t and not size_t. This caused overflow error at times. * Added doc strings wherever they were missing. Change-Id: I6ce28038da3cd0f89ab075045bb4092dd95e21c4 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Add missing File APIsPrashanth Pai2015-06-181-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | Volume.fopen() method mimics Python's built-in File object Example: with v.fopen("/path/to/file", "w") as f: f.write("hello world") fopen() returns a File object. Volume.open() method mimics os.open() Python API. Example: with File(v.open("/path/to/file", os.O_WRONLY | os.O_CREAT)) as f: f.write("hello world") open() returns the raw glfd that (as of today) needs to be passed to File class. In future, more APIs will be provided to directly use the glfd returned. Unlike their C versions, these methods do not return anything on success. If methods fail, exceptions are raised. Added docstrings to methods in File class. Change-Id: Ie46fc77a899806d396762e6740e1538ea298d6e2 Signed-off-by: Prashanth Pai <ppai@redhat.com> Signed-off-by: Thiago da Silva <thiago@redhat.com>
* Raise Exception if ctypes.CDLL() cannot load .soPrashanth Pai2015-06-171-4/+8
| | | | | | | | | | | | | | | | Usually, this failure happens in source installs of glusterfs. find_library() is able to find the .so file but ctypes.CDLL() cannot load it! Refer: http://bugs.python.org/issue18502 With this change, users are advised to modify LD_LIBRARY_PATH when exception is raised Also, passed the LD_LIBRARY_PATH env variable to tox environment so that unit tests and functional tests can run. Change-Id: Iffc5633088b3886739a8534692db88db7c3d02b7 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Explicitly set .so file if find_library() failsPrashanth Pai2015-06-111-1/+18
| | | | | Change-Id: I8678148961ee192d96e887b6ca7f4b8e4ba89507 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Package libgfapi-python project for its consumersHumble Devassy Chirammal2015-05-291-14/+8
| | | | | | | | | | This project has to be shipped as rpm for various distributions like Fedora,Centos,RHEL.etc, so that the clients like vdsm, openstack..etc can make use of python bindings of libgfapi library of GlusterFS. This patch introduce first version of the spec file for this project. Change-Id: Icb5d83fc8b278a3cd7b89d55b5fda15a84c2fa82 Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com>
* Rename module name from glusterfs to glusterHumble Chirammal2015-04-251-0/+402
The goal is to consolidate all gluster related python packages under single namespace "gluster". From client's perspective, it was: from glusterfs import gfapi Henceforth, it wil be: from gluster import gfapi Change-Id: If2509f570563ae7660892963607c9474313f803c Signed-off-by: Humble Chirammal <hchiramm@redhat.com>