Hello Bala.FA, Saggi Mizrahi, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/7436
to review the following change.
Change subject: added glusterVolumeProfileInfo verb
......................................................................
added glusterVolumeProfileInfo verb
Following is the output structure
{ 'statusCode' : CODE,
'volumeName' : VOLUME-NAME,
'brickCount' : BRICK-COUNT,
'bricks' : {
BRICK-NAME: {
'cumulativeStats': {
'blockStat': [
{ 'size': SIZE,
'read': READ-COUNT,
'write': WRITE-COUNT
}, ...],
'fopStat': [
{ 'name': FOP-NAME,
'hits': HITS,
'latencyAvg': AVERAGE-LATENCY,
'latencyMin': MINIMUM-LATENCY,
'latencyMax': MAXIMUM-LATENCY
}, ...],
'duration': DURATION,
'totalRead': TOTAL-READ,
'totalWrite': TOTAL-WRITE },
'intervalStats': {
'blockStat': [
{ 'size': SIZE,
'read': READ-COUNT,
'write': WRITE-COUNT
}, ...],
'fopStat': [
{ 'name': FOP-NAME,
'hits': HITS,
'latencyAvg': AVERAGE-LATENCY,
'latencyMin': MINIMUM-LATENCY,
'latencyMax': MAXIMUM-LATENCY
}, ...],
'duration': DURATION,
'totalRead': TOTAL-READ,
'totalWrite': TOTAL-WRITE }}, ...}}
Change-Id: Ib6a26fa7634b999cd70197c958fe86a6d9ed4a9c
Signed-off-by: Timothy Asir <tjeyasin(a)redhat.com>
---
M vdsm/gluster/api.py
M vdsm/gluster/cli.py
M vdsm/gluster/exception.py
M vdsm_cli/vdsClientGluster.py
4 files changed, 81 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/36/7436/1
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index dc3ec0b..9073791 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -229,6 +229,11 @@
def volumeProfileStop(self, volumeName, options=None):
self.svdsmProxy.glusterVolumeProfileStop(volumeName)
+ @exportAsVerb
+ def volumeProfileInfo(self, volumeName, options=None):
+ status = self.svdsmProxy.glusterVolumeProfileInfo(volumeName)
+ return {'profileInfo': status}
+
def getGlusterMethods(gluster):
l = []
diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index 2618aa1..059bff4 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -155,6 +155,54 @@
return volumeInfoDict
+def _parseGlusterVolumeProfileInfo(tree):
+ fopCumulative = []
+ blkCumulative = []
+ fopInterval = []
+ blkInterval = []
+ bricks = {}
+ for brick in tree.findall('volProfile/brick'):
+ for block in brick.findall('cumulativeStats/blockStats/block'):
+ blkCumulative.append({'size': block.find('size').text,
+ 'read': block.find('reads').text,
+ 'write': block.find('writes').text})
+ for fop in brick.findall('cumulativeStats/fopStats/fop'):
+ fopCumulative.append({'name': fop.find('name').text,
+ 'hits': fop.find('hits').text,
+ 'latencyAvg':
fop.find('avgLatency').text,
+ 'latencyMin':
fop.find('minLatency').text,
+ 'latencyMax':
fop.find('maxLatency').text})
+ for block in brick.findall('intervalStats/blockStats/block'):
+ blkInterval.append({'size': block.find('size').text,
+ 'read': block.find('reads').text,
+ 'write': block.find('writes').text})
+ for fop in brick.findall('intervalStats/fopStats/fop'):
+ fopInterval.append({'name': fop.find('name').text,
+ 'hits': fop.find('hits').text,
+ 'latencyAvg':
fop.find('avgLatency').text,
+ 'latencyMin':
fop.find('minLatency').text,
+ 'latencyMax':
fop.find('maxLatency').text})
+ bricks[brick.find('brickName').text] = {
+ 'cumulativeStats': {
+ 'blockStats': blkCumulative,
+ 'fopStats': fopCumulative,
+ 'duration': brick.find('cumulativeStats/duration').text,
+ 'totalRead':
brick.find('cumulativeStats/totalRead').text,
+ 'totalWrite':
brick.find('cumulativeStats/totalWrite').text},
+ 'intervalStats': {
+ 'blockStats': blkInterval,
+ 'fopStats': fopInterval,
+ 'duration': brick.find('intervalStats/duration').text,
+ 'totalRead': brick.find('intervalStats/totalRead').text,
+ 'totalWrite':
brick.find('intervalStats/totalWrite').text}}
+ status = {
+ 'volumeName': tree.find("volProfile/volname").text,
+ 'brickCount': tree.find("volProfile/brickCount").text,
+ 'statusCode': tree.find("opRet").text,
+ 'bricks': bricks}
+ return status
+
+
@exportToSuperVdsm
def volumeInfo(volumeName=None):
"""
@@ -577,3 +625,16 @@
if err:
raise ge.GlusterVolumeProfileStopFailedException(err[0], err[1])
return True
+
+
+@exportToSuperVdsm
+def volumeProfileInfo(volumeName):
+ command = _getGlusterVolCmd() + ["profile", volumeName, "info"]
+ err, res = _execGluster(command, xml=True)
+ if err:
+ raise ge.GlusterVolumeProfileInfoFailedException(err[0], err[1])
+ xmltree, out = res
+ try:
+ return _parseGlusterVolumeProfileInfo(xmltree)
+ except:
+ raise ge.GlusterXmlErrorException(err=out)
diff --git a/vdsm/gluster/exception.py b/vdsm/gluster/exception.py
index f5dfb73..5dea24d 100644
--- a/vdsm/gluster/exception.py
+++ b/vdsm/gluster/exception.py
@@ -328,6 +328,11 @@
message = "Volume profile stop failed"
+class GlusterVolumeProfileInfoFailedException(GlusterVolumeException):
+ code = 4159
+ message = "Volume profile info failed"
+
+
# Host
class GlusterHostException(GlusterException):
code = 4400
diff --git a/vdsm_cli/vdsClientGluster.py b/vdsm_cli/vdsClientGluster.py
index 0a253fe..c93a59f 100644
--- a/vdsm_cli/vdsClientGluster.py
+++ b/vdsm_cli/vdsClientGluster.py
@@ -207,6 +207,11 @@
status = self.s.glusterVolumeProfileStop(args[0])
return status['status']['code'],
status['status']['message']
+ def do_glusterVolumeProfileInfo(self, args):
+ status = self.s.glusterVolumeProfileInfo(args[0])
+ pp.pprint(status)
+ return status['status']['code'],
status['status']['message']
+
def getGlusterCmdDict(serv):
return {
@@ -373,4 +378,9 @@
('<volume_name>\n\t<volume_name> is existing volume
name',
'stop gluster volume profile'
)),
+ 'glusterVolumeProfileInfo':
+ (serv.do_glusterVolumeProfileInfo,
+ ('<volume_name>\n\t<volume_name> is existing volume
name',
+ 'get gluster volume profile info'
+ )),
}
--
To view, visit
http://gerrit.ovirt.org/7436
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6a26fa7634b999cd70197c958fe86a6d9ed4a9c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Timothy Asir <tjeyasin(a)redhat.com>
Gerrit-Reviewer: Bala.FA <barumuga(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>