diff options
author | Niels de Vos <ndevos@redhat.com> | 2017-10-03 16:52:48 +0200 |
---|---|---|
committer | Sahina Bose <sabose@redhat.com> | 2017-10-16 08:34:34 +0000 |
commit | d7a60096f85b68f84c7f9fb20e88fd700699755c (patch) | |
tree | e31c781b6b9184ff8f05bc4de7fc2e76a7967137 /plugins/check_proc_util.py | |
parent | 0f5404169402f212caf2b450ccde4eb6b12ccca8 (diff) |
New versions of Gluster place .pid files for volumes under
/var/run/gluster/vols/ instead of the previous /var/lib/glusterd/vols/
directory. In order to support both variants, look for the .pid file in
both locations.
BUG: 1498112
Change-Id: I605c611d792cfe29c212bb2eb9d14df2e589502c
Reported-by: Pamela Ousley <pousley@redhat.com>
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: https://review.gluster.org/18425
Reviewed-by: Sahina Bose <sabose@redhat.com>
Tested-by: Sahina Bose <sabose@redhat.com>
Diffstat (limited to 'plugins/check_proc_util.py')
-rwxr-xr-x | plugins/check_proc_util.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/plugins/check_proc_util.py b/plugins/check_proc_util.py index 28c19ef..54c67a0 100755 --- a/plugins/check_proc_util.py +++ b/plugins/check_proc_util.py @@ -34,7 +34,8 @@ _chkConfig = utils.CommandPath('chkconfig', _chkService = utils.CommandPath('service', '/sbin/service', 'usr/sbin/service') -_glusterVolPath = "/var/lib/glusterd/vols" +_glusterVolRunFmt = ["/var/run/gluster/vols/%s/", + "/var/lib/glusterd/vols/%s/run/"] _checkGlusterService = [_chkService.cmd, "glusterd", "status"] _checkNfsCmd = [_checkProc.cmd, "-c", "1:", "-C", "glusterfs", "-a", "nfs"] _checkShdCmd = [_checkProc.cmd, "-c", "1:", "-C", "glusterfs", "-a", @@ -69,8 +70,20 @@ def getBrickStatus(volumeName, brickName): brickPath = brickName.split(':')[1] pidFile = brickName.replace(":/", "-").replace("/", "-") + ".pid" try: - with open("%s/%s/run/%s" % ( - _glusterVolPath, volumeName, pidFile)) as f: + brickPidFile = None + for fmt in _glusterVolRunFmt: + brickPidFile = (fmt % (volumeName)) + pidFile + if os.path.exists(brickPidFile): + break + else: + brickPidFile = None + + if not brickPidFile: + status = utils.PluginStatusCode.CRITICAL + msg = "Could not find pid for brick %s" % (brickPath) + return status, msg + + with open(brickPidFile) as f: try: if _pidExists(int(f.read().strip())): status = utils.PluginStatusCode.OK |