From d040cb45469d64fa7534247f9568b48b28114c3f Mon Sep 17 00:00:00 2001 From: Sahina Bose Date: Mon, 9 Jun 2014 16:02:51 +0530 Subject: server-plugin: To check if any vol has server side quorum Added a server side plugin to change status from Pending to OK/UNKNOWN depending on if volumes have server side quorum turned on Renamed service to ensure service definition gets updated on upgrades. Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1106421 Change-Id: I1f1ca1dcf56872342ec8e25396a89163d22aedeb Signed-off-by: Sahina Bose Reviewed-on: http://review.gluster.org/8023 Reviewed-by: darshan n Reviewed-by: Ramesh N --- plugins/check_vol_server.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'plugins/check_vol_server.py') diff --git a/plugins/check_vol_server.py b/plugins/check_vol_server.py index e7dd150..a45a24d 100755 --- a/plugins/check_vol_server.py +++ b/plugins/check_vol_server.py @@ -62,6 +62,10 @@ def _getVolGeoRepStatusNRPECommand(volume): return ("check_vol_status -a %s %s" % (volume, 'geo-rep')) +def _getQuorumStatusNRPECommand(): + return ("check_quorum_status") + + # This function gets the replica pairs # bricks - list of bricks in the volume # pair_index - nth pair of replica's needs to be returned @@ -199,6 +203,25 @@ def _getVolumeQuotaStatusOutput(hostgroup, volume): return _executeRandomHost(hostgroup, _getVolQuotaStatusNRPECommand(volume)) +def _getQuorumStatusOutput(hostgroup): + # get current volume quorum status + table = livestatus.readLiveStatus("GET services\n" + "Columns: state,plugin_output\n" + "Filter: description = " + "Cluster - Quorum\n" + "Filter: host_name = %s\n" % hostgroup) + servicestatus = utils.PluginStatusCode.UNKNOWN + pluginoutput = '' + if len(table) > 0: + servicetab = table[0] + servicestatus = servicetab[0] + pluginoutput = servicetab[1] + if (int(servicestatus) != utils.PluginStatusCode.CRITICAL): + return _executeRandomHost(hostgroup, _getQuorumStatusNRPECommand()) + else: + return servicestatus, pluginoutput + + def execNRPECommand(command): status, output, err = utils.execCmd(command.split(), raw=True) return status, output @@ -255,6 +278,8 @@ def showVolumeOutput(args): command = _getVolSelfHealStatusNRPECommand(args.volume) elif args.option == 'geo-rep': command = _getVolGeoRepStatusNRPECommand(args.volume) + elif args.option == 'quorum': + return _getQuorumStatusOutput(args.hostgroup) return _executeRandomHost(args.hostgroup, command) @@ -290,7 +315,8 @@ def parse_input(): 'status', 'quota', 'self-heal', - 'geo-rep']) + 'geo-rep', + 'quorum']) parser.add_argument('-t', '--timeout', action='store', help='NRPE timeout') -- cgit