Bug 230146 - RFE: allow the cmdline suppression of locking errors for scriptability
RFE: allow the cmdline suppression of locking errors for scriptability
Status: CLOSED NEXTRELEASE
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: lvm2 (Show other bugs)
5.5
All Linux
medium Severity medium
: ---
: ---
Assigned To: LVM and device-mapper development team
Corey Marthaler
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-02-26 16:01 EST by Corey Marthaler
Modified: 2014-02-05 10:07 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-02-05 10:04:56 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Corey Marthaler 2007-02-26 16:01:07 EST
Description of problem:
This was allowed in rhel4u4, so maybe this is a regression of sorts. When one
wants to do cmdline scripting, they don't want to deal with the locking errors,
and if they are so important, then make the cmds error code non zero.

RHEL4u4 - 
[root@link-02 ~]# lvs --ignorelockingfailure
  connect() failed on local socket: Connection refused
  LV        VG       Attr   LSize   Origin Snap%  Move Log Copy%
  LINK_1280 LINK_128 -wi--- 949.59G
[root@link-02 ~]# echo $?
0
[root@link-02 ~]# lvs
  connect() failed on local socket: Connection refused
  Locking type 2 initialisation failed.
[root@link-02 ~]# echo $?
5


RHEL4u5 -
[root@taft-02 ~]# lvs
  connect() failed on local socket: Connection refused
  WARNING: Falling back to local file-based locking.
  Volume Groups with the clustered attribute will be inaccessible.
  LV       VG         Attr   LSize  Origin Snap%  Move Log Copy%
  LogVol00 VolGroup00 -wi-ao 66.16G
  LogVol01 VolGroup00 -wi-ao  1.94G
  foo      corey      -wi--- 10.00G
  lvol0    corey      -wi--- 10.00G
[root@taft-02 ~]# echo $?
0
[root@taft-02 ~]# lvs --ignorelockingfailure
  connect() failed on local socket: Connection refused
  WARNING: Falling back to local file-based locking.
  Volume Groups with the clustered attribute will be inaccessible.
  LV       VG         Attr   LSize  Origin Snap%  Move Log Copy%
  LogVol00 VolGroup00 -wi-ao 66.16G
  LogVol01 VolGroup00 -wi-ao  1.94G
  foo      corey      -wi--- 10.00G
  lvol0    corey      -wi--- 10.00G
[root@taft-02 ~]# echo $?
0



Version-Release number of selected component (if applicable):
2.6.9-48.ELsmp
lvm2-2.02.21-3.el4
Comment 1 Milan Broz 2008-04-08 06:29:52 EDT
I think this is fixed (lvm2-2.02.27-2), messages are printed to stderr so can be
 sent to /dev/null :) - is it what you want for scripting?

[root@bar-01 lvm2]# lvs ; echo $?
  connect() failed on local socket: Connection refused
  WARNING: Falling back to local file-based locking.
  Volume Groups with the clustered attribute will be inaccessible.
  Skipping clustered volume group vg_bar
  LV      VG       Attr   LSize  Origin Snap%  Move Log Copy%
  rootvol myvg     -wi-a- 33.59G
  lv_test vg_local -wi-a-  1.00G
  root    vg_rhel4 -wi-ao 33.56G
5
[root@bar-01 lvm2]# lvs --ignorelockingfailure 2>/dev/null; echo $?
  LV      VG       Attr   LSize  Origin Snap%  Move Log Copy%
  rootvol myvg     -wi-a- 33.59G
  lv_test vg_local -wi-a-  1.00G
  root    vg_rhel4 -wi-ao 33.56G
5
[root@bar-01 lvm2]# clvmd
[root@bar-01 lvm2]# lvs --ignorelockingfailure ; echo $?
  LV      VG       Attr   LSize  Origin Snap%  Move Log Copy%
  rootvol myvg     -wi-a- 33.59G
  lv_test vg_bar   -wi-a-  1.00G
  lv_test vg_local -wi-a-  1.00G
  root    vg_rhel4 -wi-ao 33.56G
0
Comment 2 Corey Marthaler 2008-06-05 10:55:30 EDT
That's not really what I had in mind. I'm curious why after rhel4u5, the
'--ignorelockingfailure' seems to no longer do anything. By your logic, if
you're going to use /dev/null anyways, then why use the '--ignorelockingfailure'
at all?

[root@taft-01 sbin]# lvs --ignorelockingfailure 2>/dev/null; echo $?
  LV       VG         Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  LogVol00 VolGroup00 -wi-ao 58.34G
  LogVol01 VolGroup00 -wi-ao  9.75G
5
[root@taft-01 sbin]# lvs 2>/dev/null; echo $?
  LV       VG         Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  LogVol00 VolGroup00 -wi-ao 58.34G
  LogVol01 VolGroup00 -wi-ao  9.75G
5

Why doesn't the '--ignorelockingfailure' suppress those errors by itself like it
used to in comment #0.

RHEL4u4 - 
[root@link-02 ~]# lvs --ignorelockingfailure
  connect() failed on local socket: Connection refused
  LV        VG       Attr   LSize   Origin Snap%  Move Log Copy%
  LINK_1280 LINK_128 -wi--- 949.59G
[root@link-02 ~]# echo $?
0
Comment 3 Milan Broz 2010-05-17 08:17:47 EDT
There some new switches, but still probably something missing.
Anyway, not RHEL4 material, moving to RHEL5 for now...
Comment 4 Zdenek Kabelac 2013-05-14 16:35:30 EDT
Do we still have this problem - or can we fix this as next release (RHEL5) ?
Comment 5 Corey Marthaler 2013-05-15 16:12:33 EDT
Looks like "--ignorelockingfailure" still doesn't do anything. The cluster volume w/o clvmd running still isn't visible.

## RHEL6.4
[root@taft-01 ~]# lvs --ignorelockingfailure
  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.
  Skipping clustered volume group cluster
  Skipping volume group cluster
  LV      VG        Attr      LSize  Pool Origin Data%  Move Log Cpy%Sync Convert
  lv_home vg_taft01 -wi-ao---  9.94g
  lv_root vg_taft01 -wi-ao--- 50.00g
  lv_swap vg_taft01 -wi-ao---  7.81g
[root@taft-01 ~]# echo $?
5
[root@taft-01 ~]# lvs
  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.
  Skipping clustered volume group cluster
  Skipping volume group cluster
  LV      VG        Attr      LSize  Pool Origin Data%  Move Log Cpy%Sync Convert
  lv_home vg_taft01 -wi-ao---  9.94g
  lv_root vg_taft01 -wi-ao--- 50.00g
  lv_swap vg_taft01 -wi-ao---  7.81g
[root@taft-01 ~]# echo $?
5
Comment 7 Peter Rajnoha 2014-02-05 10:04:56 EST
(In reply to Corey Marthaler from comment #5)
> Looks like "--ignorelockingfailure" still doesn't do anything. The cluster
> volume w/o clvmd running still isn't visible.
> 
> ## RHEL6.4
> [root@taft-01 ~]# lvs --ignorelockingfailure
>   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.
>   Skipping clustered volume group cluster
>   Skipping volume group cluster
>   LV      VG        Attr      LSize  Pool Origin Data%  Move Log Cpy%Sync
> Convert 
>   lv_home vg_taft01 -wi-ao---  9.94g
>   lv_root vg_taft01 -wi-ao--- 50.00g
>   lv_swap vg_taft01 -wi-ao---  7.81g
> [root@taft-01 ~]# echo $?
> 5

This does not end with return code 5 because cluster locking failed, but because we were unable to list all logical volumes.

With recent code (lvm2 v2.02.103 and higher), we have a new option "--ignoreskippedcluster" that does what's needed here - to skip clustered VGs without disrupting the final lvm command return code.

The warning messages about failed locking initialisation will be always issued *unless* either of these are used:

  - the "--sysinit" option is used (this is aimed to be used in scripts during boot so the boot scripts don't need to modify the lvm.conf heavily just to pass the boot where the cluster is not yet set up)

  - the LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1 environment variable - one can use this if it's really really needed to suppress the messages for whatever reason (but normally we don't recommend this as the warning messages are useful to inform user that something is not going the way as intended)

So to sum it up, 3 things:
  - the --sysinit option (which is just a shortcut for setting certain other options, see the man page for more info, e.g. vgchange and lvchange one)
  - the LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1 environment variable
  - the --ignoreskippedcluster option (available in 6.5+)

There may be an argument that this is complex, but it's actually to be used only in specific situations that usual users normally don't get into - it suppresses things that should normally be visible for the user - like here the warning messages...

I'm closing this one with NEXTRELEASE as this is solved in 6.5, no need to backport to 5.11 unless there are high prio customer cases requesting this functionality.
Comment 8 Peter Rajnoha 2014-02-05 10:07:31 EST
...to solve the situation in this bug report, this should be used (with lvm2 2.02.103+):

export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
<lvm_command> --ingoreskippedcluster
...

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