summaryrefslogtreecommitdiffstats
path: root/gluster/gfapi.py
diff options
context:
space:
mode:
authorOleksiy Syvokon <oleksiy.syvokon@gmail.com>2015-08-31 15:36:26 +0300
committerOleksiy Syvokon <oleksiy.syvokon@gmail.com>2015-08-31 15:36:26 +0300
commitca456a770e835f829281dac85bd8c4f00b8624ff (patch)
tree62757f39d8d281218c6b9f206b139cbacc204f2a /gluster/gfapi.py
parent1ec40d0753e7d5185a7fc810df33370330fc6f90 (diff)
Fix open/fopen in thread other than main
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>
Diffstat (limited to 'gluster/gfapi.py')
-rwxr-xr-xgluster/gfapi.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/gluster/gfapi.py b/gluster/gfapi.py
index 9b0d9a8..7fee1bb 100755
--- a/gluster/gfapi.py
+++ b/gluster/gfapi.py
@@ -777,9 +777,9 @@ class Volume(object):
raise ValueError("Invalid mode")
else:
if (os.O_CREAT & flags) == os.O_CREAT:
- fd = api.client.glfs_creat(self.fs, path, flags, 0666)
+ fd = api.glfs_creat(self.fs, path, flags, 0666)
else:
- fd = api.client.glfs_open(self.fs, path, flags)
+ fd = api.glfs_open(self.fs, path, flags)
if not fd:
err = ctypes.get_errno()
raise OSError(err, os.strerror(err))
@@ -803,12 +803,9 @@ class Volume(object):
raise TypeError("flags must evaluate to an integer")
if (os.O_CREAT & flags) == os.O_CREAT:
- # FIXME:
- # Without direct call to _api the functest fails on creat and open.
-
- fd = api.client.glfs_creat(self.fs, path, flags, mode)
+ fd = api.glfs_creat(self.fs, path, flags, mode)
else:
- fd = api.client.glfs_open(self.fs, path, flags)
+ fd = api.glfs_open(self.fs, path, flags)
if not fd:
err = ctypes.get_errno()
raise OSError(err, os.strerror(err))