summaryrefslogtreecommitdiffstats
path: root/glusterfs/gfapi.py
diff options
context:
space:
mode:
authorThiago da Silva <thiago@redhat.com>2015-02-19 14:59:48 -0500
committerThiago da Silva <thiago@redhat.com>2015-02-20 13:49:06 -0500
commitb5a327eb9c0c1ec3f77a36676d6cc9878353ec1b (patch)
tree37714687e54129a0352acfd10ce30e903f82314b /glusterfs/gfapi.py
parentec407b4d61b15506e6ae5b3f28d3983af4f28457 (diff)
adding functions setfsuid and setfsgid
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>
Diffstat (limited to 'glusterfs/gfapi.py')
-rwxr-xr-xglusterfs/gfapi.py16
1 files changed, 14 insertions, 2 deletions
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: