From 84d6e941526d93afccf2779e6d8c516a945f9b60 Mon Sep 17 00:00:00 2001 From: Sahina Bose Date: Fri, 8 Aug 2014 17:03:56 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/8440 Reviewed-by: Bala FA --- plugins/check_volume_status.py | 24 ++++++++++++++++++------ 1 file 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 -- cgit