Bug 995157

Summary: [RHEL 6.4] LVM allows setting of clustered attribute on VG even though clvmd or cluster configured or running.
Product: Red Hat Enterprise Linux 6 Reporter: Kevin Toyama <ktoyama>
Component: lvm2Assignee: Jonathan Earl Brassow <jbrassow>
lvm2 sub component: Clustering / clvmd (RHEL6) QA Contact: Cluster QE <mspqa-list>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high CC: agk, bmr, dwysocha, heinzm, jbrassow, jshortt, msnitzer, nperic, prajnoha, prockai, thornber, zkabelac
Version: 6.4   
Target Milestone: rc   
Target Release: 6.6   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.107-1.el6 Doc Type: Bug Fix
Doc Text:
If a user attempts to assign the clustered attribute to a volume group (i.e. 'vgchange -cy VG') and the system is not yet properly configured for it, they will be prompted to confirm the change. The prompt can be overriden by supplying the '--yes' argument.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-14 08:24:37 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:
Bug Depends On:    
Bug Blocks: 1056252, 1075263    

Comment 6 Zdenek Kabelac 2013-08-08 23:06:17 UTC
(In reply to Kevin Toyama from comment #0)
> Description of problem:
> Customer is not running clvmd nor has cluster confgured to be running. 
> vgchange -cy <VGNAME> allows the clustered attribute to be set and skips the
> VG in future LVM commands due to clustered being set.
> 
> Version-Release number of selected component (if applicable):
> lvm2-2.02.98-9.el6.x86_64
> 
> How reproducible:
> always
> 
> Steps to Reproduce:
> 1. verify clvmd and clustering is not running (ps -ef|grep clvmd; clustat)
> 2. vgchange -an testvg
> 3. vgchange -cy testvg
> 4. vgchange -ay
> 
> Actual results:
> "Skipping clustered volume group vg_vdb"
> 
> Expected results:
> LVM command should prompt and warn about enabling clustered attribute on VG
> if clvmd or cluster is not running.  Or should prompt regardless to be sure
> that end user *REALLY* wants this enabled.


-cy  is not an option a user should just play with without thinking (just like user should not play with 'rm' command).

lvm is not enforcing the order in which way the user setups his cluster - so there is not requirement to enable clvmd first and just the make a VG clustered - it's upto the admin to switch the VG first or just after clvmd is enabled.
(And if would cause a regression to those users, if we would have enforced
availability of clvmd first)

The only necessary thing is to have all LVs inactive in such VG.

The remove of clustered flag is not trivial without clustered locking available, since there is missing knowledge about active locks for this case.
(We don't know if just dlm got broken, network is not working....)

That's why the only supported way for now is to disable locking with the assumption, the admin is fully aware of consequences of this step.

Comment 8 Alasdair Kergon 2013-08-08 23:17:35 UTC
For users who do rely on the code to work as it is, we will provide a release note saying they need to add --yes to the command in their scripts.

Comment 10 Jonathan Earl Brassow 2014-06-06 03:34:00 UTC
Fix checked-in upstream:
commit 9399b74356f9d0c2fbbac824908b15d63c3935cd
Author: Jonathan Brassow <jbrassow>
Date:   Thu Jun 5 22:27:40 2014 -0500

    vgchange: Prompt when setting VG cluster attr if cluster is not setup
    
    If clvmd is not running or the locking type is not clustered and someone
    attempts to set the cluster attribute on a volume group, prompt them to
    see if they are sure.  (Only prompt for one though.  If neither are true,
    simply ask them once.)

Comment 11 Jonathan Earl Brassow 2014-06-06 03:39:08 UTC
TO TEST, DO THE FOLLOWING:

vgchange should prompt if clvmd is not running or the locking_type is not a clustered locking type.  (Before the patch, vgchange would simply change the attribute regardless.)

[root@bp-01 lvm2]# vgchange -cy vg
LVM cluster daemon (clvmd) is not running.
Make volume group "vg" clustered anyway? [y/n]: n
  Command failed with status code 5.

[root@bp-01 lvm2]# clvmd
[root@bp-01 lvm2]# vgchange -cy vg
LVM locking type is not clustered.
Make volume group "vg" clustered anyway? [y/n]: n
  Command failed with status code 5.

[root@bp-01 lvm2]# nano /etc/lvm/lvm.conf 
[root@bp-01 lvm2]# vgchange -cy vg
  Volume group "vg" successfully changed

[root@bp-01 lvm2]# vgchange -cn vg
  Volume group "vg" successfully changed

Comment 12 Jonathan Earl Brassow 2014-06-06 03:51:25 UTC
Additional commit upstream:

commit c0f9c79ae8e1df16d23f3eb608fb4bf5455ec841
Author: Jonathan Brassow <jbrassow>
Date:   Thu Jun 5 22:45:19 2014 -0500

    vgchange:  With '--yes', don't prompt the user
    
    If the user supplies a '--yes' argument, then don't bother them with
    a question to confirm whether to change the cluster attribute (even
    if clvmd isn't running).

Comment 14 Nenad Peric 2014-06-30 12:08:05 UTC
LVM is prompting for confirmation regarding the marking of a VG as a member of cluster.
It adds a human-readable error message as well.

[root@virt-015 ~]# vgchange -cy my_vg
LVM cluster daemon (clvmd) is not running.
Make volume group "my_vg" clustered anyway? [y/n]: n
  No volume groups changed.


[root@virt-015 ~]# vgchange -cy my_vg
  connect() failed on local socket: No such file or directory
  Internal cluster locking initialisation failed.
  WARNING: Falling back to local file-based locking.
  Volume Groups with the clustered attribute will be inaccessible.
LVM cluster daemon (clvmd) is not running.
Make volume group "my_vg" clustered anyway? [y/n]: 
LVM cluster daemon (clvmd) is not running.
Make volume group "my_vg" clustered anyway? [y/n]: n
  No volume groups changed.


Providing the --yes argument, the command proceeds without the checks mentioned above:

[root@virt-015 ~]# vgchange -cy --yes two
  Volume group "two" successfully changed


All tests were done on a single server (no HA/clusering set up)



Marking VERIFIED with:
lvm2-2.02.107-1.el6    BUILT: Mon Jun 23 16:44:45 CEST 2014
lvm2-libs-2.02.107-1.el6    BUILT: Mon Jun 23 16:44:45 CEST 2014
lvm2-cluster-2.02.107-1.el6    BUILT: Mon Jun 23 16:44:45 CEST 2014
udev-147-2.55.el6    BUILT: Wed Jun 18 13:30:21 CEST 2014
device-mapper-1.02.86-1.el6    BUILT: Mon Jun 23 16:44:45 CEST 2014
device-mapper-libs-1.02.86-1.el6    BUILT: Mon Jun 23 16:44:45 CEST 2014
device-mapper-event-1.02.86-1.el6    BUILT: Mon Jun 23 16:44:45 CEST 2014
device-mapper-event-libs-1.02.86-1.el6    BUILT: Mon Jun 23 16:44:45 CEST 2014
device-mapper-persistent-data-0.3.2-1.el6    BUILT: Fri Apr  4 15:43:06 CEST 2014
cmirror-2.02.107-1.el6    BUILT: Mon Jun 23 16:44:45 CEST 2014

Comment 16 errata-xmlrpc 2014-10-14 08:24:37 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-2014-1387.html