Bug 760946 - lvm2-monitor fails to start with lvm.conf containing 'command_names = 1' or 'prefix='something''
Summary: lvm2-monitor fails to start with lvm.conf containing 'command_names = 1' or '...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2
Version: 6.2
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Peter Rajnoha
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On:
Blocks: 760559
TreeView+ depends on / blocked
 
Reported: 2011-12-07 12:04 UTC by Alexander Todorov
Modified: 2012-06-20 15:00 UTC (History)
11 users (show)

Fixed In Version: lvm2-2.02.95-1.el6
Doc Type: Bug Fix
Doc Text:
Using a prefix or using command names on LVM command output (the 'log/prefix' and 'log/command_names' lvm.conf setting) caused the lvm2-monitor init script to fail start monitoring for relevant VGs. The init script acquires the list of VGs first by calling the 'vgs' command and then it uses its output for further processing. However, if the prefix or command name is used on output, the VG name was not correctly formatted. To solve this, the lvm2-monitor init script overrides the log/prefix and log/command_names setting so the command's output is always suitable for use in the init script.
Clone Of: 593096
Environment:
Last Closed: 2012-06-20 15:00:34 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0962 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2012-06-19 21:12:11 UTC

Description Alexander Todorov 2011-12-07 12:04:14 UTC
+++ This bug was initially created as a clone of Bug #593096 +++

With lvm2-2.02.87-6.el6.i686:

Starting monitoring for VG vgs---VolGroup00: vgchange---Volume group "vgs---VolGroup00" not found
[FAILED]


Steps to reproduce:
1) Update /etc/lvm/lvm.conf and set command_names=1, prefix="---"
# lvs
lvs---LV       VG         Attr   LSize  Origin Snap%  Move Log Copy%  Convert
lvs---LogVol00 VolGroup00 -wi-ao 37,91G                                      
lvs---LogVol01 VolGroup00 -wi-ao  1,97G                                      

# pvs
pvs---PV         VG         Fmt  Attr PSize  PFree
pvs---/dev/vda2  VolGroup00 lvm2 a--  39,88G    0 

# vgs
vgs---VG         #PV #LV #SN Attr   VSize  VFree
vgs---VolGroup00   1   2   0 wz--n- 39,88G    0 


2) Reboot

Comment 2 Peter Rajnoha 2011-12-07 12:30:21 UTC
Nice catch, thanks for the report!

Comment 3 Corey Marthaler 2011-12-15 23:38:00 UTC
Adding QA ack for 6.3. 

Devel will need to provide unit testing results however before this bug can be
ultimately verified by QA.

Comment 4 Peter Rajnoha 2011-12-16 08:42:39 UTC
(In reply to comment #3)
> Devel will need to provide unit testing results however before this bug can be
> ultimately verified by QA.

Using log/command_names=1 and log/prefix="---" in lvm.conf.

Before the patch:

[root@node-a ~]# service lvm2-monitor start
Starting monitoring for VG vgs---VolGroup: vgchange---Volume group "vgs---VolGroup" not found
                                                           [FAILED]

After the patch (https://www.redhat.com/archives/lvm-devel/2011-December/msg00009.html):

[root@node-a ~]# service lvm2-monitor start     
Starting monitoring for VG VolGroup: vgchange---2 logical volume(s) in volume group "VolGroup" monitored
                                                           [  OK  ]
[root@node-a ~]# service lvm2-monitor force-stop
Stopping monitoring for VG VolGroup: vgchange---2 logical volume(s) in volume group "VolGroup" unmonitored
                                                           [  OK  ]

(Note that the "vgchange" command name with the prefix is still visible - but I guess this is expected if configured in lvm.conf that way.)

Comment 5 Alasdair Kergon 2011-12-16 10:31:56 UTC
"(Note that the "vgchange" command name with the prefix is still visible - but I
guess this is expected if configured in lvm.conf that way.)"

Why?  Might as well fix that at the same time...

Comment 6 Peter Rajnoha 2011-12-16 11:47:32 UTC
OK, patched as well (https://www.redhat.com/archives/lvm-devel/2011-December/msg00029.html):

[root@node-a ~]# service lvm2-monitor start
Starting monitoring for VG VolGroup:   2 logical volume(s) in volume group "VolGroup" monitored
                                                           [  OK  ]

[root@node-a ~]# service lvm2-monitor force-stop
Stopping monitoring for VG VolGroup:   2 logical volume(s) in volume group "VolGroup" unmonitored
                                                           [  OK  ]

Comment 8 Peter Rajnoha 2012-04-24 12:51:28 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Using a prefix or using command names on LVM command output (the 'log/prefix' and 'log/command_names' lvm.conf setting) caused the lvm2-monitor init script to fail start monitoring for relevant VGs.

The init script acquires the list of VGs first by calling the 'vgs' command and then it uses its output for further processing. However, if the prefix or command name is used on output, the VG name was not correctly formatted. To solve this, the lvm2-monitor init script overrides the log/prefix and log/command_names setting so the command's output is always suitable for use in the init script.

Comment 9 Nenad Peric 2012-04-27 13:02:27 UTC
The commands have been tested and verified with 

lvm2-2.02.95-5.el6.x86_64

(08:10:31) [root@node01:~]$ vgs
vgs---VG       #PV #LV #SN Attr   VSize  VFree 
vgs---VolGroup   1   2   0 wz--n-  9.51g     0 
vgs---volume1    4   2   0 wz--n- 38.11g 34.61g

(08:10:27) [root@node01:~]$ lvs
lvs---LV      VG       Attr     LSize    Pool Origin Data%  Move Log         Copy%  Convert
lvs---lv_root VolGroup -wi-ao--    8.52g                                                   
lvs---lv_swap VolGroup -wi-ao-- 1008.00m                                                   
lvs---mirror  volume1  mwi-a-m-    1.50g                         mirror_mlog 100.00        
lvs---stripe  volume1  -wi-a---  504.00m       

(08:09:51) [root@node01:~]$ service lvm2-monitor start
Starting monitoring for VG VolGroup:   2 logical volume(s) in volume group "VolGroup" monitored
                                                           [  OK  ]
Starting monitoring for VG volume1:   5 logical volume(s) in volume group "volume1" monitored
                                                           [  OK  ]


Apr 27 08:08:20 node01 dmeventd[2086]: dmeventd ready for processing.
Apr 27 08:08:20 node01 lvm[2086]: Monitoring mirror device volume1-mirror for events.
Apr 27 08:09:42 node01 lvm[2086]: volume1-mirror is now in-sync.


(08:11:41) [root@node01:~]$ service lvm2-monitor force-stop
Stopping monitoring for VG VolGroup:   2 logical volume(s) in volume group "VolGroup" unmonitored
                                                           [  OK  ]
Stopping monitoring for VG volume1:   5 logical volume(s) in volume group "volume1" unmonitored
                                                           [  OK  ]


Apr 27 08:11:49 node01 lvm[2086]: No longer monitoring mirror device volume1-mirror for events.

Comment 11 errata-xmlrpc 2012-06-20 15:00:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0962.html


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