summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Add validation decoratorsPrashanth Pai2016-06-156-16/+252
| | | | | | | | | | 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>
* Improve sphinx rendering on RTDPrashanth Pai2016-06-106-58/+46
| | | | | Change-Id: I646b5d26bca6d4f0123c1b2140f80f24d268568e Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Fix typo in documentationPrashanth Pai2016-06-092-2/+2
| | | | | Change-Id: Ic6bcde358e718ef6cab3b37f1a318d2cada6e97f Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Revamp and complete API documentationPrashanth Pai2016-06-097-92/+888
| | | | | | | | | 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-014-9/+160
| | | | | | | | | | | | 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-183-4/+0
|\
| * Re-enable glfs_dup() testsPrashanth Pai2016-03-153-4/+0
| | | | | | | | | | Change-Id: I96b6f2a501d52d66694e67990d6b65d4eb920fa2 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* | Merge "Add readinto() API"Humble Devassy Chirammal2016-03-183-0/+52
|\ \ | |/ |/|
| * Add readinto() APIPrashanth Pai2016-02-243-0/+52
| | | | | | | | | | | | | | | | | | | | 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-106-65/+29
|/ | | | | | | | | | | | | | | * 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-234-2/+6
| | | | | | | This change also fixes a mismatch in glfs_seek() function signature. Change-Id: I3d336a2fbfec9ba921b253f6d97616485cadec98 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Merge "functests: Change default host name to localhost"Humble Devassy Chirammal2016-02-173-4/+4
|\
| * functests: Change default host name to localhostPrashanth Pai2015-09-163-4/+4
| | | | | | | | | | | | | | | | | | Without this change, user (developer) will have to modify test.conf (tracked by git) every time he has to run functional tests or has to edit /etc/hosts and add entry for 'gfshost' Change-Id: I6d41a657b0cae614513e2925e73138da46ddaf04 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-163-162/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 "updated dev guide to tell users to update their test.conf file"Thiago da Silva2015-09-161-0/+1
|\ \ \
| * | | updated dev guide to tell users to update their test.conf fileZandrr2015-07-201-0/+1
| | | | | | | | | | | | | | | | Change-Id: I86176486ad729b2dec16c60cddbd803354cc64bb
* | | | add usage to readme for easier quickstartZandrr2015-09-161-0/+37
| |_|/ |/| | | | | | | | Change-Id: I6210a0f8e9ed746d430b8b71c4898e41bbfd475e
* | | Merge "Fix open/fopen in thread other than main"Thiago da Silva2015-09-024-20/+33
|\ \ \
| * | | Fix open/fopen in thread other than mainOleksiy Syvokon2015-08-314-20/+33
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | fix unit test due to changes in mockThiago da Silva2015-07-102-4/+3
| | | | | | | | | | Change-Id: Ica8a7443fa398d9c02e1658700dc067155e0913e Signed-off-by: Thiago da Silva <thiago@redhat.com>
* | changed unmount to umountZandrr2015-06-273-14/+14
|/ | | | Change-Id: Iced9bb59a33c38964e012f9d6c9ef13efc1f184c
* Fix reading of binary data in read()Prashanth Pai2015-06-183-23/+26
| | | | | | | | | | | | | | | | | | | | | | | | 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-184-42/+307
| | | | | | | | | | | | | * 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-184-150/+501
| | | | | | | | | | | | | | | | | | | | | | | | | 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-174-30/+328
| | | | | | | | | | | * 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-172-4/+9
| | | | | | | | | | | | | | | | 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-298-265/+639
| | | | | | | | | | 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>
* Merge "Rename module name from glusterfs to gluster"Thiago da Silva2015-05-219-129/+131
|\
| * Rename module name from glusterfs to glusterHumble Chirammal2015-04-259-129/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Adding Maintainers file.Humble Chirammal2015-05-011-0/+15
|/ | | | | | Change-Id: Id61c55f1ca6fb3cc724982142abdc0120c0499b0 Signed-off-by: Humble Chirammal <hchiramm@redhat.com> Signed-off-by: Thiago da Silva <thiago@redhat.com>
* Merge "Correcting the project url in README"Thiago da Silva2015-02-242-3/+3
|\
| * Correcting the project url in READMEHumble Chirammal2015-02-242-3/+3
| | | | | | | | | | Change-Id: I89224d961cba538bc732682e64f0658e5b5e7d80 Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
* | Merge "Adding libgfapi reference for mapping."Thiago da Silva2015-02-231-0/+143
|\ \
| * | Adding libgfapi reference for mapping.Humble Chirammal2015-02-231-0/+143
| | | | | | | | | | | | | | | Change-Id: Iaf2ae5a07e3ccb9919f6020f42962b4441557596 Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
* | | Merge "adding functions setfsuid and setfsgid"Thiago da Silva2015-02-233-2/+50
|\ \ \
| * | | adding functions setfsuid and setfsgidThiago da Silva2015-02-203-2/+50
| |/ / | | | | | | | | | | | | | | | | | | | | | Did not add functional tests at the moment. This function requires superuser privilege to execute Change-Id: I35c0a6b3eba60586da64ccfb4dc818d403542f41 Signed-off-by: Thiago da Silva <thiago@redhat.com>
* | / Added option to read whole fileThiago da Silva2015-02-202-2/+29
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added option to read whole file if caller send -1 as the buflen to read function. Also added a copy of getsize to File class, now called fgetsize, which returns the size of the file as reported by fstat Removed flags paramater from read function as it is never used by libgfapi. Change-Id: Ia1c04ef9717d9ca098e1961300d6ee216381c989 Signed-off-by: Thiago da Silva <thiago@redhat.com> Signed-off-by: Prashanth Pai <ppai@redhat.com>
* | adding chmod and fchmodThiago da Silva2015-02-194-0/+76
|/ | | | | Change-Id: Iba5f4e72a257adeb8ec78b267dfdef26a1ec66f1 Signed-off-by: Thiago da Silva <thiago@redhat.com>
* fix functional testsThiago da Silva2015-02-181-3/+2
| | | | | | | tests were failing due to an issue with loremipsum package Change-Id: I9c364f48dc7fb642f5cd7a6371a53a0aa137618b Signed-off-by: Thiago da Silva <thiago@redhat.com>
* Provide default mode for Volume.mkdir()Prashanth Pai2014-09-042-3/+3
| | | | | | | | | | | | | | | | | Calling mkdir without mode used to fail with following error: >>> vol.mkdir('/c2') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: mkdir() takes exactly 3 arguments (2 given) Python's os.mkdir() defined default mode: https://docs.python.org/2/library/os.html#os.mkdir Also, changed mode_t is of type unsigned short (ctypes.c_ushort). Change-Id: I95e47a8173d90e2a162cfeb9af002ea0c20fc2ff Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Adding function prototypes with this patch.Humble Chirammal2014-07-023-117/+280
| | | | | | | | | This helps ctypes know the calling conventions it should use to communicate with the binary interface of libgfapi and which types it should allocate and cast. Without it, ctypes fails/crashes when not running on the main thread. Change-Id: I73480229f451167377ed4d1534b08b66c689cc4f Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
* Fix functional testsPrashanth Pai2014-05-1912-43/+312
| | | | | | | | | | | | | | * The order of elements in list returned by listdir() can vary and may not be sorted. This caused assertEqual in "test_listdir" to fail. * Also, some systems may have xattrs belonging to selinux. So, a listxattr can list them too. * Allow hostname/ip and volume name to be configured easily by setting it in test.conf. This enables functional tests to use a non-local volume. * Cleanup volume before and after running functional tests. * Added MANIFEST.in and LICENSE file Change-Id: Icfa6eb60e8d8e7ed4d6ab8190a2a2c80688999a3 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Add statvfs supporthchiramm2014-05-023-0/+54
| | | | | | | | This support will help other consumers to get the statvfs details. Change-Id: Iee4e84a515ff80f24add812ad6fcf84c992bf356 Signed-off-by: hchiramm <hchiramm@redhat.com>
* adding new apis requested from gluster-swift projThiago da Silva2014-03-273-3/+89
| | | | | | | | This patch adds new functions that are used in gluster-swift. These functions are: dup, lseek, getatime, getctime, getmtime Change-Id: I09036f7e393a89e09913f7f6de173e1eca8dca95 Signed-off-by: Thiago da Silva <thiago@redhat.com>
* Fix minor typo in unit testPrashanth Pai2014-03-263-7/+27
| | | | | | | | | * Changed package to be covered from gluster to glusterfs. * Also, added script to run unit tests without tox. * Updated setup.py to be more specific. Change-Id: I148f522153b75f066753a807719e38699d48b1fd Signed-off-by: Prashanth Pai <ppai@redhat.com>
* merging creat and open function to be more pythonicThiago da Silva2014-03-214-45/+68
| | | | | | | | | | the os python module does not offer a creat function, new files are created using the open function and by passing O_CREAT flag. We are changing gfapi.py to function the same way. Change-Id: I5e084b200bb657e3124d3e620a47160e790cd1fe Signed-off-by: Thiago da Silva <thiago@redhat.com>