Aravinda VK has posted comments on this change.
Change subject: [WIP]gluster: Get size information of a gluster volume ......................................................................
Patch Set 4:
(8 comments)
.................................................... File client/vdsClientGluster.py Line 426: Line 427: def do_glusterVolumeSize(self, args): Line 428: params = self._eqSplit(args) Line 429: try: Line 430: volumeName = params.get('volumeName', '') Done Line 431: except: Line 432: raise ValueError Line 433: Line 434: status = self.s.glusterVolumeSize(volumeName)
Line 428: params = self._eqSplit(args) Line 429: try: Line 430: volumeName = params.get('volumeName', '') Line 431: except: Line 432: raise ValueError Done Line 433: Line 434: status = self.s.glusterVolumeSize(volumeName) Line 435: pp.pprint(status) Line 436: return status['status']['code'], status['status']['message']
Line 718: )), Line 719: 'glusterVolumeSize': ( Line 720: serv.do_glusterVolumeSize, Line 721: ('volumeName=<volume name>', Line 722: 'Returns total, available and used ' Done Line 723: 'space status of gluster volume' Line 724: )),
Line 719: 'glusterVolumeSize': ( Line 720: serv.do_glusterVolumeSize, Line 721: ('volumeName=<volume name>', Line 722: 'Returns total, available and used ' Line 723: 'space status of gluster volume' Done Line 724: )),
.................................................... File vdsm/gluster/api.py Line 287: status = self.svdsmProxy.glusterServicesGet(serviceNames) Line 288: return {'services': status} Line 289: Line 290: @exportAsVerb Line 291: def volumeSize(self, volumeName, options=None): Since we don't have Set, do we need to change to Get? Line 292: """ Line 293: f_blocks = Total number of blocks Line 294: f_bfree = Total number of blocks free Line 295: f_bavail = Total number of blocks available for non root user
Line 301: return { Line 302: 'total': total_blocks_available * data.f_bsize / 1024, Line 303: 'free': data['f_bavail'] * data['f_bsize'] / 1024, Line 304: 'used': (total_blocks_available - data['f_bavail']) * \ Line 305: data['f_bsize'] / 1024 bytes. Line 306: } Line 307: Line 308: Line 309: def getGlusterMethods(gluster):
.................................................... File vdsm/gluster/gfapi.py Line 29: GLUSTER_VOL_HOST = 'localhost' Line 30: GLUSTER_VOL_PORT = 24007 Line 31: GLUSTER_VOL_PATH = "/" Line 32: Line 33: class Stat (Structure): Here Stat is derived class of Structure which should be same as C structure which libgfapi uses.
We can plan to use the os.statvfs_result format while returning statvfsData from the function volumeStatvfs Line 34: _fields_ = [ Line 35: ('f_bsize', c_ulong), Line 36: ('f_frsize', c_ulong), Line 37: ('f_blocks', c_ulong),
Line 52: @makePublic Line 53: def volumeStatvfs(volumeId): Line 54: api.glfs_statvfs.restype = c_int Line 55: api.glfs_statvfs.argtypes = [c_void_p, c_char_p, POINTER(Stat)] Line 56: fs = api.glfs_new(volumeId) Done Line 57: api.glfs_set_volfile_server(fs, Line 58: GLUSTER_VOL_PROTOCAL, Line 59: GLUSTER_VOL_HOST, Line 60: GLUSTER_VOL_PORT)