def getVolumeStatvfs(volumeId, host=GLUSTER_VOL_HOST,
port=GLUSTER_VOL_PORT,
protocol=GLUSTER_VOL_PROTOCAL):
statvfsdata = StatVfsStruct()
fs = glfsInit(volumeId, host, port, protocol)
rc = _glfs_statvfs(fs, GLUSTER_VOL_PATH, ctypes.byref(statvfsdata))
if rc != 0:
raise GlfsStatvfsException(rc=rc)
glfsFini(fs, volumeId)
# To convert to os.statvfs_result we need to pass tuple/list in
# following order: bsize, frsize, blocks, bfree, bavail, files,
# ffree, favail, flag, namemax
return os.statvfs_result((statvfsdata.f_bsize,
statvfsdata.f_frsize,
statvfsdata.f_blocks,
statvfsdata.f_bfree,
statvfsdata.f_bavail,
statvfsdata.f_files,
statvfsdata.f_ffree,
statvfsdata.f_favail,
statvfsdata.f_flag,
statvfsdata.f_namemax))
# C function prototypes for using the library gfapi
评论列表
文章目录