Public bug reported:

[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.

** Affects: resource-agents (Ubuntu)
     Importance: Medium
         Status: Fix Released

** Affects: resource-agents (Ubuntu Xenial)
     Importance: Medium
     Assignee: Heitor R. Alves de Siqueira (halves)
         Status: New


** Tags: sts

** Also affects: resource-agents (Ubuntu Xenial)
   Importance: Undecided
       Status: New

** Changed in: resource-agents (Ubuntu Xenial)
   Importance: Undecided => Critical

** Changed in: resource-agents (Ubuntu Xenial)
   Importance: Critical => Medium

** Changed in: resource-agents (Ubuntu Xenial)
     Assignee: (unassigned) => Heitor R. Alves de Siqueira (halves)

** Description changed:

  [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, ...
+    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 
+ 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"]
+         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
+  >  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
+  >  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.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1821380

Title:
  HA-LVM can't parse vgchange_options with special characters

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/resource-agents/+bug/1821380/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to