Bug 1219572 - [ccs2pcs] mysql listen_address -> --bind-address quoting
Summary: [ccs2pcs] mysql listen_address -> --bind-address quoting
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: clufter
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jan Pokorný [poki]
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1182358
TreeView+ depends on / blocked
 
Reported: 2015-05-07 16:29 UTC by Patrik Hagara
Modified: 2015-05-19 18:56 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-05-19 18:56:02 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Patrik Hagara 2015-05-07 16:29:20 UTC
Description of problem:
Clufter quotes the listen address which ends in the additional_parameters mysql resource agent option. This in turn causes the pacemaker mysql agent to quote the whole option with single quotes ('--listen-address="0.0.0.0"') for reasons unknown. This quoted argument is then passed as-is directly in the argv to mysqld binary, resulting in a weird error ([ERROR] Can't create IP socket: Success), mysqld not starting and resource failing as a consequence.

Version-Release number of selected component (if applicable):
clufter git-next
resource-agents-3.9.5-40.el7_1.3.x86_64

How reproducible:
always

Steps to Reproduce:
1. either convert cluster.conf with mysql resource and listen_address set to a custom value; or manually add mysql resource to pacemaker cluster and set additional_parameters to: --listen-address="0.0.0.0"
2. start the mysql resource

Actual results:
mysqld fails to start (see below for more info)

Expected results:
Both Clufter and mysql resource agent should probably not add extra quotes where not required.

Additional info:
With --listen-address="0.0.0.0" (note the double quotes here and single quotes when starting the resource):
     
    <primitive class="ocf" id="my" provider="heartbeat" type="mysql">
      <instance_attributes id="my-instance_attributes">
        <nvpair id="my-instance_attributes-additional_parameters" name="additional_parameters" value="--bind-address=&quot;0.0.0.0&quot;"/>
        <nvpair id="my-instance_attributes-config" name="config" value="/etc/oh-my.cnf"/>
      </instance_attributes>
      ...
    </primitive>
     
$ pcs resource debug-start my --full
    ...
     >  stderr: + 17:24:30: mysql_common_start:209: /usr/bin/mysqld_safe --defaults-file=/etc/oh-my.cnf --pid-file=/var/run/mysql/mysqld.pid --socket=/var/lib/mysql/mysql.sock --datadir=/var/lib/mysql --log-error=/var/log/mysqld.log --user=mysql '--bind-address="0.0.0.0"'
    ...
     
result: mysql fails to start, snippet from /var/log/mysqld.log:
    150507 17:24:32 [ERROR] Can't create IP socket: Success
    150507 17:24:32 [ERROR] Aborting
     

Changing to --listen-addres=0.0.0.0 (no double quotes):
     
    <primitive class="ocf" id="my" provider="heartbeat" type="mysql">
      <instance_attributes id="my-instance_attributes">
        <nvpair id="my-instance_attributes-additional_parameters" name="additional_parameters" value="--bind-address=0.0.0.0"/>
        <nvpair id="my-instance_attributes-config" name="config" value="/etc/oh-my.cnf"/>
      </instance_attributes>
      ...
    </primitive>
          
$ pcs resource debug-start my --full
    ...
     >  stderr: + 17:11:20: mysql_common_start:209: /usr/bin/mysqld_safe --defaults-file=/etc/oh-my.cnf --pid-file=/var/run/mysql/mysqld.pid --socket=/var/lib/mysql/mysql.sock --datadir=/var/lib/mysql --log-error=/var/log/mysqld.log --user=mysql --bind-address=0.0.0.0
    ...
     
result: mysqld starts and listens on 0.0.0.0

Comment 1 Jan Pokorný [poki] 2015-05-07 19:58:49 UTC
Should be fixed as of upstream commit (next branch):
https://github.com/jnpkrn/clufter/commit/5618410ec54e4a3c28ebfc40167a361d98ec2dad

Comment 2 Patrik Hagara 2015-05-11 11:54:24 UTC
that fix does not work, getting this error in mysqld.log:
    /usr/libexec/mysqld: Too many arguments (first extra is '"--bind-address=0.0.0.0"').

cluster cib contains:
    <nvpair id="RESOURCE-mysql-oh-my-ATTRS-additional_parameters" name="additional_parameters" value="&quot;--bind-address=0.0.0.0&quot; --verbose"/>

Comment 3 Jan Pokorný [poki] 2015-05-15 21:17:58 UTC
> Quotes cannot be present at all now (and "never" for backward
> compatibility, even when there is "eval $cmd $arg1 $arg2"):
> 
>     http://clusterlabs.org/pipermail/users/2015-May/000403.html

Should be fixed as of upstream commit (next branch):
https://github.com/jnpkrn/clufter/commit/4d5478336bcf34f573f3a3090d61dc35e10ea174

Comment 4 Jan Pokorný [poki] 2015-05-19 18:56:02 UTC
OK, it was found out that in the current state of resource agents, there
is little to nothing that we can do to prevent from accidental injection
of unexpected parts of the command-line outside of what is an expected
effect of parameter propagation (as we tried with additional quotes).

Resigning and claiming this bug resolved in upstream release
https://github.com/jnpkrn/clufter/releases/tag/v0.11.1
(for the time being).


Note You need to log in before you can comment on or make changes to this bug.