Darshan N has uploaded a new change for review.
Change subject: WIP:gluster: new verb to provide gluster self-heal info.
......................................................................
WIP:gluster: new verb to provide gluster self-heal info.
This patch adds a new verb "glusterVolumeHealInfo". This
verb takes volume name as an argument. It returns gluster
self heal related information. the sample return value
is as follows:
{'volumeName': {'brick1':
{'totalFileCount': 'number of files to be healed',
'splitBrainFlieCount': 'number of files in'
'split-brain state'}
'brick2':
{'totalFileCount': 'number of files to be healed',
'splitBrainFlieCount': 'number of files in'
'split-brain state'}
}
}
Note: gluster does not provide xml output for self-heal info
yet. Waiting for BZ#1063506 to be fixed. This patch is sent
asuming the probable xml output provided by gluster.
Change-Id: I28d6c9e1a95e6ddc1d89ea9e17873f6865681d56
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1205641
Signed-off-by: Darshan N <[email protected]>
---
M client/vdsClientGluster.py
M vdsm/gluster/api.py
M vdsm/gluster/apiwrapper.py
M vdsm/gluster/cli.py
M vdsm/gluster/exception.py
M vdsm/rpc/vdsmapi-gluster-schema.json
6 files changed, 113 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/42720/1
diff --git a/client/vdsClientGluster.py b/client/vdsClientGluster.py
index a4bce63..82971f3 100644
--- a/client/vdsClientGluster.py
+++ b/client/vdsClientGluster.py
@@ -740,6 +740,15 @@
pp.pprint(status)
return status['status']['code'], status['status']['message']
+ def do_glusterVolumeHealInfo(self, args):
+ params = self._eqSplit(args)
+ volumeName = params.get('volumeName', '')
+
+ status = self.s.glusterVolumeHealInfo(volumeName)
+
+ pp.pprint(status)
+ return status['status']['code'], status['status']['message']
+
def getGlusterCmdDict(serv):
return \
@@ -1252,5 +1261,10 @@
serv.do_glusterSnapshotScheduleReset,
('',
'Reset gluster snapshot scheduling'
+ )),
+ 'glusterVolumeHealInfo': (
+ serv.do_glusterVolumeHealInfo,
+ ('volumeName=<volume name>',
+ 'get gluster volume self-heal information'
))
}
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index 24b8230..1299a4a 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -747,6 +747,11 @@
def snapshotScheduleReset(self, options=None):
self.svdsmProxy.glusterSnapshotScheduleFlagUpdate("none")
+ @exportAsVerb
+ def volumeHealInfo(self, volumeName=None, options=None):
+ status = self.svdsmProxy.glusterVolumeInfo(volumeName)
+ return {'healInfo': status}
+
def getGlusterMethods(gluster):
l = []
diff --git a/vdsm/gluster/apiwrapper.py b/vdsm/gluster/apiwrapper.py
index 4768a86..17d5121 100644
--- a/vdsm/gluster/apiwrapper.py
+++ b/vdsm/gluster/apiwrapper.py
@@ -320,6 +320,9 @@
def snapshotScheduleReset(self):
return self._gluster.snapshotScheduleReset()
+ def volumeHealInfo(self, volumeName):
+ return self._gluster.volumeHealInfo(volumeName)
+
class GlusterSnapshot(GlusterApiBase):
def __init__(self):
diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index d53a1c8..9e22dd0 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -1576,3 +1576,39 @@
return True
except ge.GlusterCmdFailedException as e:
raise ge.GlusterGeoRepSessionDeleteFailedException(rc=e.rc, err=e.err)
+
+
+def _parseVolumeHealInfo(tree):
+ """
+ {'volumeName': {'brick1':
+ {'totalFileCount': 'number of files to be healed',
+ 'splitBrainFlieCount': 'number of files in'
+ 'split-brain state'}
+ 'brick2':
+ {'totalFileCount': 'number of files to be healed',
+ 'splitBrainFlieCount': 'number of files in'
+ 'split-brain state'}
+ }
+ }
+ """
+ bricks = {}
+ for el in tree.findall('healInfo/volume/bricks/brick'):
+ value = {}
+ value['totalFileCount'] = el.find('numberOfEntries').text
+ value['splitBrainFileCount'] = el.find(
+ 'numberOfSplitBrainEntries').text
+ bricks.update({el.find('name').text: value})
+ return {tree.find('healInfo/volume/name').text: bricks}
+
+
+@makePublic
+def volumeHealInfo(volumeName):
+ command = _getGlusterVolCmd() + ["heal", volumeName, "info"]
+ try:
+ xmltree = _execGlusterXml(command)
+ except ge.GlusterCmdFailedException as e:
+ raise ge.GlusterVolumeHealInfoFailedException(rc=e.rc, err=e.err)
+ try:
+ return _parseVolumeHealInfo(xmltree)
+ except _etreeExceptions:
+ raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
diff --git a/vdsm/gluster/exception.py b/vdsm/gluster/exception.py
index 17ad018..396e059 100644
--- a/vdsm/gluster/exception.py
+++ b/vdsm/gluster/exception.py
@@ -594,6 +594,11 @@
message = "Failed to disable snapshot schedule through cli"
+class GlusterVolumeHealInfoFailedException(GlusterVolumeException):
+ code = 4579
+ message = "Volume heal info failed"
+
+
# geo-replication
class GlusterGeoRepException(GlusterException):
code = 4200
diff --git a/vdsm/rpc/vdsmapi-gluster-schema.json
b/vdsm/rpc/vdsmapi-gluster-schema.json
index c86f43c..9e64828 100644
--- a/vdsm/rpc/vdsmapi-gluster-schema.json
+++ b/vdsm/rpc/vdsmapi-gluster-schema.json
@@ -2186,3 +2186,53 @@
##
{'command': {'class': 'GlusterVolume',
'name': 'snapshotScheduleReset'}}
+
+##
+# @BrickHealInfo:
+#
+# info about self-heal for brick.
+#
+# @totalFileCount: total number of files that need heal
+#
+# @splitBrainFileCount: number of files in split brain state
+#
+# Since: 4.17.0
+##
+{'type': 'BrickHealInfo',
+ 'data': {'totalFileCount': 'str', 'splitBrainFileCount': 'str'}}
+
+##
+# @BrickHealMap:
+#
+# A mapping of self-heal info indexed by brick name.
+#
+# Since: 4.17.0
+##
+{'map': 'BrickHealMap',
+ 'key': 'str', 'value': 'BrickHealInfo'}
+
+##
+# @HealInfoMap:
+#
+# A mapping of self-heal info indexed by volume name.
+#
+# Since: 4.17.0
+##
+{'map': 'HealInfoMap',
+ 'key': 'str', 'value': 'BrickHealMap'}
+
+##
+# @GlusterVolume.healInfo:
+#
+# get gluster volume self heal information.
+#
+# @volumeName: name of the gluster volume
+#
+# Returns:
+# Information about self-heal running on the volume
+#
+# Since: 4.17.0
+##
+{'command': {'class': 'GlusterVolume', 'name': 'healInfo'},
+ 'data': {'volumeName': 'str'},
+ 'returns' : 'HealInfoMap'}
--
To view, visit https://gerrit.ovirt.org/42720
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I28d6c9e1a95e6ddc1d89ea9e17873f6865681d56
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Darshan N <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches