Bala.FA has posted comments on this change.
Change subject: [WIP]gluster: Get size information of a gluster volume
......................................................................
Patch Set 4: Code-Review-1
(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', '')
This code doesn't throw any exception
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
Don't treat anything as ValueError
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 '
you could say 'Returns total, free and used space of gluster volume'
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'
Do we need to specify the unit of 'space'?
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):
May be volumeSizeGet()?
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
What is the unit of these size?
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):
can we use os.statvfs_result class or somethng similar?
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)
libgfapi usage can be extended beyond management to Gluster Storage Domain. Lets add
Deepak here.
Line 57: api.glfs_set_volfile_server(fs,
Line 58: GLUSTER_VOL_PROTOCAL,
Line 59: GLUSTER_VOL_HOST,
Line 60: GLUSTER_VOL_PORT)
--
To view, visit
http://gerrit.ovirt.org/17822
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I358d4f3bf793ecc1a01e0592d68919d1405f6e19
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Aravinda VK <avishwan(a)redhat.com>
Gerrit-Reviewer: Bala.FA <barumuga(a)redhat.com>
Gerrit-Reviewer: Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
Gerrit-Reviewer: Timothy Asir <tjeyasin(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes