Bug 1213735

Summary: lvmconf is missing command line check for switching the config to clustered mode
Product: Red Hat Enterprise Linux 6 Reporter: Nenad Peric <nperic>
Component: lvm2Assignee: Peter Rajnoha <prajnoha>
lvm2 sub component: Configuration files (RHEL6) QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: agk, cmarthal, heinzm, jbrassow, msnitzer, prajnoha, prockai, rbednar, zkabelac
Version: 6.7   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.140-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-11 01:16:36 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:
Embargoed:

Description Nenad Peric 2015-04-21 07:55:42 UTC
Description of problem:

lvmconf can be used to automatically set the lvm.conf and the required services up for installation / configuration of a clustered environment. However, when using the normal (not ha-lvm) options, there are two problems present. 
The check for validity of used options is missing, and the setting of the locking_type is wrong in some cases. 


Version-Release number of selected component (if applicable):

lvm2-2.02.118-2.el6.x86_64

How reproducible:
Everytime

Steps to Reproduce:

[root@tardis-02 ~]# lvmconf  --services --lockinglibdir /root
[root@tardis-02 ~]# echo $?
0

Actual results:

The command succeeds. 
Additionally if the prerequisite options ARE provided, the locking_type is set to 3 (as in default settings), instead to 2 which would be if --lockinglibdir is provided.

Expected results:

Do not allow the usage of sub-arguments of --enable-cluster on their own. 
Make sure that the correct locking type is used in all cases. 

Additional info:

Comment 2 Peter Rajnoha 2015-09-22 11:36:54 UTC
(In reply to Nenad Peric from comment #0)
> Additionally if the prerequisite options ARE provided, the locking_type is
> set to 3 (as in default settings), instead to 2 which would be if
> --lockinglibdir is provided.
> 

Fixed with https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=001f747963d66e4cff8e827afb710961193b9f03.


> Do not allow the usage of sub-arguments of --enable-cluster on their own. 
> Make sure that the correct locking type is used in all cases. 

Actually, the --lockinglibdir as well as --lockinglib argument is allowed to be used with the --enable-cluster or not. I won't change this as it's already released this way.

# lvmconf --help
Usage: /usr/sbin/lvmconf <command>

Commands:
Enable clvm:  --enable-cluster [--lockinglibdir <dir>] [--lockinglib <lib>]
Disable clvm: --disable-cluster
Enable halvm: --enable-halvm
Disable halvm: --disable-halvm
Set locking library: --lockinglibdir <dir> [--lockinglib <lib>]

Comment 5 Corey Marthaler 2016-02-15 17:58:17 UTC
Looks like all of the following test cases now work as expected, marking verified.


2.6.32-615.el6.x86_64
lvm2-2.02.141-2.el6    BUILT: Wed Feb 10 07:49:03 CST 2016
lvm2-libs-2.02.141-2.el6    BUILT: Wed Feb 10 07:49:03 CST 2016
lvm2-cluster-2.02.141-2.el6    BUILT: Wed Feb 10 07:49:03 CST 2016
udev-147-2.66.el6    BUILT: Mon Jan 18 02:42:20 CST 2016
device-mapper-1.02.115-2.el6    BUILT: Wed Feb 10 07:49:03 CST 2016
device-mapper-libs-1.02.115-2.el6    BUILT: Wed Feb 10 07:49:03 CST 2016
device-mapper-event-1.02.115-2.el6    BUILT: Wed Feb 10 07:49:03 CST 2016
device-mapper-event-libs-1.02.115-2.el6    BUILT: Wed Feb 10 07:49:03 CST 2016
device-mapper-persistent-data-0.6.1-1.el6    BUILT: Wed Feb 10 05:09:45 CST 2016
cmirror-2.02.141-2.el6    BUILT: Wed Feb 10 07:49:03 CST 2016



[root@host-113 ~]# grep locking_type /etc/lvm/lvm.conf
        # Configuration option global/locking_type.
        #     when to use it instead of the configured locking_type.
    locking_type = 3

[root@host-113 ~]# lvmconf  --services --lockinglibdir /root
[root@host-113 ~]# grep locking_type /etc/lvm/lvm.conf
    locking_type = 2

[root@host-113 ~]# lvmconf --enable-cluster
[root@host-113 ~]# grep locking_type /etc/lvm/lvm.conf
    locking_type = 3

[root@host-113 ~]# lvmconf --disable-cluster
[root@host-113 ~]# grep locking_type /etc/lvm/lvm.conf
    locking_type = 1

[root@host-113 ~]# lvmconf --lockinglibdir /root
[root@host-113 ~]# grep locking_type /etc/lvm/lvm.conf
    locking_type = 2

[root@host-113 ~]# lvmconf --enable-halvm
[root@host-113 ~]# grep locking_type /etc/lvm/lvm.conf
    locking_type = 1

[root@host-113 ~]# lvmconf --enable-halvm --lockinglibdir /root
Either HA LVM or cluster method may be used at one time

[root@host-113 ~]# lvmconf --enable-cluster --lockinglibdir /root
[root@host-113 ~]# grep locking_type /etc/lvm/lvm.conf
    locking_type = 2

[root@host-113 ~]# lvmconf --disable-cluster --lockinglibdir /root
[root@host-113 ~]# grep locking_type /etc/lvm/lvm.conf
    locking_type = 2

[root@host-113 ~]# lvmconf --enable-cluster --enable-halvm
Either HA LVM or cluster method may be used at one time

[root@host-113 ~]# lvmconf --enable-halvm --lockinglibdir /root
Either HA LVM or cluster method may be used at one time

[root@host-113 ~]# lvmconf --enable-cluster 
[root@host-113 ~]# grep locking_type /etc/lvm/lvm.conf
    locking_type = 3

Comment 7 errata-xmlrpc 2016-05-11 01:16:36 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.

https://rhn.redhat.com/errata/RHBA-2016-0964.html