diff options
author | Jiri Lunacek <jiri.lunacek@hosting90.cz> | 2019-08-06 10:29:34 +0200 |
---|---|---|
committer | Amar Tumballi <amarts@gmail.com> | 2019-08-30 04:39:49 +0000 |
commit | 7273602b8b88229f182e29a1b977b80b02cb0624 (patch) | |
tree | 20077bce3b67bdc62df203ae6deb308dfb916f89 /extras/ocf | |
parent | f81bf47d1c3dcb69ec1f2be6f24f2b7fd9737111 (diff) |
peer_map parameter and fix in state detection when no brick is running on peer
The resource agent assumed that peer names in gluster are identical to short hostname of the machine which is not always the case. This commit adds a parameter to solve this.
Also resource agent reported brick running on cluster nodes that did not cary any brick of specified volume.
Change-Id: I90aacfc34ac0d00aae3f2abb69cacd7278b886bc
Fixes: bz#1737778
Signed-off-by: Jiri Lunacek <jiri.lunacek@hosting90.cz>
Diffstat (limited to 'extras/ocf')
-rwxr-xr-x | extras/ocf/volume.in | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/extras/ocf/volume.in b/extras/ocf/volume.in index 46dd20b8ced..76cc649e55f 100755 --- a/extras/ocf/volume.in +++ b/extras/ocf/volume.in @@ -6,6 +6,7 @@ # HA resource # # Authors: Florian Haas (hastexo Professional Services GmbH) +# Jiri Lunacek (Hosting90 Systems s.r.o.) # # License: GNU General Public License (GPL) @@ -54,6 +55,14 @@ must have clone ordering enabled. <shortdesc lang="en">gluster executable</shortdesc> <content type="string" default="$OCF_RESKEY_binary_default"/> </parameter> + <parameter name="peer_map"> + <longdesc lang="en"> + Mapping of hostname - peer name in the gluster cluster + in format hostname1:peername1,hostname2:peername2,... + </longdesc> + <shortdesc lang="en">gluster peer map</shortdesc> + <content type="string" default=""/> + </parameter> </parameters> <actions> <action name="start" timeout="20" /> @@ -68,6 +77,10 @@ EOF } +if [ -n "${OCF_RESKEY_peer_map}" ]; then + SHORTHOSTNAME=`echo "${OCF_RESKEY_peer_map}" | egrep -o "$SHORTHOSTNAME\:[^,]+" | awk -F: '{print $2}'` +fi + volume_getdir() { local voldir voldir="@GLUSTERD_WORKDIR@/vols/${OCF_RESKEY_volname}" @@ -108,6 +121,10 @@ volume_getpids() { volpid_dir=`volume_getpid_dir` bricks=`volume_getbricks` + + if [ -z "$bricks" ]; then + return 1 + fi for brick in ${bricks}; do pidfile="${volpid_dir}/${SHORTHOSTNAME}${brick}.pid" @@ -214,6 +231,11 @@ volume_validate_all() { # Test for required binaries check_binary $OCF_RESKEY_binary + + if [ -z "$SHORTHOSTNAME" ]; then + ocf_log err 'Unable to get host in node map' + return $OCF_ERR_CONFIGURED + fi return $OCF_SUCCESS } |