Bug 1467411 - 'lvcreate --test' needs to be turned off (or fixed) for use with lvmlockd
'lvcreate --test' needs to be turned off (or fixed) for use with lvmlockd
Status: NEW
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2 (Show other bugs)
7.4
x86_64 Linux
unspecified Severity medium
: rc
: ---
Assigned To: David Teigland
cluster-qe@redhat.com
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-03 13:35 EDT by Corey Marthaler
Modified: 2017-10-19 17:50 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
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 2017-07-03 13:35:56 EDT
Description of problem:
This appears to be an extension of bug 1290874, which turned off 'lvconvert --test' when used in lvmlockd mode. lvcreate also need this apparently.


# test mode
[root@host-115 ~]# lvcreate --activate ey --test --type raid10 -i 2 -n testraid -L 500M raid_sanity
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  Using default stripesize 64.00 KiB.
  Test mode is not yet supported with lock type sanlock.
  Rounding size 500.00 MiB (125 extents) up to stripe boundary size 504.00 MiB(126 extents).
  Internal error: Attempt to write new VG metadata without locking raid_sanity
  Internal error: Attempt to unlock unlocked VG raid_sanity.
  Device '/dev/sde1' has been left open (1 remaining references).
  Device '/dev/sdc2' has been left open (1 remaining references).
  Device '/dev/sde2' has been left open (1 remaining references).
  Device '/dev/sdf1' has been left open (1 remaining references).
  Device '/dev/sdb1' has been left open (1 remaining references).
  Device '/dev/sdd2' has been left open (1 remaining references).
  Device '/dev/sdb2' has been left open (1 remaining references).
  Device '/dev/sdc1' has been left open (1 remaining references).
  Device '/dev/sdg1' has been left open (1 remaining references).
  Device '/dev/sdg2' has been left open (1 remaining references).
  Internal error: 10 device(s) were left open and have been closed.


# regular mode
[root@host-115 ~]# lvcreate --activate ey --type raid10 -i 2 -n testraid -L 500M raid_sanity
  Using default stripesize 64.00 KiB.
  Rounding size 500.00 MiB (125 extents) up to stripe boundary size 504.00 MiB(126 extents).
  Logical volume "testraid" created.


[root@host-115 ~]# systemctl status lvm2-lvmlockd
● lvm2-lvmlockd.service - LVM2 lock daemon
   Loaded: loaded (/usr/lib/systemd/system/lvm2-lvmlockd.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2017-06-30 16:32:14 CDT; 2 days ago
     Docs: man:lvmlockd(8)
 Main PID: 2452 (lvmlockd)
   CGroup: /system.slice/lvm2-lvmlockd.service
           └─2452 /usr/sbin/lvmlockd -f






Version-Release number of selected component (if applicable):
3.10.0-689.el7.x86_64

lvm2-2.02.171-7.el7    BUILT: Thu Jun 22 08:35:15 CDT 2017
lvm2-libs-2.02.171-7.el7    BUILT: Thu Jun 22 08:35:15 CDT 2017
lvm2-cluster-2.02.171-7.el7    BUILT: Thu Jun 22 08:35:15 CDT 2017
device-mapper-1.02.140-7.el7    BUILT: Thu Jun 22 08:35:15 CDT 2017
device-mapper-libs-1.02.140-7.el7    BUILT: Thu Jun 22 08:35:15 CDT 2017
device-mapper-event-1.02.140-7.el7    BUILT: Thu Jun 22 08:35:15 CDT 2017
device-mapper-event-libs-1.02.140-7.el7    BUILT: Thu Jun 22 08:35:15 CDT 2017
device-mapper-persistent-data-0.7.0-0.1.rc6.el7    BUILT: Mon Mar 27 10:15:46 CDT 2017
cmirror-2.02.171-7.el7    BUILT: Thu Jun 22 08:35:15 CDT 2017
sanlock-3.5.0-1.el7    BUILT: Wed Apr 26 09:37:30 CDT 2017
sanlock-lib-3.5.0-1.el7    BUILT: Wed Apr 26 09:37:30 CDT 2017
lvm2-lockd-2.02.171-7.el7    BUILT: Thu Jun 22 08:35:15 CDT 2017
Comment 2 Alasdair Kergon 2017-07-06 12:49:35 EDT
Well, the idea of --test mode is to do things as closely as possible to the normal operations but without actually making any persistent changes (like activating volumes or updating metadata).  To facilitate this it needs to be supported by the framework (i.e. low-level library) rather than needing changes to be made to every code path.  So let's now look for a way to ensure --test works with lockd across the full command set.
Comment 3 Alasdair Kergon 2017-07-06 13:16:53 EDT
So the question is whether enough locking infrastructure can safely be used with --test (in that the pieces used are considered to be below the LVM layer that needs to be tested so it's acceptable to activate them) or whether the locking operations should all default to 'success'.
Comment 4 David Teigland 2017-07-06 14:30:28 EDT
There is also 'lvmlockd --test' mode in which lvmlockd returns success for all operations.  With this, the command/client locking code is largely executed as normal (except for paths involving lock failures).

There is another issue involved here, which is properly cleaning up from a command that fails part way (or doesn't complete because of test mode).  If the command makes some changes in lvmlockd, then quits/fails, the state of things in lvmlockd may be incomplete/incorrect.  This is mainly an issue for complex thin/cache operations that modify multiple LVs (In those cases I think cleanly handling partial commands is a larger issue than locking.)
Comment 5 Alasdair Kergon 2017-07-06 20:13:36 EDT
So perhaps there could be a way for the client to tell the lvmlockd server to use test mode for all interactions from this particular client?

The basic use case for lvm --test is a user on a live system wanting to check as best they can what a command is going to do before running it for real.

It might be worth splitting this bugzilla into two - one for handling --test and one for working out way(s) of dealing with clean up in different sets of circumstances.  In some cases something might be able track what clean up is needed and do it automatically on failure, but there could remain cases where it needs to be worked out independently, possibly with the aid of hints stored in the metadata.

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