Bug 1398920

Summary: mysql heartbeat script runs mysqld_safe directly instead of systemd service
Product: Red Hat Enterprise Linux 7 Reporter: Tzafrir Cohen <tzafrir>
Component: resource-agentsAssignee: Oyvind Albrigtsen <oalbrigt>
Status: CLOSED NOTABUG QA Contact: cluster-qe <cluster-qe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: agk, cluster-maint, fdinitto, mnovacek
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-01 16:06:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Tzafrir Cohen 2016-11-27 10:26:47 UTC
Description of problem:
The "mysql" heartbeat resource (/usr/lib/ocf/resource.d/heartbeat/mysql) seems to generally work. E.g. '/usr/lib/ocf/resource.d/heartbeat/mysql start' will start an instance of MariaDB. However it does that by running 'mysqld_safe' directly and not through calling the mariadb service.

Version-Release number of selected component (if applicable):
3.9.5-54.el7_2.17

How reproducible:
Consistent.

Steps to Reproduce:
Create a service. From that service, run:

/usr/lib/ocf/resource.d/heartbeat/mysql stop

/usr/lib/ocf/resource.d/heartbeat/mysql start

(Or similar manipulations)

Actual results:
An instance of MariaDB running in the same cgroup of your service, regardless of the mariadb service.


Expected results:
The MariaDB service stopped and started.

Additional info:

My initial workaround (currently in a copy of that script, due to packaging concerns, but really belongs in /usr/lib/ocf/lib/heartbeat/mysql-common.sh) is:

# Redefine functions from mysql-common.sh:

mysql_common_start() {
    systemctl start mariadb
}

mysql_common_stop() {
    systemctl stop mariadb
}

mysql_common_status() {
    local loglevel=$1
    if systemctl is-active --quiet mariadb; then
        return $OCF_SUCCESS;
    else
        ocf_log $loglevel "MySQL not running"
        return $OCF_NOT_RUNNING;
    fi
}

Comment 6 Oyvind Albrigtsen 2017-11-01 16:06:33 UTC
Closing as this change would require a full rewrite of the configuration parsing, which in turn might not be backwards compatible either.