summaryrefslogtreecommitdiffstats
path: root/glusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'glusterfs')
-rwxr-xr-xglusterfs/api.py6
-rwxr-xr-xglusterfs/gfapi.py16
2 files changed, 20 insertions, 2 deletions
diff --git a/glusterfs/api.py b/glusterfs/api.py
index 6bc19ea..037c893 100755
--- a/glusterfs/api.py
+++ b/glusterfs/api.py
@@ -223,6 +223,12 @@ glfs_rmdir = ctypes.CFUNCTYPE(ctypes.c_int,
ctypes.c_void_p,
ctypes.c_char_p)(('glfs_rmdir', client))
+glfs_setfsuid = ctypes.CFUNCTYPE(ctypes.c_int,
+ ctypes.c_uint)(('glfs_setfsuid', client))
+
+glfs_setfsgid = ctypes.CFUNCTYPE(ctypes.c_int,
+ ctypes.c_uint)(('glfs_setfsgid', client))
+
# TODO: creat and open fails on test_create_file_already_exists & test_open_file_not_exist functional testing, # noqa
# when defined via function prototype.. Need to find RCA. For time being, using it from 'api.glfs_' # noqa
diff --git a/glusterfs/gfapi.py b/glusterfs/gfapi.py
index fc6bb27..16929df 100755
--- a/glusterfs/gfapi.py
+++ b/glusterfs/gfapi.py
@@ -177,8 +177,6 @@ class Dir(object):
class Volume(object):
- # Housekeeping functions.
-
def __init__(self, host, volid, proto="tcp", port=24007):
# Add a reference so the module-level variable "api" doesn't
# get yanked out from under us (see comment above File def'n).
@@ -441,6 +439,20 @@ class Volume(object):
except OSError as e:
onerror(self.rmdir, path, e)
+ def setfsuid(self, uid):
+ ret = api.glfs_setfsuid(uid)
+ if ret < 0:
+ err = ctypes.get_errno()
+ raise OSError(err, os.strerror(err))
+ return ret
+
+ def setfsgid(self, gid):
+ ret = api.glfs_setfsgid(gid)
+ if ret < 0:
+ err = ctypes.get_errno()
+ raise OSError(err, os.strerror(err))
+ return ret
+
def setxattr(self, path, key, value, vlen):
ret = api.glfs_setxattr(self.fs, path, key, value, vlen, 0)
if ret < 0: