Aravinda VK has posted comments on this change.
Change subject: gluster: Get size information of a gluster volume ......................................................................
Patch Set 5:
(9 comments)
To refresh Volume Size info in ovirt engine UI, engine may query VDSM verb number of times. Mounting GlusterFS volumes every time may be overhead when compared to libgfapi usage.
.................................................... File client/vdsClientGluster.py Line 715: 'Returns status of all gluster services if serviceName is ' Line 716: 'not set' Line 717: '(swift, glusterd, smb, memcached)' Line 718: )), Line 719: 'glusterVolumeSizeInfoGet': ( Done Line 720: serv.do_glusterVolumeSizeInfoGet, Line 721: ('volumeName=<volume name> [humanReadable=<yes|no>]', Line 722: 'Returns total, free and used space(bytes) of gluster volume' Line 723: )),
Line 719: 'glusterVolumeSizeInfoGet': ( Line 720: serv.do_glusterVolumeSizeInfoGet, Line 721: ('volumeName=<volume name> [humanReadable=<yes|no>]', Line 722: 'Returns total, free and used space(bytes) of gluster volume' Line 723: )), Done
.................................................... File vdsm.spec.in Line 1271: %dir %{_datadir}/%{vdsm_name}/gluster Line 1272: %doc COPYING Line 1273: %{_datadir}/%{vdsm_name}/gluster/api.py* Line 1274: %{_datadir}/%{vdsm_name}/gluster/vdsmapi-gluster-schema.json Line 1275: %{_datadir}/%{vdsm_name}/gluster/gfapi.py* Full support for libgfapi is not planned from our team as of now. Current plan is to show volume stats in ovirt engine UI. Line 1276: %{_datadir}/%{vdsm_name}/gluster/hooks.py* Line 1277: %{_datadir}/%{vdsm_name}/gluster/services.py* Line 1278: %endif Line 1279:
.................................................... File vdsm/gluster/api.py Line 289: return {'services': status} Line 290: Line 291: @exportAsVerb Line 292: def volumeSizeInfoGet(self, volumeName, human_readable=False, Line 293: options=None): Done Line 294: """ Line 295: f_blocks = Total number of blocks Line 296: f_bfree = Total number of blocks free Line 297: f_bavail = Total number of blocks available for non root user
Line 293: options=None): Line 294: """ Line 295: f_blocks = Total number of blocks Line 296: f_bfree = Total number of blocks free Line 297: f_bavail = Total number of blocks available for non root user As per http://docs.python.org/2/library/statvfs.html
Will update the comment with more description. Line 298: total blocks available = f_blocks - (f_bfree - f_bavail) Line 299: Line 300: @returns { Line 301: 'total': TOTALBYTES,
Line 312: total = formatVolumeSizeHumanReadable(total) Line 313: free = formatVolumeSizeHumanReadable(free) Line 314: used = formatVolumeSizeHumanReadable(used) Line 315: Line 316: return {'total': str(total), 'free': str(free), 'used': str(used)} Will update the @return Line 317: Line 318: Line 319: def getGlusterMethods(gluster): Line 320: l = []
.................................................... File vdsm/gluster/gfapi.py Line 24: import exception as ge Line 25: from . import makePublic Line 26: Line 27: Line 28: GLUSTER_VOL_PROTOCAL = 'tcp' Done Line 29: GLUSTER_VOL_HOST = 'localhost' Line 30: GLUSTER_VOL_PORT = 24007 Line 31: GLUSTER_VOL_PATH = "/" Line 32: _api = None
Line 25: from . import makePublic Line 26: Line 27: Line 28: GLUSTER_VOL_PROTOCAL = 'tcp' Line 29: GLUSTER_VOL_HOST = 'localhost' I will add protocal and host as optional parameter to vdsm verb. Line 30: GLUSTER_VOL_PORT = 24007 Line 31: GLUSTER_VOL_PATH = "/" Line 32: _api = None Line 33:
Line 61: return Line 62: Line 63: Line 64: def _volumeMount(volumeId): Line 65: fs = _api.glfs_new(volumeId) Done Line 66: _api.glfs_set_volfile_server(fs, Line 67: GLUSTER_VOL_PROTOCAL, Line 68: GLUSTER_VOL_HOST, Line 69: GLUSTER_VOL_PORT)