summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSahina Bose <sabose@redhat.com>2014-08-08 17:03:56 +0530
committerSahina Bose <sabose@redhat.com>2014-09-23 23:40:06 -0700
commit84d6e941526d93afccf2779e6d8c516a945f9b60 (patch)
treed535bfe67aa481809778ad2a3aeba4ccc5525990
parente0bdeafae88282506ceb23b948354ccba658e7af (diff)
plugins: Return unknown status when trans locked message
When the gluster command fails due to locking by another transaction, return UNKNOWN status, so that the command can be tried again on another node. Change-Id: Ibae111c0a95ddd3594a7082d3c36ffe9b15c41fc Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1109752 Signed-off-by: Sahina Bose <sabose@redhat.com> Reviewed-on: http://review.gluster.org/8440 Reviewed-by: Bala FA <barumuga@redhat.com>
-rwxr-xr-xplugins/check_volume_status.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/plugins/check_volume_status.py b/plugins/check_volume_status.py
index 821fbaf..8c02090 100755
--- a/plugins/check_volume_status.py
+++ b/plugins/check_volume_status.py
@@ -41,9 +41,12 @@ def getVolumeStatus(args):
exitstatus = utils.PluginStatusCode.CRITICAL
message = "CRITICAL: Volume : %s type is stopped" % \
(volumes[args.volume]["volumeType"])
- except glustercli.GlusterCmdFailedException as e:
- out = ("UNKNOWN: Command execution failed %s" % e.message)
+ except glustercli.GlusterLockedException as e:
+ out = ("UNKNOWN: temporary error. %s" % '.'.join(e.err))
return utils.PluginStatusCode.UNKNOWN, out
+ except glustercli.GlusterCmdFailedException as e:
+ out = ("WARNING: Command execution failed. %s" % '.'.join(e.err))
+ return utils.PluginStatusCode.WARNING, out
return exitstatus, message
@@ -51,10 +54,13 @@ def getVolumeStatus(args):
def getVolumeQuotaStatus(args):
try:
qstatus = glustercli.volumeQuotaStatus(args.volume)
+ except glustercli.GlusterLockedException as e:
+ out = ("UNKNOWN: temporary error. %s" % '.'.join(e.err))
+ return utils.PluginStatusCode.UNKNOWN, out
except glustercli.GlusterCmdFailedException as e:
- out = ("QUOTA: Quota status could not be determined %s"
+ out = ("QUOTA: Quota status could not be determined. %s"
% '.'.join(e.err))
- return utils.PluginStatusCode.UNKNOWN, out
+ return utils.PluginStatusCode.WARNING, out
returnMsg = "QUOTA:"
if qstatus.get("hard_ex_dirs"):
@@ -80,8 +86,11 @@ def getVolumeQuotaStatus(args):
def getVolumeSelfHealStatus(args):
try:
volume = glustercli.volumeHealSplitBrainStatus(args.volume)
+ except glustercli.GlusterLockedException as e:
+ out = ("UNKNOWN: temporary error. %s" % '.'.join(e.err))
+ return utils.PluginStatusCode.UNKNOWN, out
except glustercli.GlusterCmdFailedException as e:
- out = ("Self heal status could not be determined - %s"
+ out = ("Self heal status could not be determined. %s"
% '.'.join(e.err))
return utils.PluginStatusCode.WARNING, out
@@ -108,8 +117,11 @@ def getVolumeSelfHealStatus(args):
def getVolumeGeoRepStatus(args):
try:
volume = glustercli.volumeGeoRepStatus(args.volume)
+ except glustercli.GlusterLockedException as e:
+ out = ("UNKNOWN: temporary error. %s" % '.'.join(e.err))
+ return utils.PluginStatusCode.UNKNOWN, out
except glustercli.GlusterCmdFailedException as e:
- out = ("Geo replication status could not be determined - %s"
+ out = ("Geo replication status could not be determined. %s"
% '.'.join(e.err))
return utils.PluginStatusCode.WARNING, out