summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSahina Bose <sabose@redhat.com>2014-05-27 17:04:36 +0530
committerSahina Bose <sabose@redhat.com>2014-05-28 23:04:25 -0700
commit05c2cd7c527d3a7e8b1244db72505314c3e82d3a (patch)
treeecf56513f017b8ec47214a9276cd4d3ebf5d7e0d
parent3e3dcdd9f3eea75237a7d2995e153a21d0af6e6b (diff)
plugins: Geo-rep plugin status message enhanced
Added geo-rep session wise details to the plugin output. Change-Id: I2086a493c2befa4c1e25a1cc5523213f0f13c8dd Bug-Url: https://bugzilla.redhat.com/1101218 Bug-Url: https://bugzilla.redhat.com/1101223 Signed-off-by: Sahina Bose <sabose@redhat.com> Reviewed-on: http://review.gluster.org/7896
-rwxr-xr-xplugins/check_volume_status.py32
-rw-r--r--tests/test_check_volume_status.py24
2 files changed, 40 insertions, 16 deletions
diff --git a/plugins/check_volume_status.py b/plugins/check_volume_status.py
index e2b9205..4812e99 100755
--- a/plugins/check_volume_status.py
+++ b/plugins/check_volume_status.py
@@ -115,20 +115,24 @@ def getVolumeGeoRepStatus(args):
exitstatus = utils.PluginStatusCode.UNKNOWN
message = "UNKNOWN: Volume info not found"
else:
- if (volume[args.volume]['status'] ==
- glustercli.GeoRepStatus.PARTIAL_FAULTY):
- exitstatus = utils.PluginStatusCode.WARNING
- message = "Partially faulty\n %s" % volume[args.volume]['detail']
- elif volume[args.volume]['status'] == glustercli.GeoRepStatus.FAULTY:
- exitstatus = utils.PluginStatusCode.CRITICAL
- message = "Faulty\n %s" % volume[args.volume]['detail']
- elif (volume[args.volume]['status'] ==
- glustercli.GeoRepStatus.NOT_STARTED):
- exitstatus = utils.PluginStatusCode.WARNING
- message = "Not Started"
- else:
- exitstatus = utils.PluginStatusCode.OK
- message = "OK"
+ exitstatus = utils.PluginStatusCode.OK
+ message = "Session status:"
+ detail = "Details:"
+ for slavename, slave_dict in volume[args.volume]['slaves'].iteritems():
+ message += ("%s - %s " % (slavename,
+ slave_dict['status']))
+ detail += ("%s - %s " % (slavename,
+ slave_dict['detail']))
+ if slave_dict['status'] == glustercli.GeoRepStatus.FAULTY:
+ exitstatus = utils.PluginStatusCode.CRITICAL
+ elif (slave_dict['status']
+ in [glustercli.GeoRepStatus.PARTIAL_FAULTY,
+ glustercli.GeoRepStatus.STOPPED,
+ glustercli.GeoRepStatus.NOT_STARTED]
+ and exitstatus == utils.PluginStatusCode.OK):
+ exitstatus = utils.PluginStatusCode.WARNING
+ if exitstatus != utils.PluginStatusCode.OK:
+ message += "\n" + detail
return exitstatus, message
diff --git a/tests/test_check_volume_status.py b/tests/test_check_volume_status.py
index c1ffa32..02d0bba 100644
--- a/tests/test_check_volume_status.py
+++ b/tests/test_check_volume_status.py
@@ -133,5 +133,25 @@ def _getQuotaStatusOk():
def _getGeoRepStatus(status):
- return {'test-vol': {'status': status,
- 'detail': "rhs3-2.novalocal - faulty;"}}
+ return {'test-vol': {'slaves':
+ {'10.70.43.68::slave-vol':
+ {'faulty': 1,
+ 'nodecount': 2,
+ 'notstarted': 0,
+ 'stopped': 0,
+ 'detail': 'rhs3.novalocal:/bricks/b3 '
+ '- Passive;'
+ 'rhs3-2.novalocal:/bricks/b3 '
+ '- FAULTY;',
+ 'status': status},
+ '10.70.43.68::slave-vol2':
+ {'faulty': 0,
+ 'nodecount': 2,
+ 'notstarted': 2,
+ 'stopped': 0,
+ 'detail': 'rhs3.novalocal:/bricks/b3 '
+ '- NOT_STARTED;'
+ 'rhs3-2.novalocal:/bricks/b3 '
+ '- NOT_STARTED;',
+ 'status': "NOT_STARTED"}
+ }}}