HA-LVM can't parse vgchange_options with special characters

Bug #1821380 reported by Heitor Alves de Siqueira
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
resource-agents (Ubuntu)
Fix Released
Medium
Unassigned
Xenial
Fix Released
Medium
Heitor Alves de Siqueira

Bug Description

[Impact]
We can't manage LVM resources (e.g. through pcs) if the volume_list parameter has special characters

[Description]
The heartbeat/LVM script has the vgchange_options parameter that is used during LVM resource creation. The vgchange_options are set according to the /etc/lvm/lvm.conf file. If there are any special characters in the configuration, the heartbeat/LVM script will raise an error due to wrong configuration options.
This is fixed upstream by "3949641f2fc7 quote vgchange options", but the fix is not included in Xenial.

Upstream commit: https://github.com/ClusterLabs/resource-agents/commit/3949641f2fc7

$ git describe --contains 3949641f2fc7
v4.0.0rc1~98^2

$ rmadison resource-agents
=> resource-agents | 1:3.9.7-1 | xenial | source, amd64, ...
   resource-agents | 1:4.1.0~rc1-1ubuntu1 | bionic | source, amd64, ...
   resource-agents | 1:4.1.1-2 | cosmic | source, amd64, ...
   resource-agents | 1:4.2.0-1ubuntu1 | disco | source, amd64, ...

[Test Case]
1) Deploy a Xenial VM (e.g. through uvt-kvm or virt-install)
$ uvt-kvm create node1 release=xenial

2) Install pcs and resource-agents
root@node1:~# apt update && apt install pcs resource-agents -y

3) Enable HA-LVM
root@node1:~# lvmconf --enable-halvm --services --startstopservices

4) Add "volume_list" parameter to the activation section of /etc/lvm/lvm.conf
root@node1:~# grep "volume_list =" /etc/lvm/lvm.conf
        volume_list = ["node1-vg", "@tag1"]

5) Create LVM vg/lv (we use a file-backed loop device for the vg)
root@node1:~# vgcreate vg01 /dev/loop0 --addtag tag1
root@node1:~# lvcreate vg01 --addtag tag1 -L1G

6) Create an LVM resource with pcs
root@node1:~# pcs resource create vg01 LVM volgrpname=vg01 exclusive=true --group Resource

7) Verify that LVM resource was created correctly
root@node1:~# pcs resource debug-start vg01
Error performing operation: No such file or directory
Operation start for vg01 (ocf:heartbeat:LVM) returned 2
 > stdout: volume_list=["node1-vg","@tag1"]
 > stderr: /usr/lib/ocf/resource.d/heartbeat/LVM: 415: local: --config: bad variable name

If we apply the upstream patch, the resource works as expected:
root@node1:~# pcs resource debug-start vg01
Operation start for vg01 (ocf:heartbeat:LVM) returned 0
 > stdout: volume_list=["node1-vg","@tag1"]
 > stdout: Volume group "vg01" successfully changed
 > stdout: Volume group "vg01" successfully changed
 > stdout: volume_list=["node1-vg","@tag1"]
 > stderr: INFO: Activating volume group vg01
 > stderr: INFO: Reading all physical volumes. This may take a while... Found volume group "vg01" using metadata type lvm2
 > stderr: INFO: Stripping tag, tag1
 > stderr: INFO: New tag "pacemaker" added to vg01
 > stderr: INFO: 1 logical volume(s) in volume group "vg01" now active
root@node1:~#

[Regression Potential]
Since this is an upstream patch and it only adds quotes to the vgchange options, we shouldn't hit any regressions due to this. Nonetheless, this fix will be tested with different configuration options and autopkgtests.

Changed in resource-agents (Ubuntu Xenial):
importance: Undecided → Critical
importance: Critical → Medium
assignee: nobody → Heitor R. Alves de Siqueira (halves)
description: updated
Changed in resource-agents (Ubuntu Xenial):
status: New → Confirmed
Revision history for this message
Heitor Alves de Siqueira (halves) wrote :
tags: added: sts-sponsor
Eric Desrochers (slashd)
Changed in resource-agents (Ubuntu Xenial):
status: Confirmed → In Progress
Revision history for this message
Eric Desrochers (slashd) wrote :

Sponsored for Xenial

I changed the version to be '1:3.9.7-1ubuntu1" instead of "3.9.7-2" as proposed in the debdiff.

$ dpkg --compare-versions 1:3.9.7-1 lt 1:3.9.7-1ubuntu1;echo $?
0

- Eric

Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Heitor, or anyone else affected,

Accepted resource-agents into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/resource-agents/1:3.9.7-1ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in resource-agents (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-xenial
Revision history for this message
Heitor Alves de Siqueira (halves) wrote :

Confirmed fix for Xenial, according to test case:

root@node1:~# pcs resource debug-start vg01
Operation start for vg01 (ocf:heartbeat:LVM) returned 0
 > stdout: volume_list=["node1-vg","@tag1"]
 > stdout: Volume group "vg01" successfully changed
 > stdout: Volume group "vg01" successfully changed
 > stdout: volume_list=["node1-vg","@tag1"]
 > stderr: INFO: Activating volume group vg01
 > stderr: INFO: Reading all physical volumes. This may take a while... Found volume group "vg01" using metadata type lvm2
 > stderr: INFO: Stripping tag, tag1
 > stderr: INFO: New tag "pacemaker" added to vg01
 > stderr: INFO: 1 logical volume(s) in volume group "vg01" now active

root@node1:~# dpkg -l | grep resource-agents
ii resource-agents 1:3.9.7-1ubuntu1 amd64 Cluster Resource Agents

After going through the setup as described in the description, resource activation succeeds without any changes in the heartbeat/LVM script.

tags: added: verification-done verification-done-xenial
removed: verification-needed verification-needed-xenial
Dan Streetman (ddstreet)
tags: removed: sts-sponsor
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package resource-agents - 1:3.9.7-1ubuntu1

---------------
resource-agents (1:3.9.7-1ubuntu1) xenial; urgency=medium

  * Fix heartbeat/LVM crash when vgchange_options has special characters
    (LP: #1821380). Fixed by upstream patch:
    - d/p/lp1821380-quote-vgchange-options.patch: quote vgchange options

 -- <email address hidden> (Heitor R. Alves de Siqueira) Tue, 02 Apr 2019 16:16:16 -0300

Changed in resource-agents (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for resource-agents has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.