summaryrefslogtreecommitdiffstats
path: root/gluster
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Update spec and prepare 1.2 release"v1.2Prashanth Pai2018-09-201-1/+1
|\
| * Update spec and prepare 1.2 releasePrashanth Pai2018-09-191-1/+1
| | | | | | | | | | Change-Id: Iabb38be823cba803a864ca4769e2cac595ebe75c Signed-off-by: Prashanth Pai <ppai@redhat.com>
* | Allow unmounting only on properly initialised fs objectPrashanth Pai2018-09-191-1/+1
|/ | | | | | | | | | | | Libgfapi program coredumps when glfs_fini() is called on an uninitialised fs object. This fix will check if fs has been properly initialised before calling glfs_fini() Glusterfs BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1630803 Change-Id: I27f834b0477a84c7a08ebc7a5e5bfab934220f77 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Support setting multiple hosts (volfile servers)Prashanth Pai2018-07-311-16/+24
| | | | | | | | Fixes https://github.com/gluster/libgfapi-python/issues/20 Change-Id: If12dfb3166d37071f8996c4d043950aeb27d0ae7 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Support mknod APIMichael Hanselmann2018-07-272-0/+23
| | | | | | | | Gluster supports the mknod(2) API to create special files such as character and block devices. Add it to the "gfapi.Volume" class. Change-Id: Ie62245441997111b0cf6e44b2a14a1ad7b6d7d56 Signed-off-by: Michael Hanselmann <public@hansmi.ch>
* Port to Python 3.xAdam Cecile2018-06-122-59/+124
| | | | | | | | | | | | | Based on PR sent by Adam C├ęcile (eLvErDe on GitHub): https://github.com/gluster/libgfapi-python/pull/21 Additional changes to original PR: * Make it pep8 compliant * Fix comment in getcwd() * Add functest36 env to tox.ini Change-Id: I45c4056333c12a82814cf8adcfa87e6687365366 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Disable logging by defaultAlpha2018-03-281-5/+11
| | | | | | | | | | Superusers should not be required to use this API with default settings. Provide a disable_logging method of Volume. Ensure that set_logging gets called with new values. Change-Id: Ia27a682c96d6ca28f85d43f9d8483f08d1dc6367 Signed-off-by: Alpha <alpha@pokesplash.net> Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Add get_volume_id() APIPrashanth Pai2018-01-112-0/+24
| | | | | Change-Id: Ia4c378c5b1657bb4ec23c7057c7cbc49c1b31484 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Expose mounting over unix socketPrashanth Pai2017-12-221-2/+3
| | | | | Change-Id: I17078b6d20372c3935f7bcd8c82f55f96096dd87 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Release version 1.1v1.1Prashanth Pai2016-08-161-1/+1
| | | | | Change-Id: Ia134ba44f56fbb94c0b988c2353c59e1a25fbbc7 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Move source files into gfapi/ dirPrashanth Pai2016-08-105-6/+18
| | | | | | | | | | | | | | | | | 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>
* Simplify packagingPrashanth Pai2016-08-092-31/+2
| | | | | | | | | | | * Rename .unittests.sh to .unitests * Fix entries in MANIFEST.in file * Mover version declaration to gfapi.py TODO: Fix the spec file. That'll be sent as a separate change. Change-Id: I0cba8964c1ecc337128c8edc9f301fc1d023bd28 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Implement copytree() and enhance walk(), rmtree()Prashanth Pai2016-08-031-34/+136
| | | | | | | | | | | This change: * Implements copytree() API which is very similar to the one provided by shutils built-in module in Python. * Enhances walk() and rmtree() implementation to leverage scandir() optimization. Change-Id: Iac5aef1a5c558fdeceac4e5128339141a3ebd4d1 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Expose glfs_readdirplus_rPrashanth Pai2016-06-302-14/+199
| | | | | | | | | | | | | | | | 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-175-53/+37
| | | | | | | | | | 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-153-1/+155
| | | | | Change-Id: I2de796e7d53732c5a967c6194a43378171fcb3d6 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Add validation decoratorsPrashanth Pai2016-06-153-16/+128
| | | | | | | | | | As glfs and glfd are pointers to memory locations, passing invalid values of glfs and glfd to the libgfapi C library can result in segfault. This patch introduces decorators that validate glfs and glfd before calling correspoding C APIs. Change-Id: I4e86bd8e436e23cd41f75f428d246939c820bb9c Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Revamp and complete API documentationPrashanth Pai2016-06-091-57/+210
| | | | | | | | | Created .rst files that sphinx can use to auto-generate entire API documentation from doc strings present in code. This can be easily rendered and hosted on ReadTheDocs website. Change-Id: If1a569bdeaaba21919ac77ba8bd4967dfec22603 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Implement os.utime() like API and zerofillPrashanth Pai2016-06-012-9/+67
| | | | | | | | | | | | 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>
* Merge "Re-enable glfs_dup() tests"Humble Devassy Chirammal2016-03-181-1/+0
|\
| * Re-enable glfs_dup() testsPrashanth Pai2016-03-151-1/+0
| | | | | | | | | | Change-Id: I96b6f2a501d52d66694e67990d6b65d4eb920fa2 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* | Merge "Add readinto() API"Humble Devassy Chirammal2016-03-181-0/+23
|\ \ | |/ |/|
| * Add readinto() APIPrashanth Pai2016-02-241-0/+23
| | | | | | | | | | | | | | | | | | | | readinto() This method is useful when you have to read a large file over multiple read calls. While read() allocates a buffer every time it's invoked, readinto() copies data to an already allocated buffer passed to it. Change-Id: Ic8a3aa0e544e09e05101c983b329c91864832e4a Signed-off-by: Prashanth Pai <ppai@redhat.com>
* | Fix and simplify tox.iniPrashanth Pai2016-03-102-9/+5
|/ | | | | | | | | | | | | | | * 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-232-2/+3
| | | | | | | This change also fixes a mismatch in glfs_seek() function signature. Change-Id: I3d336a2fbfec9ba921b253f6d97616485cadec98 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Merge "Fix parsing of binary data as str"Thiago da Silva2015-10-051-1/+1
|\
| * Fix parsing of binary data as strPrashanth Pai2015-06-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This change will return the raw string read as is which fixes case where arbitrary binary data (such as an array.array) is written and read back as string to be unmarshalled back as array.array This patch does not yet address writing array.array and arbitrary objects into binary files. That will be sent as a separate change. Change-Id: Ic135198cca2c0dc8e103176920056e9df0c00f2b Signed-off-by: Prashanth Pai <ppai@redhat.com>
* | Provide use_errno to all gfapi foreign function prototypesAlpha2015-09-162-159/+172
| | | | | | | | | | | | | | | | | | | | 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-022-15/+16
|\ \
| * | Fix open/fopen in thread other than mainOleksiy Syvokon2015-08-312-15/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | changed unmount to umountZandrr2015-06-271-3/+3
|/ | | | Change-Id: Iced9bb59a33c38964e012f9d6c9ef13efc1f184c
* Fix reading of binary data in read()Prashanth Pai2015-06-181-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | As per the current code, this is the behavior: >>> with v.fopen("/abc", 'r') as f: ... data = f.read(5) >>> print data <ctypes.c_char_Array_2 object at 0x7fda7d6bbb90> >>> print data.value hello >>> It's incorrect to return a ctypes internal object back to the user. In Python 2.x, read() always returns a string. It's really upto the consumer to decode this string into whatever encoding it was written with. This patch reverts parts of this old change: Ia2bb47343880cbf7121fed9510e4cfa085fe23bd Change-Id: Ia1d3e5834be2b856776bd3cf8382a17ffd61d5df Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Add missing Path based operation APIsPrashanth Pai2015-06-182-20/+189
| | | | | | | | | | | | | * 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-182-43/+274
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Refactor volume initialization codePrashanth Pai2015-06-172-9/+138
| | | | | | | | | | | * Validate inputs during initialization of Volume object. * Move glfs_new() and glfs_init() into mount() method. * Provide user consumable unmount() method. * Provide "mounted" property to Volume object. Users can now check state whether a volume is virtual mounted or not. Change-Id: Idc53ee7f9386ed995315bd5fb492a7d36f44875f Signed-off-by: Prashanth Pai <ppai@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-112-3/+21
| | | | | Change-Id: I8678148961ee192d96e887b6ca7f4b8e4ba89507 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Package libgfapi-python project for its consumersHumble Devassy Chirammal2015-05-292-27/+17
| | | | | | | | | | 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-253-0/+1029
| | | | | | | | | | | | | 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>
* changing gluster dir to glusterfsThiago da Silva2014-03-182-585/+0
| | | | | | | | | | making this change to avoid package conflicts with gluster-swift and glusterfs-api rpm. Eventually we will remove the python code from glusterfs-api rpm and create a new rpm package from libgfapi-python. Change-Id: I1b20cd747e500aed17fba89f96e62423325b5230 Signed-off-by: Thiago da Silva <thiago@redhat.com>
* adding functions needed by gluster-swiftThiago da Silva2014-03-131-3/+166
| | | | | | | These new functions are required to be used by gluster-swift Change-Id: Ifb68f2b4494bf375feabb130831f9e076dc5b94a Signed-off-by: Thiago da Silva <thiago@redhat.com>
* added Apache license comment to source codeThiago da Silva2014-03-062-3/+16
| | | | | | | Added same license as gluster-swift Change-Id: Ib190b4e6def5d2ab87b71a04142f6344060d8a6d Signed-off-by: Thiago da Silva <thiago@redhat.com>
* adding new methods to Volume classThiago da Silva2014-03-061-3/+82
| | | | | | | | | | These are mostly helper methods similar to functions provided by the python os module helpfer functions added: exists, getsize, isdir, isfile, islink glfs functions added: removexattr, stat Change-Id: I3581a96224151481292a4e506d8c52b8acf79e49 Signed-off-by: Thiago da Silva <thiago@redhat.com>
* changed write and read functions to support binary dataThiago da Silva2014-02-241-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | both functions were only supporting text data and needed to be changed to support binary data. The issue was found while testing libgfapi-python with smallfile (https://github.com/bengland2/smallfile). When calling gflfs_write, ctypes has no problem converting strings to the correct C data type, but is unable to handle bytearray: b = bytearray(1024) with vol.create(path, os.O_WRONLY | os.O_EXCL, 0644) as fd: fd.write(b) It would throw this error: exception: argument 2: <type 'exceptions.TypeError'>: Don't know how to convert parameter 2 reference: http://docs.python.org/2/library/ctypes.html#calling-functions-continued Change-Id: Ia2bb47343880cbf7121fed9510e4cfa085fe23bd Signed-off-by: Thiago da Silva <thiago@redhat.com>
* add mode parameter to mkdir methodThiago da Silva2014-01-291-2/+2
| | | | | | | | add mode parameter to mkdir to allow setting the dir access mode when the directory is being created Change-Id: I6f1ed0c8800fb65a30448e6082cf55b8220a06d4 Signed-off-by: Thiago da Silva <thiago@redhat.com>
* first libgfapi-python functional testsThiago da Silva2014-01-221-221/+0
| | | | | | | | adding a few functional tests and removing old tests from source code Change-Id: Iefcb091d614f2825592943cfb42847b5865322c6 Signed-off-by: Thiago da Silva <thiago@redhat.com>
* remove unused libraries importThiago da Silva2014-01-171-3/+0
| | | | | | | | xdr and glfs were not being used, so they are being removed for now Change-Id: I8db793f66f2f2a6442f3a6b6f53617d52cc52a92 Signed-off-by: Thiago da Silva <thiago@redhat.com>
* added support for with statements in open and creatThiago da Silva2014-01-161-70/+82
| | | | | | | | | when creating or opening a File, caller should now use python's with statement as specified on PEP 343: http://www.python.org/dev/peps/pep-0343/ Change-Id: Id98613e310bea01a427769d3ad7b0dea97245b04 Signed-off-by: Thiago da Silva <thiago@redhat.com>
* unit testsThiago da Silva2014-01-141-4/+3
| | | | | | | added unit tests for existing methods Change-Id: Iecd31bc1dea44ea38168120bd05ca505c4ff5c59 Signed-off-by: Thiago da Silva <thiago@redhat.com>