mysql-wss: fixed node score calculation

There was a typo near !/${OCF_RESOURCE_INSTANCE}:/
Also it eliminates unnecessary forks as node score
is placed in last column of a string.

Change-Id: I3c4efacb1cf6038a14cb6834ed94903bc9f92466
Closes-Bug: #1623935
Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
This commit is contained in:
Pavel Glushchak 2016-09-15 16:02:50 +03:00 committed by Vladimir Kuklin
parent 13d1cd4fd4
commit c66d8c54d7
1 changed files with 1 additions and 1 deletions

View File

@ -428,7 +428,7 @@ get_master() {
[ "${MASTER_GTID}" ] || MASTER_GTID=$ZEROID
ocf_log info "${LH} The most seen GTID is: ${MASTER_GTID}"
for NODE in $NODES; do
NODE_SCORE=`crm_simulate -Ls | awk "/${OCF_RESOURCE_INSTANCE}/ && /clone_color/ && !/${OCF_RESOURCE_INSTANCE}:/ && /${NODE}/" | sed -r -e 's/.*score on (.*)/\1/' | awk -F ':' '{print $2}' | tr -d '[:space:]'`
NODE_SCORE=$(crm_simulate -Ls | awk "/${OCF_RESOURCE_INSTANCE}/ && /clone_color/ && ! /${OCF_RESOURCE_INSTANCE}:/ && /${NODE}/ {print \$NF}")
if [[ $NODE_SCORE =~ ^-?[0-9]+$ && $NODE_SCORE -le 0 || $NODE_SCORE = "-INFINITY" || -z $NODE_SCORE ]]
then
ocf_log info "${LH} Skipping node $NODE as it is not eligible for running the resource. Its score is ${NODE_SCORE:-NULL}"